From b551537bed85af9c3aa4c72f2db9af9c082d42e1 Mon Sep 17 00:00:00 2001 From: James Jia - Test Date: Tue, 15 Aug 2023 23:55:59 -0700 Subject: [PATCH] Initial commit --- .github/workflows/js-lint-build-test.yml | 43 + .github/workflows/js-publish.yml | 44 + .github/workflows/py-lint-test.yml | 53 + v4-client-js/.env | 1 + v4-client-js/.eslintignore | 2 + v4-client-js/.eslintrc.js | 17 + v4-client-js/.gitignore | 22 + v4-client-js/.gitleaks.toml | 24 + v4-client-js/.gitleaksignore | 1 + v4-client-js/.nvmrc | 1 + v4-client-js/.telescope.json | 17 + v4-client-js/.vscode/launch.json | 11 + v4-client-js/LICENSE | 11 + v4-client-js/README.md | 35 + .../__native__/__ios__/v4-native-client.js | 201115 +++++++++++++++ .../__ios__/v4-native-client.js.map | 1 + v4-client-js/__tests__/helpers/baseClients.ts | 23 + v4-client-js/__tests__/helpers/constants.ts | 85 + v4-client-js/__tests__/lib/helpers.test.ts | 40 + v4-client-js/__tests__/lib/util.test.ts | 83 + v4-client-js/__tests__/lib/validation.test.ts | 244 + .../modules/client/AccountEndpoints.test.ts | 106 + .../modules/client/FaucetEndpoint.test.ts | 14 + .../modules/client/MarketsEndpoints.test.ts | 76 + .../modules/client/Transfers.test.ts | 63 + .../client/ValidatorGetEndpoints.test.ts | 44 + .../client/ValidatorPostEndpoints.test.ts | 55 + .../__tests__/modules/client/constants.ts | 3 + .../__tests__/modules/onboarding.test.ts | 64 + v4-client-js/examples/account_endpoints.ts | 142 + v4-client-js/examples/composite_example.ts | 60 + v4-client-js/examples/constants.ts | 27 + v4-client-js/examples/faucet_endpoint.ts | 23 + .../examples/human_readable_orders.json | 86 + v4-client-js/examples/json-encoding.ts | 33 + v4-client-js/examples/markets_endpoints.ts | 159 + v4-client-js/examples/native_examples.ts | 105 + v4-client-js/examples/optimal_node.ts | 51 + v4-client-js/examples/raw_orders.json | 130 + .../examples/transfer_example_deposit.ts | 37 + .../examples/transfer_example_send.ts | 79 + .../transfer_example_subaccount_transfer.ts | 40 + .../examples/transfer_example_withdraw.ts | 38 + .../transfer_example_withdraw_other.ts | 70 + .../examples/validator_get_example.ts | 92 + .../examples/validator_post_example.ts | 86 + v4-client-js/examples/wallet_address.ts | 17 + v4-client-js/examples/websocket_example.ts | 37 + v4-client-js/jest.config.js | 10 + v4-client-js/jest.globalSetup.js | 5 + v4-client-js/jest.setup.js | 1 + v4-client-js/package-lock.json | 30505 +++ v4-client-js/package.json | 72 + v4-client-js/scripts/bump_version.sh | 16 + v4-client-js/scripts/publish-if-not-exists.sh | 21 + v4-client-js/src/clients/composite-client.ts | 611 + v4-client-js/src/clients/constants.ts | 189 + v4-client-js/src/clients/faucet-client.ts | 27 + .../src/clients/helpers/chain-helpers.ts | 208 + .../src/clients/helpers/request-helpers.ts | 13 + v4-client-js/src/clients/indexer-client.ts | 39 + .../src/clients/lib/axios/axiosRequest.ts | 44 + v4-client-js/src/clients/lib/axios/errors.ts | 46 + v4-client-js/src/clients/lib/axios/index.ts | 7 + v4-client-js/src/clients/lib/axios/types.ts | 6 + v4-client-js/src/clients/lib/errors.ts | 70 + v4-client-js/src/clients/lib/registry.ts | 30 + v4-client-js/src/clients/modules/account.ts | 168 + v4-client-js/src/clients/modules/composer.ts | 235 + v4-client-js/src/clients/modules/get.ts | 329 + .../src/clients/modules/local-wallet.ts | 78 + v4-client-js/src/clients/modules/markets.ts | 77 + v4-client-js/src/clients/modules/post.ts | 484 + .../src/clients/modules/proto-includes.ts | 17 + v4-client-js/src/clients/modules/rest.ts | 37 + v4-client-js/src/clients/modules/signer.ts | 66 + .../src/clients/modules/tendermintClient.ts | 185 + v4-client-js/src/clients/native.ts | 728 + v4-client-js/src/clients/socket-client.ts | 296 + v4-client-js/src/clients/subaccount.ts | 24 + v4-client-js/src/clients/types.ts | 73 + v4-client-js/src/clients/validator-client.ts | 74 + v4-client-js/src/index.ts | 17 + v4-client-js/src/lib/constants.ts | 37 + v4-client-js/src/lib/errors.ts | 44 + v4-client-js/src/lib/helpers.ts | 59 + v4-client-js/src/lib/onboarding.ts | 64 + v4-client-js/src/lib/utils.ts | 36 + v4-client-js/src/lib/validation.ts | 151 + v4-client-js/src/network_optimizer.ts | 70 + v4-client-js/src/types.ts | 58 + v4-client-js/tasks.json | 16 + v4-client-js/tsconfig.eslint.json | 17 + v4-client-js/tsconfig.json | 20 + v4-client-js/webpack.config.js | 48 + v4-client-py/.gitignore | 129 + v4-client-py/.gitleaks.toml | 19 + v4-client-py/.gitleaksignore | 0 v4-client-py/.vscode/launch.json | 17 + v4-client-py/.vscode/settings.json | 5 + v4-client-py/LICENSE | 11 + v4-client-py/README.md | 96 + v4-client-py/dydx4/__init__.py | 10 + v4-client-py/dydx4/chain/__init__.py | 0 v4-client-py/dydx4/chain/aerial/__init__.py | 2 + .../dydx4/chain/aerial/client/__init__.py | 692 + .../dydx4/chain/aerial/client/bank.py | 26 + .../dydx4/chain/aerial/client/distribution.py | 18 + .../dydx4/chain/aerial/client/staking.py | 108 + .../dydx4/chain/aerial/client/utils.py | 118 + v4-client-py/dydx4/chain/aerial/coins.py | 32 + v4-client-py/dydx4/chain/aerial/config.py | 135 + v4-client-py/dydx4/chain/aerial/exceptions.py | 60 + v4-client-py/dydx4/chain/aerial/faucet.py | 139 + v4-client-py/dydx4/chain/aerial/gas.py | 140 + v4-client-py/dydx4/chain/aerial/tx.py | 253 + v4-client-py/dydx4/chain/aerial/tx_helpers.py | 162 + v4-client-py/dydx4/chain/aerial/urls.py | 89 + v4-client-py/dydx4/chain/aerial/wallet.py | 138 + v4-client-py/dydx4/chain/auth/__init__.py | 2 + v4-client-py/dydx4/chain/auth/interface.py | 35 + v4-client-py/dydx4/chain/auth/rest_client.py | 49 + v4-client-py/dydx4/chain/bank/__init__.py | 2 + v4-client-py/dydx4/chain/bank/interface.py | 99 + v4-client-py/dydx4/chain/bank/rest_client.py | 124 + v4-client-py/dydx4/chain/common/__init__.py | 2 + .../dydx4/chain/common/rest_client.py | 144 + v4-client-py/dydx4/chain/common/types.py | 11 + v4-client-py/dydx4/chain/common/utils.py | 22 + v4-client-py/dydx4/chain/crypto/__init__.py | 20 + v4-client-py/dydx4/chain/crypto/address.py | 104 + v4-client-py/dydx4/chain/crypto/hashfuncs.py | 51 + v4-client-py/dydx4/chain/crypto/interface.py | 50 + v4-client-py/dydx4/chain/crypto/keypairs.py | 231 + .../dydx4/chain/crypto/keypairs_bls.py | 230 + .../dydx4/chain/distribution/__init__.py | 20 + .../dydx4/chain/distribution/interface.py | 138 + .../dydx4/chain/distribution/rest_client.py | 175 + v4-client-py/dydx4/chain/evidence/__init__.py | 20 + .../dydx4/chain/evidence/interface.py | 52 + .../dydx4/chain/evidence/rest_client.py | 69 + v4-client-py/dydx4/chain/gov/__init__.py | 20 + v4-client-py/dydx4/chain/gov/interface.py | 123 + v4-client-py/dydx4/chain/gov/rest_client.py | 165 + v4-client-py/dydx4/chain/mint/__init__.py | 20 + v4-client-py/dydx4/chain/mint/interface.py | 56 + v4-client-py/dydx4/chain/mint/rest_client.py | 105 + v4-client-py/dydx4/chain/params/__init__.py | 20 + v4-client-py/dydx4/chain/params/interface.py | 40 + .../dydx4/chain/params/rest_client.py | 53 + v4-client-py/dydx4/chain/slashing/__init__.py | 20 + .../dydx4/chain/slashing/interface.py | 63 + .../dydx4/chain/slashing/rest_client.py | 81 + v4-client-py/dydx4/chain/staking/__init__.py | 20 + v4-client-py/dydx4/chain/staking/interface.py | 201 + .../dydx4/chain/staking/rest_client.py | 261 + .../dydx4/chain/tendermint/__init__.py | 19 + .../dydx4/chain/tendermint/interface.py | 100 + .../dydx4/chain/tendermint/rest_client.py | 127 + v4-client-py/dydx4/chain/tx/__init__.py | 20 + v4-client-py/dydx4/chain/tx/interface.py | 64 + v4-client-py/dydx4/chain/tx/rest_client.py | 117 + v4-client-py/dydx4/chain/upgrade/__init__.py | 19 + v4-client-py/dydx4/chain/upgrade/interface.py | 50 + .../dydx4/chain/upgrade/rest_client.py | 67 + v4-client-py/dydx4/clients/__init__.py | 6 + v4-client-py/dydx4/clients/composer.py | 200 + v4-client-py/dydx4/clients/constants.py | 191 + .../dydx4/clients/dydx_composite_client.py | 371 + .../dydx4/clients/dydx_faucet_client.py | 54 + .../dydx4/clients/dydx_indexer_client.py | 34 + .../dydx4/clients/dydx_socket_client.py | 136 + v4-client-py/dydx4/clients/dydx_subaccount.py | 32 + .../dydx4/clients/dydx_validator_client.py | 32 + v4-client-py/dydx4/clients/errors.py | 56 + .../dydx4/clients/helpers/__init__.py | 0 .../dydx4/clients/helpers/chain_helpers.py | 128 + .../dydx4/clients/helpers/request_helpers.py | 48 + .../dydx4/clients/helpers/requests.py | 44 + .../dydx4/clients/modules/__init__.py | 0 v4-client-py/dydx4/clients/modules/account.py | 463 + v4-client-py/dydx4/clients/modules/get.py | 249 + v4-client-py/dydx4/clients/modules/markets.py | 237 + v4-client-py/dydx4/clients/modules/post.py | 291 + v4-client-py/examples/__init__.py | 0 v4-client-py/examples/account_endpoints.py | 122 + v4-client-py/examples/chain_client/Account.py | 21 + .../examples/chain_client/BankBalance.py | 23 + .../examples/chain_client/BankBalances.py | 22 + v4-client-py/examples/chain_client/GetTx.py | 22 + v4-client-py/examples/chain_client/test.py | 1 + v4-client-py/examples/composite_example.py | 86 + v4-client-py/examples/faucet_endpoint.py | 22 + .../examples/human_readable_orders.json | 86 + v4-client-py/examples/markets_endpoints.py | 111 + v4-client-py/examples/raw_orders.json | 130 + .../examples/transfer_example_deposit.py | 32 + .../transfer_example_subaccount_transfer.py | 34 + .../examples/transfer_example_withdraw.py | 32 + v4-client-py/examples/utils.py | 10 + .../examples/validator_get_examples.py | 92 + .../examples/validator_post_examples.py | 83 + v4-client-py/examples/wallet_address.py | 15 + v4-client-py/examples/websocket_example.py | 44 + v4-client-py/pyproject.toml | 41 + v4-client-py/pytest.ini | 8 + v4-client-py/pytest_integration.ini | 8 + v4-client-py/requirements-lint.txt | 2 + v4-client-py/requirements-publish.txt | 3 + v4-client-py/requirements-test.txt | 20 + v4-client-py/requirements.txt | 20 + v4-client-py/setup.py | 43 + v4-client-py/tests/__init__.py | 0 v4-client-py/tests/constants.py | 26 + .../tests/test_indexer_account_endpoints.py | 130 + .../tests/test_indexer_markets_endpoints.py | 124 + .../tests/test_validator_get_endpoints.py | 97 + v4-client-py/tests_integration/__init__.py | 0 .../human_readable_orders.json | 86 + .../tests_integration/raw_orders.json | 130 + v4-client-py/tests_integration/test_faucet.py | 22 + v4-client-py/tests_integration/test_trades.py | 84 + .../tests_integration/test_transfers.py | 67 + v4-client-py/tests_integration/util.py | 20 + 224 files changed, 249409 insertions(+) create mode 100644 .github/workflows/js-lint-build-test.yml create mode 100644 .github/workflows/js-publish.yml create mode 100644 .github/workflows/py-lint-test.yml create mode 100644 v4-client-js/.env create mode 100644 v4-client-js/.eslintignore create mode 100644 v4-client-js/.eslintrc.js create mode 100644 v4-client-js/.gitignore create mode 100644 v4-client-js/.gitleaks.toml create mode 100644 v4-client-js/.gitleaksignore create mode 100644 v4-client-js/.nvmrc create mode 100644 v4-client-js/.telescope.json create mode 100644 v4-client-js/.vscode/launch.json create mode 100644 v4-client-js/LICENSE create mode 100644 v4-client-js/README.md create mode 100644 v4-client-js/__native__/__ios__/v4-native-client.js create mode 100644 v4-client-js/__native__/__ios__/v4-native-client.js.map create mode 100644 v4-client-js/__tests__/helpers/baseClients.ts create mode 100644 v4-client-js/__tests__/helpers/constants.ts create mode 100644 v4-client-js/__tests__/lib/helpers.test.ts create mode 100644 v4-client-js/__tests__/lib/util.test.ts create mode 100644 v4-client-js/__tests__/lib/validation.test.ts create mode 100644 v4-client-js/__tests__/modules/client/AccountEndpoints.test.ts create mode 100644 v4-client-js/__tests__/modules/client/FaucetEndpoint.test.ts create mode 100644 v4-client-js/__tests__/modules/client/MarketsEndpoints.test.ts create mode 100644 v4-client-js/__tests__/modules/client/Transfers.test.ts create mode 100644 v4-client-js/__tests__/modules/client/ValidatorGetEndpoints.test.ts create mode 100644 v4-client-js/__tests__/modules/client/ValidatorPostEndpoints.test.ts create mode 100644 v4-client-js/__tests__/modules/client/constants.ts create mode 100644 v4-client-js/__tests__/modules/onboarding.test.ts create mode 100644 v4-client-js/examples/account_endpoints.ts create mode 100644 v4-client-js/examples/composite_example.ts create mode 100644 v4-client-js/examples/constants.ts create mode 100644 v4-client-js/examples/faucet_endpoint.ts create mode 100644 v4-client-js/examples/human_readable_orders.json create mode 100644 v4-client-js/examples/json-encoding.ts create mode 100644 v4-client-js/examples/markets_endpoints.ts create mode 100644 v4-client-js/examples/native_examples.ts create mode 100644 v4-client-js/examples/optimal_node.ts create mode 100644 v4-client-js/examples/raw_orders.json create mode 100644 v4-client-js/examples/transfer_example_deposit.ts create mode 100644 v4-client-js/examples/transfer_example_send.ts create mode 100644 v4-client-js/examples/transfer_example_subaccount_transfer.ts create mode 100644 v4-client-js/examples/transfer_example_withdraw.ts create mode 100644 v4-client-js/examples/transfer_example_withdraw_other.ts create mode 100644 v4-client-js/examples/validator_get_example.ts create mode 100644 v4-client-js/examples/validator_post_example.ts create mode 100644 v4-client-js/examples/wallet_address.ts create mode 100644 v4-client-js/examples/websocket_example.ts create mode 100644 v4-client-js/jest.config.js create mode 100644 v4-client-js/jest.globalSetup.js create mode 100644 v4-client-js/jest.setup.js create mode 100644 v4-client-js/package-lock.json create mode 100644 v4-client-js/package.json create mode 100755 v4-client-js/scripts/bump_version.sh create mode 100755 v4-client-js/scripts/publish-if-not-exists.sh create mode 100644 v4-client-js/src/clients/composite-client.ts create mode 100644 v4-client-js/src/clients/constants.ts create mode 100644 v4-client-js/src/clients/faucet-client.ts create mode 100644 v4-client-js/src/clients/helpers/chain-helpers.ts create mode 100644 v4-client-js/src/clients/helpers/request-helpers.ts create mode 100644 v4-client-js/src/clients/indexer-client.ts create mode 100644 v4-client-js/src/clients/lib/axios/axiosRequest.ts create mode 100644 v4-client-js/src/clients/lib/axios/errors.ts create mode 100644 v4-client-js/src/clients/lib/axios/index.ts create mode 100644 v4-client-js/src/clients/lib/axios/types.ts create mode 100644 v4-client-js/src/clients/lib/errors.ts create mode 100644 v4-client-js/src/clients/lib/registry.ts create mode 100644 v4-client-js/src/clients/modules/account.ts create mode 100644 v4-client-js/src/clients/modules/composer.ts create mode 100644 v4-client-js/src/clients/modules/get.ts create mode 100644 v4-client-js/src/clients/modules/local-wallet.ts create mode 100644 v4-client-js/src/clients/modules/markets.ts create mode 100644 v4-client-js/src/clients/modules/post.ts create mode 100644 v4-client-js/src/clients/modules/proto-includes.ts create mode 100644 v4-client-js/src/clients/modules/rest.ts create mode 100644 v4-client-js/src/clients/modules/signer.ts create mode 100644 v4-client-js/src/clients/modules/tendermintClient.ts create mode 100644 v4-client-js/src/clients/native.ts create mode 100644 v4-client-js/src/clients/socket-client.ts create mode 100644 v4-client-js/src/clients/subaccount.ts create mode 100644 v4-client-js/src/clients/types.ts create mode 100644 v4-client-js/src/clients/validator-client.ts create mode 100644 v4-client-js/src/index.ts create mode 100644 v4-client-js/src/lib/constants.ts create mode 100644 v4-client-js/src/lib/errors.ts create mode 100644 v4-client-js/src/lib/helpers.ts create mode 100644 v4-client-js/src/lib/onboarding.ts create mode 100644 v4-client-js/src/lib/utils.ts create mode 100644 v4-client-js/src/lib/validation.ts create mode 100644 v4-client-js/src/network_optimizer.ts create mode 100644 v4-client-js/src/types.ts create mode 100644 v4-client-js/tasks.json create mode 100644 v4-client-js/tsconfig.eslint.json create mode 100644 v4-client-js/tsconfig.json create mode 100644 v4-client-js/webpack.config.js create mode 100644 v4-client-py/.gitignore create mode 100644 v4-client-py/.gitleaks.toml create mode 100644 v4-client-py/.gitleaksignore create mode 100644 v4-client-py/.vscode/launch.json create mode 100644 v4-client-py/.vscode/settings.json create mode 100644 v4-client-py/LICENSE create mode 100644 v4-client-py/README.md create mode 100644 v4-client-py/dydx4/__init__.py create mode 100644 v4-client-py/dydx4/chain/__init__.py create mode 100644 v4-client-py/dydx4/chain/aerial/__init__.py create mode 100644 v4-client-py/dydx4/chain/aerial/client/__init__.py create mode 100644 v4-client-py/dydx4/chain/aerial/client/bank.py create mode 100644 v4-client-py/dydx4/chain/aerial/client/distribution.py create mode 100644 v4-client-py/dydx4/chain/aerial/client/staking.py create mode 100644 v4-client-py/dydx4/chain/aerial/client/utils.py create mode 100644 v4-client-py/dydx4/chain/aerial/coins.py create mode 100644 v4-client-py/dydx4/chain/aerial/config.py create mode 100644 v4-client-py/dydx4/chain/aerial/exceptions.py create mode 100644 v4-client-py/dydx4/chain/aerial/faucet.py create mode 100644 v4-client-py/dydx4/chain/aerial/gas.py create mode 100644 v4-client-py/dydx4/chain/aerial/tx.py create mode 100644 v4-client-py/dydx4/chain/aerial/tx_helpers.py create mode 100644 v4-client-py/dydx4/chain/aerial/urls.py create mode 100644 v4-client-py/dydx4/chain/aerial/wallet.py create mode 100644 v4-client-py/dydx4/chain/auth/__init__.py create mode 100644 v4-client-py/dydx4/chain/auth/interface.py create mode 100644 v4-client-py/dydx4/chain/auth/rest_client.py create mode 100644 v4-client-py/dydx4/chain/bank/__init__.py create mode 100644 v4-client-py/dydx4/chain/bank/interface.py create mode 100644 v4-client-py/dydx4/chain/bank/rest_client.py create mode 100644 v4-client-py/dydx4/chain/common/__init__.py create mode 100644 v4-client-py/dydx4/chain/common/rest_client.py create mode 100644 v4-client-py/dydx4/chain/common/types.py create mode 100644 v4-client-py/dydx4/chain/common/utils.py create mode 100644 v4-client-py/dydx4/chain/crypto/__init__.py create mode 100644 v4-client-py/dydx4/chain/crypto/address.py create mode 100644 v4-client-py/dydx4/chain/crypto/hashfuncs.py create mode 100644 v4-client-py/dydx4/chain/crypto/interface.py create mode 100644 v4-client-py/dydx4/chain/crypto/keypairs.py create mode 100644 v4-client-py/dydx4/chain/crypto/keypairs_bls.py create mode 100644 v4-client-py/dydx4/chain/distribution/__init__.py create mode 100644 v4-client-py/dydx4/chain/distribution/interface.py create mode 100644 v4-client-py/dydx4/chain/distribution/rest_client.py create mode 100644 v4-client-py/dydx4/chain/evidence/__init__.py create mode 100644 v4-client-py/dydx4/chain/evidence/interface.py create mode 100644 v4-client-py/dydx4/chain/evidence/rest_client.py create mode 100644 v4-client-py/dydx4/chain/gov/__init__.py create mode 100644 v4-client-py/dydx4/chain/gov/interface.py create mode 100644 v4-client-py/dydx4/chain/gov/rest_client.py create mode 100644 v4-client-py/dydx4/chain/mint/__init__.py create mode 100644 v4-client-py/dydx4/chain/mint/interface.py create mode 100644 v4-client-py/dydx4/chain/mint/rest_client.py create mode 100644 v4-client-py/dydx4/chain/params/__init__.py create mode 100644 v4-client-py/dydx4/chain/params/interface.py create mode 100644 v4-client-py/dydx4/chain/params/rest_client.py create mode 100644 v4-client-py/dydx4/chain/slashing/__init__.py create mode 100644 v4-client-py/dydx4/chain/slashing/interface.py create mode 100644 v4-client-py/dydx4/chain/slashing/rest_client.py create mode 100644 v4-client-py/dydx4/chain/staking/__init__.py create mode 100644 v4-client-py/dydx4/chain/staking/interface.py create mode 100644 v4-client-py/dydx4/chain/staking/rest_client.py create mode 100644 v4-client-py/dydx4/chain/tendermint/__init__.py create mode 100644 v4-client-py/dydx4/chain/tendermint/interface.py create mode 100644 v4-client-py/dydx4/chain/tendermint/rest_client.py create mode 100644 v4-client-py/dydx4/chain/tx/__init__.py create mode 100644 v4-client-py/dydx4/chain/tx/interface.py create mode 100644 v4-client-py/dydx4/chain/tx/rest_client.py create mode 100644 v4-client-py/dydx4/chain/upgrade/__init__.py create mode 100644 v4-client-py/dydx4/chain/upgrade/interface.py create mode 100644 v4-client-py/dydx4/chain/upgrade/rest_client.py create mode 100644 v4-client-py/dydx4/clients/__init__.py create mode 100644 v4-client-py/dydx4/clients/composer.py create mode 100644 v4-client-py/dydx4/clients/constants.py create mode 100644 v4-client-py/dydx4/clients/dydx_composite_client.py create mode 100644 v4-client-py/dydx4/clients/dydx_faucet_client.py create mode 100644 v4-client-py/dydx4/clients/dydx_indexer_client.py create mode 100644 v4-client-py/dydx4/clients/dydx_socket_client.py create mode 100644 v4-client-py/dydx4/clients/dydx_subaccount.py create mode 100644 v4-client-py/dydx4/clients/dydx_validator_client.py create mode 100644 v4-client-py/dydx4/clients/errors.py create mode 100644 v4-client-py/dydx4/clients/helpers/__init__.py create mode 100644 v4-client-py/dydx4/clients/helpers/chain_helpers.py create mode 100644 v4-client-py/dydx4/clients/helpers/request_helpers.py create mode 100644 v4-client-py/dydx4/clients/helpers/requests.py create mode 100644 v4-client-py/dydx4/clients/modules/__init__.py create mode 100644 v4-client-py/dydx4/clients/modules/account.py create mode 100644 v4-client-py/dydx4/clients/modules/get.py create mode 100644 v4-client-py/dydx4/clients/modules/markets.py create mode 100644 v4-client-py/dydx4/clients/modules/post.py create mode 100644 v4-client-py/examples/__init__.py create mode 100644 v4-client-py/examples/account_endpoints.py create mode 100644 v4-client-py/examples/chain_client/Account.py create mode 100644 v4-client-py/examples/chain_client/BankBalance.py create mode 100644 v4-client-py/examples/chain_client/BankBalances.py create mode 100644 v4-client-py/examples/chain_client/GetTx.py create mode 100644 v4-client-py/examples/chain_client/test.py create mode 100644 v4-client-py/examples/composite_example.py create mode 100644 v4-client-py/examples/faucet_endpoint.py create mode 100644 v4-client-py/examples/human_readable_orders.json create mode 100644 v4-client-py/examples/markets_endpoints.py create mode 100644 v4-client-py/examples/raw_orders.json create mode 100644 v4-client-py/examples/transfer_example_deposit.py create mode 100644 v4-client-py/examples/transfer_example_subaccount_transfer.py create mode 100644 v4-client-py/examples/transfer_example_withdraw.py create mode 100644 v4-client-py/examples/utils.py create mode 100644 v4-client-py/examples/validator_get_examples.py create mode 100644 v4-client-py/examples/validator_post_examples.py create mode 100644 v4-client-py/examples/wallet_address.py create mode 100644 v4-client-py/examples/websocket_example.py create mode 100644 v4-client-py/pyproject.toml create mode 100644 v4-client-py/pytest.ini create mode 100644 v4-client-py/pytest_integration.ini create mode 100644 v4-client-py/requirements-lint.txt create mode 100644 v4-client-py/requirements-publish.txt create mode 100644 v4-client-py/requirements-test.txt create mode 100644 v4-client-py/requirements.txt create mode 100644 v4-client-py/setup.py create mode 100644 v4-client-py/tests/__init__.py create mode 100644 v4-client-py/tests/constants.py create mode 100644 v4-client-py/tests/test_indexer_account_endpoints.py create mode 100644 v4-client-py/tests/test_indexer_markets_endpoints.py create mode 100644 v4-client-py/tests/test_validator_get_endpoints.py create mode 100644 v4-client-py/tests_integration/__init__.py create mode 100644 v4-client-py/tests_integration/human_readable_orders.json create mode 100644 v4-client-py/tests_integration/raw_orders.json create mode 100644 v4-client-py/tests_integration/test_faucet.py create mode 100644 v4-client-py/tests_integration/test_trades.py create mode 100644 v4-client-py/tests_integration/test_transfers.py create mode 100644 v4-client-py/tests_integration/util.py diff --git a/.github/workflows/js-lint-build-test.yml b/.github/workflows/js-lint-build-test.yml new file mode 100644 index 00000000..46799b83 --- /dev/null +++ b/.github/workflows/js-lint-build-test.yml @@ -0,0 +1,43 @@ +name: "[v4-client-js] Lint, Build, & Test" +on: # yamllint disable-line rule:truthy + pull_request: + paths: + - 'v4-client-js/**' + push: + paths: + - 'v4-client-js/**' + branches: + - main + - "release/*" + +jobs: + CI: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./v4-client-js + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Use Node.js 16 + uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org + cache: "npm" + cache-dependency-path: '**/package-lock.json' + + - name: Install + run: npm ci + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_READ }} + + - name: Run eslint + run: npm run lint + + - name: Build + run: npm run build + + - name: Test + run: npm test diff --git a/.github/workflows/js-publish.yml b/.github/workflows/js-publish.yml new file mode 100644 index 00000000..15fa45ef --- /dev/null +++ b/.github/workflows/js-publish.yml @@ -0,0 +1,44 @@ +name: "[v4-client-js] Publish Image to NPM" +on: # yamllint disable-line rule:truthy + push: + paths: + - 'v4-client-js/**' + branches: + - main + +# Ensure only a single instance of this workflow is running. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-and-publish: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./v4-client-js + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 # fetch all history for all tags and branches + + - name: Npm + uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org + cache: "npm" + cache-dependency-path: '**/package-lock.json' + + - name: Install + run: npm ci + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_READ }} + + - name: Publish + run: ./scripts/publish-if-not-exists.sh + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_WRITE }} diff --git a/.github/workflows/py-lint-test.yml b/.github/workflows/py-lint-test.yml new file mode 100644 index 00000000..f52e98f0 --- /dev/null +++ b/.github/workflows/py-lint-test.yml @@ -0,0 +1,53 @@ +name: "[v4-client-py] Lint, Test" + +on: # yamllint disable-line rule:truthy + pull_request: + paths: + - 'v4-client-py/**' + push: + paths: + - 'v4-client-py/**' + branches: + - main + - "release/*" + +jobs: + lint: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./v4-client-py + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Install Dependencies + run: pip install -r requirements-lint.txt + + - name: Lint + run: flake8 + + test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./v4-client-py + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Install Dependencies + run: sudo pip install -r requirements-test.txt + + - name: Run pytest + run: pytest diff --git a/v4-client-js/.env b/v4-client-js/.env new file mode 100644 index 00000000..0386d263 --- /dev/null +++ b/v4-client-js/.env @@ -0,0 +1 @@ +SERVICE_NAME=v4-client diff --git a/v4-client-js/.eslintignore b/v4-client-js/.eslintignore new file mode 100644 index 00000000..2746a109 --- /dev/null +++ b/v4-client-js/.eslintignore @@ -0,0 +1,2 @@ +__native__/*.js +__native__/__ios__/*.js \ No newline at end of file diff --git a/v4-client-js/.eslintrc.js b/v4-client-js/.eslintrc.js new file mode 100644 index 00000000..07bf553d --- /dev/null +++ b/v4-client-js/.eslintrc.js @@ -0,0 +1,17 @@ +module.exports = { + extends: './node_modules/@dydxprotocol/node-service-base-dev/.eslintrc.js', + + // Override the base configuration to set the correct tsconfigRootDir. + parserOptions: { + tsconfigRootDir: __dirname, + }, + + ignorePatterns: [ + '**/examples/**/*.js', + '**/codegen/**/*.ts', + ], + + rules: { + 'no-console': 'off', + }, +}; diff --git a/v4-client-js/.gitignore b/v4-client-js/.gitignore new file mode 100644 index 00000000..b815fb07 --- /dev/null +++ b/v4-client-js/.gitignore @@ -0,0 +1,22 @@ + +# dependencies +node_modules/ + +# testing +coverage/ +.env.test + +# production +build/ +out/ + +# misc +.DS_Store +.env.local +.nyc_output +npm-debug.log +.env.test + +# vim +*.swo +*.swp diff --git a/v4-client-js/.gitleaks.toml b/v4-client-js/.gitleaks.toml new file mode 100644 index 00000000..10213a5d --- /dev/null +++ b/v4-client-js/.gitleaks.toml @@ -0,0 +1,24 @@ +# Title for the gitleaks configuration file. +title = "Gitleaks title" + +[extend] +# useDefault will extend the base configuration with the default gitleaks config: +# https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml +useDefault = true + +[allowlist] +paths = [ + '''gitleaks\.toml''', +] + +regexTarget = "line" +regexes = [ + '''clientId''', + '''isEd25519Pubkey''', + '''isSecp256k1Pubkey''', + '''Ed25519Keypair;''', + '''Secp256k1Pubkey''', + '''e92a6595c934c991d3b3e987ea9b3125bf61a076deab3a9cb519787b7b3e8d77''', + '''8d805729d752cbeccbbce08531cc38b271031ae250f7b67bd5f1bf3827c46d87''', + '''44de77c4ee23e1008d4ebf23c9b4b6dca0fd29aadb0950a5bf96dc81b4f4bfc3''', +] diff --git a/v4-client-js/.gitleaksignore b/v4-client-js/.gitleaksignore new file mode 100644 index 00000000..b45e96f7 --- /dev/null +++ b/v4-client-js/.gitleaksignore @@ -0,0 +1 @@ +ee48563a588a0d4bef717c4a64288d676b1f2c84:.coveralls.yml:generic-api-key:1 diff --git a/v4-client-js/.nvmrc b/v4-client-js/.nvmrc new file mode 100644 index 00000000..3f430af8 --- /dev/null +++ b/v4-client-js/.nvmrc @@ -0,0 +1 @@ +v18 diff --git a/v4-client-js/.telescope.json b/v4-client-js/.telescope.json new file mode 100644 index 00000000..c360e551 --- /dev/null +++ b/v4-client-js/.telescope.json @@ -0,0 +1,17 @@ +{ + "protoDirs": [ + "./proto" + ], + "outPath": "./src/codegen", + "options": { + "aminoEncoding": { + "enabled": false + }, + "lcdClients": { + "enabled": true + }, + "rpcClients": { + "enabled": true + } + } +} \ No newline at end of file diff --git a/v4-client-js/.vscode/launch.json b/v4-client-js/.vscode/launch.json new file mode 100644 index 00000000..f3873ef9 --- /dev/null +++ b/v4-client-js/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Node.js - Debug Current File", + "type": "node", + "request": "launch", + "program": "${file}" + } + ] +} \ No newline at end of file diff --git a/v4-client-js/LICENSE b/v4-client-js/LICENSE new file mode 100644 index 00000000..1e62cfb7 --- /dev/null +++ b/v4-client-js/LICENSE @@ -0,0 +1,11 @@ +Proprietary License © 2023 dYdX Trading Inc. + +dYdX Trading Inc. ("dYdX") hereby grants you the right to access, copy and use the code in this repository (the "Licensed Code") solely for purposes of evaluating the Licensed Code and evaluating interoperability of the Licensed Code with your products and services. + +You agree not to (a) access, copy or use the Licensed Code for any purpose other than as expressly licensed above, (b) provide, disclose or distribute the Licensed Code to any third party, or (c) modify or creative derivative works of the Licensed Code. Any violation of these terms will automatically terminate your rights under these terms. + +All copies of the Licensed Code are subject to these terms. You must conspicuously display these terms on each copy of the Licensed Code. + +dYdX intends to make the Licensed Code available under an open source license in the near term. The terms of this license apply unless and until the Licensed Code is made available by dYdX under an open source license. + +These terms do not grant you any right in any trademarks, service marks or logos of dYdX or its affiliates. TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED CODE IS PROVIDED "AS IS". DYDX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND TITLE. diff --git a/v4-client-js/README.md b/v4-client-js/README.md new file mode 100644 index 00000000..9a3fd512 --- /dev/null +++ b/v4-client-js/README.md @@ -0,0 +1,35 @@ +# V4 Client + +The V4-Client is the Typescript client for placing transactions and querying the dYdX chain. + +## Development + +`v4-client` uses node `v18` for development. You can use `nvm` to manage different versions of node. + +``` +nvm install +nvm use +nvm alias default $(nvm version) # optional +``` + +You can run the following commands to ensure that you are running the correct `node` and `npm` versions. +``` +node -v # expected: v18.x.x (should match .nvmrc) +npm -v # expected: 8.x.x +``` + +## Single-JS for mobile apps + +Mobile apps needs to load JS as a single JS file. To build, run +``` +npm run webpack +``` + +The file is generated in __native__/__ios__/v4-native-client.js +Pending: Different configurations may be needed to generate JS for Android app + +## Release + +Using the `npm version` command will update the appropriate version tags within the package locks and also will add a git tag with the version number.. +For example `npm version minor` will perform the necessary changes for a minor version release. After the change is merged, a GitHub action will +[publish](https://github.com/dydxprotocol/v4-client/blob/master/.github/workflows/publish.yml) the new release. diff --git a/v4-client-js/__native__/__ios__/v4-native-client.js b/v4-client-js/__native__/__ios__/v4-native-client.js new file mode 100644 index 00000000..70076268 --- /dev/null +++ b/v4-client-js/__native__/__ios__/v4-native-client.js @@ -0,0 +1,201115 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else { + var a = factory(); + for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; + } +})(this, function() { +return /******/ (function() { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./node_modules/@confio/ics23/build/compress.js": +/*!******************************************************!*\ + !*** ./node_modules/@confio/ics23/build/compress.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.decompress = exports.compress = void 0; +const codecimpl_1 = __webpack_require__(/*! ./generated/codecimpl */ "./node_modules/@confio/ics23/build/generated/codecimpl.js"); +function compress(proof) { + if (!proof.batch) { + return proof; + } + return { compressed: compressBatch(proof.batch) }; +} +exports.compress = compress; +function decompress(proof) { + if (!proof.compressed) { + return proof; + } + return { batch: decompressBatch(proof.compressed) }; +} +exports.decompress = decompress; +function compressBatch(proof) { + const centries = []; + const lookup = []; + const registry = new Map(); + for (const entry of proof.entries) { + if (entry.exist) { + const centry = { exist: compressExist(entry.exist, lookup, registry) }; + centries.push(centry); + } + else if (entry.nonexist) { + const non = entry.nonexist; + const centry = { + nonexist: { + key: non.key, + left: compressExist(non.left, lookup, registry), + right: compressExist(non.right, lookup, registry), + }, + }; + centries.push(centry); + } + else { + throw new Error("Unexpected batch entry during compress"); + } + } + return { + entries: centries, + lookupInners: lookup, + }; +} +function compressExist(exist, lookup, registry) { + if (!exist) { + return undefined; + } + const path = exist.path.map((inner) => { + const sig = codecimpl_1.ics23.InnerOp.encode(inner).finish(); + let idx = registry.get(sig); + if (idx === undefined) { + idx = lookup.length; + lookup.push(inner); + registry.set(sig, idx); + } + return idx; + }); + return { + key: exist.key, + value: exist.value, + leaf: exist.leaf, + path, + }; +} +function decompressBatch(proof) { + const lookup = proof.lookupInners; + const entries = proof.entries.map((comp) => { + if (comp.exist) { + return { exist: decompressExist(comp.exist, lookup) }; + } + else if (comp.nonexist) { + const non = comp.nonexist; + return { + nonexist: { + key: non.key, + left: decompressExist(non.left, lookup), + right: decompressExist(non.right, lookup), + }, + }; + } + else { + throw new Error("Unexpected batch entry during compress"); + } + }); + return { + entries, + }; +} +function decompressExist(exist, lookup) { + if (!exist) { + return undefined; + } + const { key, value, leaf, path } = exist; + const newPath = (path || []).map((idx) => lookup[idx]); + return { key, value, leaf, path: newPath }; +} +//# sourceMappingURL=compress.js.map + +/***/ }), + +/***/ "./node_modules/@confio/ics23/build/generated/codecimpl.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@confio/ics23/build/generated/codecimpl.js ***! + \*****************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ + + +var $protobuf = __webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js"); + +// Common aliases +var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + +// Exported root namespace +var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + +$root.ics23 = (function() { + + /** + * Namespace ics23. + * @exports ics23 + * @namespace + */ + var ics23 = {}; + + /** + * HashOp enum. + * @name ics23.HashOp + * @enum {string} + * @property {number} NO_HASH=0 NO_HASH value + * @property {number} SHA256=1 SHA256 value + * @property {number} SHA512=2 SHA512 value + * @property {number} KECCAK=3 KECCAK value + * @property {number} RIPEMD160=4 RIPEMD160 value + * @property {number} BITCOIN=5 BITCOIN value + * @property {number} SHA512_256=6 SHA512_256 value + */ + ics23.HashOp = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NO_HASH"] = 0; + values[valuesById[1] = "SHA256"] = 1; + values[valuesById[2] = "SHA512"] = 2; + values[valuesById[3] = "KECCAK"] = 3; + values[valuesById[4] = "RIPEMD160"] = 4; + values[valuesById[5] = "BITCOIN"] = 5; + values[valuesById[6] = "SHA512_256"] = 6; + return values; + })(); + + /** + * LengthOp defines how to process the key and value of the LeafOp + * to include length information. After encoding the length with the given + * algorithm, the length will be prepended to the key and value bytes. + * (Each one with it's own encoded length) + * @name ics23.LengthOp + * @enum {string} + * @property {number} NO_PREFIX=0 NO_PREFIX value + * @property {number} VAR_PROTO=1 VAR_PROTO value + * @property {number} VAR_RLP=2 VAR_RLP value + * @property {number} FIXED32_BIG=3 FIXED32_BIG value + * @property {number} FIXED32_LITTLE=4 FIXED32_LITTLE value + * @property {number} FIXED64_BIG=5 FIXED64_BIG value + * @property {number} FIXED64_LITTLE=6 FIXED64_LITTLE value + * @property {number} REQUIRE_32_BYTES=7 REQUIRE_32_BYTES value + * @property {number} REQUIRE_64_BYTES=8 REQUIRE_64_BYTES value + */ + ics23.LengthOp = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NO_PREFIX"] = 0; + values[valuesById[1] = "VAR_PROTO"] = 1; + values[valuesById[2] = "VAR_RLP"] = 2; + values[valuesById[3] = "FIXED32_BIG"] = 3; + values[valuesById[4] = "FIXED32_LITTLE"] = 4; + values[valuesById[5] = "FIXED64_BIG"] = 5; + values[valuesById[6] = "FIXED64_LITTLE"] = 6; + values[valuesById[7] = "REQUIRE_32_BYTES"] = 7; + values[valuesById[8] = "REQUIRE_64_BYTES"] = 8; + return values; + })(); + + ics23.ExistenceProof = (function() { + + /** + * Properties of an ExistenceProof. + * @memberof ics23 + * @interface IExistenceProof + * @property {Uint8Array|null} [key] ExistenceProof key + * @property {Uint8Array|null} [value] ExistenceProof value + * @property {ics23.ILeafOp|null} [leaf] ExistenceProof leaf + * @property {Array.|null} [path] ExistenceProof path + */ + + /** + * Constructs a new ExistenceProof. + * @memberof ics23 + * @classdesc ExistenceProof takes a key and a value and a set of steps to perform on it. + * The result of peforming all these steps will provide a "root hash", which can + * be compared to the value in a header. + * + * Since it is computationally infeasible to produce a hash collission for any of the used + * cryptographic hash functions, if someone can provide a series of operations to transform + * a given key and value into a root hash that matches some trusted root, these key and values + * must be in the referenced merkle tree. + * + * The only possible issue is maliablity in LeafOp, such as providing extra prefix data, + * which should be controlled by a spec. Eg. with lengthOp as NONE, + * prefix = FOO, key = BAR, value = CHOICE + * and + * prefix = F, key = OOBAR, value = CHOICE + * would produce the same value. + * + * With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field + * in the ProofSpec is valuable to prevent this mutability. And why all trees should + * length-prefix the data before hashing it. + * @implements IExistenceProof + * @constructor + * @param {ics23.IExistenceProof=} [properties] Properties to set + */ + function ExistenceProof(properties) { + this.path = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExistenceProof key. + * @member {Uint8Array} key + * @memberof ics23.ExistenceProof + * @instance + */ + ExistenceProof.prototype.key = $util.newBuffer([]); + + /** + * ExistenceProof value. + * @member {Uint8Array} value + * @memberof ics23.ExistenceProof + * @instance + */ + ExistenceProof.prototype.value = $util.newBuffer([]); + + /** + * ExistenceProof leaf. + * @member {ics23.ILeafOp|null|undefined} leaf + * @memberof ics23.ExistenceProof + * @instance + */ + ExistenceProof.prototype.leaf = null; + + /** + * ExistenceProof path. + * @member {Array.} path + * @memberof ics23.ExistenceProof + * @instance + */ + ExistenceProof.prototype.path = $util.emptyArray; + + /** + * Creates a new ExistenceProof instance using the specified properties. + * @function create + * @memberof ics23.ExistenceProof + * @static + * @param {ics23.IExistenceProof=} [properties] Properties to set + * @returns {ics23.ExistenceProof} ExistenceProof instance + */ + ExistenceProof.create = function create(properties) { + return new ExistenceProof(properties); + }; + + /** + * Encodes the specified ExistenceProof message. Does not implicitly {@link ics23.ExistenceProof.verify|verify} messages. + * @function encode + * @memberof ics23.ExistenceProof + * @static + * @param {ics23.IExistenceProof} message ExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExistenceProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && message.hasOwnProperty("key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.value != null && message.hasOwnProperty("value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + if (message.leaf != null && message.hasOwnProperty("leaf")) + $root.ics23.LeafOp.encode(message.leaf, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.path != null && message.path.length) + for (var i = 0; i < message.path.length; ++i) + $root.ics23.InnerOp.encode(message.path[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExistenceProof message, length delimited. Does not implicitly {@link ics23.ExistenceProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.ExistenceProof + * @static + * @param {ics23.IExistenceProof} message ExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExistenceProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExistenceProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.ExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.ExistenceProof} ExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExistenceProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.ExistenceProof(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.leaf = $root.ics23.LeafOp.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.path && message.path.length)) + message.path = []; + message.path.push($root.ics23.InnerOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExistenceProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.ExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.ExistenceProof} ExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExistenceProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExistenceProof message. + * @function verify + * @memberof ics23.ExistenceProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExistenceProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + if (message.leaf != null && message.hasOwnProperty("leaf")) { + var error = $root.ics23.LeafOp.verify(message.leaf); + if (error) + return "leaf." + error; + } + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) { + var error = $root.ics23.InnerOp.verify(message.path[i]); + if (error) + return "path." + error; + } + } + return null; + }; + + /** + * Creates an ExistenceProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.ExistenceProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.ExistenceProof} ExistenceProof + */ + ExistenceProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.ExistenceProof) + return object; + var message = new $root.ics23.ExistenceProof(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + if (object.leaf != null) { + if (typeof object.leaf !== "object") + throw TypeError(".ics23.ExistenceProof.leaf: object expected"); + message.leaf = $root.ics23.LeafOp.fromObject(object.leaf); + } + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".ics23.ExistenceProof.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) { + if (typeof object.path[i] !== "object") + throw TypeError(".ics23.ExistenceProof.path: object expected"); + message.path[i] = $root.ics23.InnerOp.fromObject(object.path[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ExistenceProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.ExistenceProof + * @static + * @param {ics23.ExistenceProof} message ExistenceProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExistenceProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + object.leaf = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + if (message.leaf != null && message.hasOwnProperty("leaf")) + object.leaf = $root.ics23.LeafOp.toObject(message.leaf, options); + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = $root.ics23.InnerOp.toObject(message.path[j], options); + } + return object; + }; + + /** + * Converts this ExistenceProof to JSON. + * @function toJSON + * @memberof ics23.ExistenceProof + * @instance + * @returns {Object.} JSON object + */ + ExistenceProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExistenceProof; + })(); + + ics23.NonExistenceProof = (function() { + + /** + * Properties of a NonExistenceProof. + * @memberof ics23 + * @interface INonExistenceProof + * @property {Uint8Array|null} [key] NonExistenceProof key + * @property {ics23.IExistenceProof|null} [left] NonExistenceProof left + * @property {ics23.IExistenceProof|null} [right] NonExistenceProof right + */ + + /** + * Constructs a new NonExistenceProof. + * @memberof ics23 + * @classdesc Represents a NonExistenceProof. + * @implements INonExistenceProof + * @constructor + * @param {ics23.INonExistenceProof=} [properties] Properties to set + */ + function NonExistenceProof(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NonExistenceProof key. + * @member {Uint8Array} key + * @memberof ics23.NonExistenceProof + * @instance + */ + NonExistenceProof.prototype.key = $util.newBuffer([]); + + /** + * NonExistenceProof left. + * @member {ics23.IExistenceProof|null|undefined} left + * @memberof ics23.NonExistenceProof + * @instance + */ + NonExistenceProof.prototype.left = null; + + /** + * NonExistenceProof right. + * @member {ics23.IExistenceProof|null|undefined} right + * @memberof ics23.NonExistenceProof + * @instance + */ + NonExistenceProof.prototype.right = null; + + /** + * Creates a new NonExistenceProof instance using the specified properties. + * @function create + * @memberof ics23.NonExistenceProof + * @static + * @param {ics23.INonExistenceProof=} [properties] Properties to set + * @returns {ics23.NonExistenceProof} NonExistenceProof instance + */ + NonExistenceProof.create = function create(properties) { + return new NonExistenceProof(properties); + }; + + /** + * Encodes the specified NonExistenceProof message. Does not implicitly {@link ics23.NonExistenceProof.verify|verify} messages. + * @function encode + * @memberof ics23.NonExistenceProof + * @static + * @param {ics23.INonExistenceProof} message NonExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NonExistenceProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && message.hasOwnProperty("key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.left != null && message.hasOwnProperty("left")) + $root.ics23.ExistenceProof.encode(message.left, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.right != null && message.hasOwnProperty("right")) + $root.ics23.ExistenceProof.encode(message.right, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified NonExistenceProof message, length delimited. Does not implicitly {@link ics23.NonExistenceProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.NonExistenceProof + * @static + * @param {ics23.INonExistenceProof} message NonExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NonExistenceProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NonExistenceProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.NonExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.NonExistenceProof} NonExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NonExistenceProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.NonExistenceProof(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.left = $root.ics23.ExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.right = $root.ics23.ExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NonExistenceProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.NonExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.NonExistenceProof} NonExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NonExistenceProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NonExistenceProof message. + * @function verify + * @memberof ics23.NonExistenceProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NonExistenceProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.left != null && message.hasOwnProperty("left")) { + var error = $root.ics23.ExistenceProof.verify(message.left); + if (error) + return "left." + error; + } + if (message.right != null && message.hasOwnProperty("right")) { + var error = $root.ics23.ExistenceProof.verify(message.right); + if (error) + return "right." + error; + } + return null; + }; + + /** + * Creates a NonExistenceProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.NonExistenceProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.NonExistenceProof} NonExistenceProof + */ + NonExistenceProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.NonExistenceProof) + return object; + var message = new $root.ics23.NonExistenceProof(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.left != null) { + if (typeof object.left !== "object") + throw TypeError(".ics23.NonExistenceProof.left: object expected"); + message.left = $root.ics23.ExistenceProof.fromObject(object.left); + } + if (object.right != null) { + if (typeof object.right !== "object") + throw TypeError(".ics23.NonExistenceProof.right: object expected"); + message.right = $root.ics23.ExistenceProof.fromObject(object.right); + } + return message; + }; + + /** + * Creates a plain object from a NonExistenceProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.NonExistenceProof + * @static + * @param {ics23.NonExistenceProof} message NonExistenceProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NonExistenceProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + object.left = null; + object.right = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.left != null && message.hasOwnProperty("left")) + object.left = $root.ics23.ExistenceProof.toObject(message.left, options); + if (message.right != null && message.hasOwnProperty("right")) + object.right = $root.ics23.ExistenceProof.toObject(message.right, options); + return object; + }; + + /** + * Converts this NonExistenceProof to JSON. + * @function toJSON + * @memberof ics23.NonExistenceProof + * @instance + * @returns {Object.} JSON object + */ + NonExistenceProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NonExistenceProof; + })(); + + ics23.CommitmentProof = (function() { + + /** + * Properties of a CommitmentProof. + * @memberof ics23 + * @interface ICommitmentProof + * @property {ics23.IExistenceProof|null} [exist] CommitmentProof exist + * @property {ics23.INonExistenceProof|null} [nonexist] CommitmentProof nonexist + * @property {ics23.IBatchProof|null} [batch] CommitmentProof batch + * @property {ics23.ICompressedBatchProof|null} [compressed] CommitmentProof compressed + */ + + /** + * Constructs a new CommitmentProof. + * @memberof ics23 + * @classdesc Represents a CommitmentProof. + * @implements ICommitmentProof + * @constructor + * @param {ics23.ICommitmentProof=} [properties] Properties to set + */ + function CommitmentProof(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommitmentProof exist. + * @member {ics23.IExistenceProof|null|undefined} exist + * @memberof ics23.CommitmentProof + * @instance + */ + CommitmentProof.prototype.exist = null; + + /** + * CommitmentProof nonexist. + * @member {ics23.INonExistenceProof|null|undefined} nonexist + * @memberof ics23.CommitmentProof + * @instance + */ + CommitmentProof.prototype.nonexist = null; + + /** + * CommitmentProof batch. + * @member {ics23.IBatchProof|null|undefined} batch + * @memberof ics23.CommitmentProof + * @instance + */ + CommitmentProof.prototype.batch = null; + + /** + * CommitmentProof compressed. + * @member {ics23.ICompressedBatchProof|null|undefined} compressed + * @memberof ics23.CommitmentProof + * @instance + */ + CommitmentProof.prototype.compressed = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CommitmentProof proof. + * @member {"exist"|"nonexist"|"batch"|"compressed"|undefined} proof + * @memberof ics23.CommitmentProof + * @instance + */ + Object.defineProperty(CommitmentProof.prototype, "proof", { + get: $util.oneOfGetter($oneOfFields = ["exist", "nonexist", "batch", "compressed"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CommitmentProof instance using the specified properties. + * @function create + * @memberof ics23.CommitmentProof + * @static + * @param {ics23.ICommitmentProof=} [properties] Properties to set + * @returns {ics23.CommitmentProof} CommitmentProof instance + */ + CommitmentProof.create = function create(properties) { + return new CommitmentProof(properties); + }; + + /** + * Encodes the specified CommitmentProof message. Does not implicitly {@link ics23.CommitmentProof.verify|verify} messages. + * @function encode + * @memberof ics23.CommitmentProof + * @static + * @param {ics23.ICommitmentProof} message CommitmentProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitmentProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.exist != null && message.hasOwnProperty("exist")) + $root.ics23.ExistenceProof.encode(message.exist, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nonexist != null && message.hasOwnProperty("nonexist")) + $root.ics23.NonExistenceProof.encode(message.nonexist, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.batch != null && message.hasOwnProperty("batch")) + $root.ics23.BatchProof.encode(message.batch, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.compressed != null && message.hasOwnProperty("compressed")) + $root.ics23.CompressedBatchProof.encode(message.compressed, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CommitmentProof message, length delimited. Does not implicitly {@link ics23.CommitmentProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.CommitmentProof + * @static + * @param {ics23.ICommitmentProof} message CommitmentProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitmentProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommitmentProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.CommitmentProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.CommitmentProof} CommitmentProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitmentProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CommitmentProof(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = $root.ics23.ExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = $root.ics23.NonExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.batch = $root.ics23.BatchProof.decode(reader, reader.uint32()); + break; + case 4: + message.compressed = $root.ics23.CompressedBatchProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommitmentProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.CommitmentProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.CommitmentProof} CommitmentProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitmentProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommitmentProof message. + * @function verify + * @memberof ics23.CommitmentProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommitmentProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.exist != null && message.hasOwnProperty("exist")) { + properties.proof = 1; + { + var error = $root.ics23.ExistenceProof.verify(message.exist); + if (error) + return "exist." + error; + } + } + if (message.nonexist != null && message.hasOwnProperty("nonexist")) { + if (properties.proof === 1) + return "proof: multiple values"; + properties.proof = 1; + { + var error = $root.ics23.NonExistenceProof.verify(message.nonexist); + if (error) + return "nonexist." + error; + } + } + if (message.batch != null && message.hasOwnProperty("batch")) { + if (properties.proof === 1) + return "proof: multiple values"; + properties.proof = 1; + { + var error = $root.ics23.BatchProof.verify(message.batch); + if (error) + return "batch." + error; + } + } + if (message.compressed != null && message.hasOwnProperty("compressed")) { + if (properties.proof === 1) + return "proof: multiple values"; + properties.proof = 1; + { + var error = $root.ics23.CompressedBatchProof.verify(message.compressed); + if (error) + return "compressed." + error; + } + } + return null; + }; + + /** + * Creates a CommitmentProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.CommitmentProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.CommitmentProof} CommitmentProof + */ + CommitmentProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.CommitmentProof) + return object; + var message = new $root.ics23.CommitmentProof(); + if (object.exist != null) { + if (typeof object.exist !== "object") + throw TypeError(".ics23.CommitmentProof.exist: object expected"); + message.exist = $root.ics23.ExistenceProof.fromObject(object.exist); + } + if (object.nonexist != null) { + if (typeof object.nonexist !== "object") + throw TypeError(".ics23.CommitmentProof.nonexist: object expected"); + message.nonexist = $root.ics23.NonExistenceProof.fromObject(object.nonexist); + } + if (object.batch != null) { + if (typeof object.batch !== "object") + throw TypeError(".ics23.CommitmentProof.batch: object expected"); + message.batch = $root.ics23.BatchProof.fromObject(object.batch); + } + if (object.compressed != null) { + if (typeof object.compressed !== "object") + throw TypeError(".ics23.CommitmentProof.compressed: object expected"); + message.compressed = $root.ics23.CompressedBatchProof.fromObject(object.compressed); + } + return message; + }; + + /** + * Creates a plain object from a CommitmentProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.CommitmentProof + * @static + * @param {ics23.CommitmentProof} message CommitmentProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommitmentProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.exist != null && message.hasOwnProperty("exist")) { + object.exist = $root.ics23.ExistenceProof.toObject(message.exist, options); + if (options.oneofs) + object.proof = "exist"; + } + if (message.nonexist != null && message.hasOwnProperty("nonexist")) { + object.nonexist = $root.ics23.NonExistenceProof.toObject(message.nonexist, options); + if (options.oneofs) + object.proof = "nonexist"; + } + if (message.batch != null && message.hasOwnProperty("batch")) { + object.batch = $root.ics23.BatchProof.toObject(message.batch, options); + if (options.oneofs) + object.proof = "batch"; + } + if (message.compressed != null && message.hasOwnProperty("compressed")) { + object.compressed = $root.ics23.CompressedBatchProof.toObject(message.compressed, options); + if (options.oneofs) + object.proof = "compressed"; + } + return object; + }; + + /** + * Converts this CommitmentProof to JSON. + * @function toJSON + * @memberof ics23.CommitmentProof + * @instance + * @returns {Object.} JSON object + */ + CommitmentProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CommitmentProof; + })(); + + ics23.LeafOp = (function() { + + /** + * Properties of a LeafOp. + * @memberof ics23 + * @interface ILeafOp + * @property {ics23.HashOp|null} [hash] LeafOp hash + * @property {ics23.HashOp|null} [prehashKey] LeafOp prehashKey + * @property {ics23.HashOp|null} [prehashValue] LeafOp prehashValue + * @property {ics23.LengthOp|null} [length] LeafOp length + * @property {Uint8Array|null} [prefix] LeafOp prefix + */ + + /** + * Constructs a new LeafOp. + * @memberof ics23 + * @classdesc LeafOp represents the raw key-value data we wish to prove, and + * must be flexible to represent the internal transformation from + * the original key-value pairs into the basis hash, for many existing + * merkle trees. + * + * key and value are passed in. So that the signature of this operation is: + * leafOp(key, value) -> output + * + * To process this, first prehash the keys and values if needed (ANY means no hash in this case): + * hkey = prehashKey(key) + * hvalue = prehashValue(value) + * + * Then combine the bytes, and hash it + * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) + * @implements ILeafOp + * @constructor + * @param {ics23.ILeafOp=} [properties] Properties to set + */ + function LeafOp(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LeafOp hash. + * @member {ics23.HashOp} hash + * @memberof ics23.LeafOp + * @instance + */ + LeafOp.prototype.hash = 0; + + /** + * LeafOp prehashKey. + * @member {ics23.HashOp} prehashKey + * @memberof ics23.LeafOp + * @instance + */ + LeafOp.prototype.prehashKey = 0; + + /** + * LeafOp prehashValue. + * @member {ics23.HashOp} prehashValue + * @memberof ics23.LeafOp + * @instance + */ + LeafOp.prototype.prehashValue = 0; + + /** + * LeafOp length. + * @member {ics23.LengthOp} length + * @memberof ics23.LeafOp + * @instance + */ + LeafOp.prototype.length = 0; + + /** + * LeafOp prefix. + * @member {Uint8Array} prefix + * @memberof ics23.LeafOp + * @instance + */ + LeafOp.prototype.prefix = $util.newBuffer([]); + + /** + * Creates a new LeafOp instance using the specified properties. + * @function create + * @memberof ics23.LeafOp + * @static + * @param {ics23.ILeafOp=} [properties] Properties to set + * @returns {ics23.LeafOp} LeafOp instance + */ + LeafOp.create = function create(properties) { + return new LeafOp(properties); + }; + + /** + * Encodes the specified LeafOp message. Does not implicitly {@link ics23.LeafOp.verify|verify} messages. + * @function encode + * @memberof ics23.LeafOp + * @static + * @param {ics23.ILeafOp} message LeafOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LeafOp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hash != null && message.hasOwnProperty("hash")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.hash); + if (message.prehashKey != null && message.hasOwnProperty("prehashKey")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.prehashKey); + if (message.prehashValue != null && message.hasOwnProperty("prehashValue")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.prehashValue); + if (message.length != null && message.hasOwnProperty("length")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.length); + if (message.prefix != null && message.hasOwnProperty("prefix")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.prefix); + return writer; + }; + + /** + * Encodes the specified LeafOp message, length delimited. Does not implicitly {@link ics23.LeafOp.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.LeafOp + * @static + * @param {ics23.ILeafOp} message LeafOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LeafOp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LeafOp message from the specified reader or buffer. + * @function decode + * @memberof ics23.LeafOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.LeafOp} LeafOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LeafOp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.LeafOp(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.int32(); + break; + case 2: + message.prehashKey = reader.int32(); + break; + case 3: + message.prehashValue = reader.int32(); + break; + case 4: + message.length = reader.int32(); + break; + case 5: + message.prefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LeafOp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.LeafOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.LeafOp} LeafOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LeafOp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LeafOp message. + * @function verify + * @memberof ics23.LeafOp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LeafOp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + switch (message.hash) { + default: + return "hash: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.prehashKey != null && message.hasOwnProperty("prehashKey")) + switch (message.prehashKey) { + default: + return "prehashKey: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.prehashValue != null && message.hasOwnProperty("prehashValue")) + switch (message.prehashValue) { + default: + return "prehashValue: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.length != null && message.hasOwnProperty("length")) + switch (message.length) { + default: + return "length: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + break; + } + if (message.prefix != null && message.hasOwnProperty("prefix")) + if (!(message.prefix && typeof message.prefix.length === "number" || $util.isString(message.prefix))) + return "prefix: buffer expected"; + return null; + }; + + /** + * Creates a LeafOp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.LeafOp + * @static + * @param {Object.} object Plain object + * @returns {ics23.LeafOp} LeafOp + */ + LeafOp.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.LeafOp) + return object; + var message = new $root.ics23.LeafOp(); + switch (object.hash) { + case "NO_HASH": + case 0: + message.hash = 0; + break; + case "SHA256": + case 1: + message.hash = 1; + break; + case "SHA512": + case 2: + message.hash = 2; + break; + case "KECCAK": + case 3: + message.hash = 3; + break; + case "RIPEMD160": + case 4: + message.hash = 4; + break; + case "BITCOIN": + case 5: + message.hash = 5; + break; + case "SHA512_256": + case 6: + message.hash = 6; + break; + } + switch (object.prehashKey) { + case "NO_HASH": + case 0: + message.prehashKey = 0; + break; + case "SHA256": + case 1: + message.prehashKey = 1; + break; + case "SHA512": + case 2: + message.prehashKey = 2; + break; + case "KECCAK": + case 3: + message.prehashKey = 3; + break; + case "RIPEMD160": + case 4: + message.prehashKey = 4; + break; + case "BITCOIN": + case 5: + message.prehashKey = 5; + break; + case "SHA512_256": + case 6: + message.prehashKey = 6; + break; + } + switch (object.prehashValue) { + case "NO_HASH": + case 0: + message.prehashValue = 0; + break; + case "SHA256": + case 1: + message.prehashValue = 1; + break; + case "SHA512": + case 2: + message.prehashValue = 2; + break; + case "KECCAK": + case 3: + message.prehashValue = 3; + break; + case "RIPEMD160": + case 4: + message.prehashValue = 4; + break; + case "BITCOIN": + case 5: + message.prehashValue = 5; + break; + case "SHA512_256": + case 6: + message.prehashValue = 6; + break; + } + switch (object.length) { + case "NO_PREFIX": + case 0: + message.length = 0; + break; + case "VAR_PROTO": + case 1: + message.length = 1; + break; + case "VAR_RLP": + case 2: + message.length = 2; + break; + case "FIXED32_BIG": + case 3: + message.length = 3; + break; + case "FIXED32_LITTLE": + case 4: + message.length = 4; + break; + case "FIXED64_BIG": + case 5: + message.length = 5; + break; + case "FIXED64_LITTLE": + case 6: + message.length = 6; + break; + case "REQUIRE_32_BYTES": + case 7: + message.length = 7; + break; + case "REQUIRE_64_BYTES": + case 8: + message.length = 8; + break; + } + if (object.prefix != null) + if (typeof object.prefix === "string") + $util.base64.decode(object.prefix, message.prefix = $util.newBuffer($util.base64.length(object.prefix)), 0); + else if (object.prefix.length) + message.prefix = object.prefix; + return message; + }; + + /** + * Creates a plain object from a LeafOp message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.LeafOp + * @static + * @param {ics23.LeafOp} message LeafOp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LeafOp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.hash = options.enums === String ? "NO_HASH" : 0; + object.prehashKey = options.enums === String ? "NO_HASH" : 0; + object.prehashValue = options.enums === String ? "NO_HASH" : 0; + object.length = options.enums === String ? "NO_PREFIX" : 0; + if (options.bytes === String) + object.prefix = ""; + else { + object.prefix = []; + if (options.bytes !== Array) + object.prefix = $util.newBuffer(object.prefix); + } + } + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.enums === String ? $root.ics23.HashOp[message.hash] : message.hash; + if (message.prehashKey != null && message.hasOwnProperty("prehashKey")) + object.prehashKey = options.enums === String ? $root.ics23.HashOp[message.prehashKey] : message.prehashKey; + if (message.prehashValue != null && message.hasOwnProperty("prehashValue")) + object.prehashValue = options.enums === String ? $root.ics23.HashOp[message.prehashValue] : message.prehashValue; + if (message.length != null && message.hasOwnProperty("length")) + object.length = options.enums === String ? $root.ics23.LengthOp[message.length] : message.length; + if (message.prefix != null && message.hasOwnProperty("prefix")) + object.prefix = options.bytes === String ? $util.base64.encode(message.prefix, 0, message.prefix.length) : options.bytes === Array ? Array.prototype.slice.call(message.prefix) : message.prefix; + return object; + }; + + /** + * Converts this LeafOp to JSON. + * @function toJSON + * @memberof ics23.LeafOp + * @instance + * @returns {Object.} JSON object + */ + LeafOp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LeafOp; + })(); + + ics23.InnerOp = (function() { + + /** + * Properties of an InnerOp. + * @memberof ics23 + * @interface IInnerOp + * @property {ics23.HashOp|null} [hash] InnerOp hash + * @property {Uint8Array|null} [prefix] InnerOp prefix + * @property {Uint8Array|null} [suffix] InnerOp suffix + */ + + /** + * Constructs a new InnerOp. + * @memberof ics23 + * @classdesc InnerOp represents a merkle-proof step that is not a leaf. + * It represents concatenating two children and hashing them to provide the next result. + * + * The result of the previous step is passed in, so the signature of this op is: + * innerOp(child) -> output + * + * The result of applying InnerOp should be: + * output = op.hash(op.prefix || child || op.suffix) + * + * where the || operator is concatenation of binary data, + * and child is the result of hashing all the tree below this step. + * + * Any special data, like prepending child with the length, or prepending the entire operation with + * some value to differentiate from leaf nodes, should be included in prefix and suffix. + * If either of prefix or suffix is empty, we just treat it as an empty string + * @implements IInnerOp + * @constructor + * @param {ics23.IInnerOp=} [properties] Properties to set + */ + function InnerOp(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InnerOp hash. + * @member {ics23.HashOp} hash + * @memberof ics23.InnerOp + * @instance + */ + InnerOp.prototype.hash = 0; + + /** + * InnerOp prefix. + * @member {Uint8Array} prefix + * @memberof ics23.InnerOp + * @instance + */ + InnerOp.prototype.prefix = $util.newBuffer([]); + + /** + * InnerOp suffix. + * @member {Uint8Array} suffix + * @memberof ics23.InnerOp + * @instance + */ + InnerOp.prototype.suffix = $util.newBuffer([]); + + /** + * Creates a new InnerOp instance using the specified properties. + * @function create + * @memberof ics23.InnerOp + * @static + * @param {ics23.IInnerOp=} [properties] Properties to set + * @returns {ics23.InnerOp} InnerOp instance + */ + InnerOp.create = function create(properties) { + return new InnerOp(properties); + }; + + /** + * Encodes the specified InnerOp message. Does not implicitly {@link ics23.InnerOp.verify|verify} messages. + * @function encode + * @memberof ics23.InnerOp + * @static + * @param {ics23.IInnerOp} message InnerOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InnerOp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hash != null && message.hasOwnProperty("hash")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.hash); + if (message.prefix != null && message.hasOwnProperty("prefix")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.prefix); + if (message.suffix != null && message.hasOwnProperty("suffix")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.suffix); + return writer; + }; + + /** + * Encodes the specified InnerOp message, length delimited. Does not implicitly {@link ics23.InnerOp.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.InnerOp + * @static + * @param {ics23.IInnerOp} message InnerOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InnerOp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InnerOp message from the specified reader or buffer. + * @function decode + * @memberof ics23.InnerOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.InnerOp} InnerOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InnerOp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.InnerOp(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.int32(); + break; + case 2: + message.prefix = reader.bytes(); + break; + case 3: + message.suffix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InnerOp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.InnerOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.InnerOp} InnerOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InnerOp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InnerOp message. + * @function verify + * @memberof ics23.InnerOp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InnerOp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + switch (message.hash) { + default: + return "hash: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.prefix != null && message.hasOwnProperty("prefix")) + if (!(message.prefix && typeof message.prefix.length === "number" || $util.isString(message.prefix))) + return "prefix: buffer expected"; + if (message.suffix != null && message.hasOwnProperty("suffix")) + if (!(message.suffix && typeof message.suffix.length === "number" || $util.isString(message.suffix))) + return "suffix: buffer expected"; + return null; + }; + + /** + * Creates an InnerOp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.InnerOp + * @static + * @param {Object.} object Plain object + * @returns {ics23.InnerOp} InnerOp + */ + InnerOp.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.InnerOp) + return object; + var message = new $root.ics23.InnerOp(); + switch (object.hash) { + case "NO_HASH": + case 0: + message.hash = 0; + break; + case "SHA256": + case 1: + message.hash = 1; + break; + case "SHA512": + case 2: + message.hash = 2; + break; + case "KECCAK": + case 3: + message.hash = 3; + break; + case "RIPEMD160": + case 4: + message.hash = 4; + break; + case "BITCOIN": + case 5: + message.hash = 5; + break; + case "SHA512_256": + case 6: + message.hash = 6; + break; + } + if (object.prefix != null) + if (typeof object.prefix === "string") + $util.base64.decode(object.prefix, message.prefix = $util.newBuffer($util.base64.length(object.prefix)), 0); + else if (object.prefix.length) + message.prefix = object.prefix; + if (object.suffix != null) + if (typeof object.suffix === "string") + $util.base64.decode(object.suffix, message.suffix = $util.newBuffer($util.base64.length(object.suffix)), 0); + else if (object.suffix.length) + message.suffix = object.suffix; + return message; + }; + + /** + * Creates a plain object from an InnerOp message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.InnerOp + * @static + * @param {ics23.InnerOp} message InnerOp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InnerOp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.hash = options.enums === String ? "NO_HASH" : 0; + if (options.bytes === String) + object.prefix = ""; + else { + object.prefix = []; + if (options.bytes !== Array) + object.prefix = $util.newBuffer(object.prefix); + } + if (options.bytes === String) + object.suffix = ""; + else { + object.suffix = []; + if (options.bytes !== Array) + object.suffix = $util.newBuffer(object.suffix); + } + } + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.enums === String ? $root.ics23.HashOp[message.hash] : message.hash; + if (message.prefix != null && message.hasOwnProperty("prefix")) + object.prefix = options.bytes === String ? $util.base64.encode(message.prefix, 0, message.prefix.length) : options.bytes === Array ? Array.prototype.slice.call(message.prefix) : message.prefix; + if (message.suffix != null && message.hasOwnProperty("suffix")) + object.suffix = options.bytes === String ? $util.base64.encode(message.suffix, 0, message.suffix.length) : options.bytes === Array ? Array.prototype.slice.call(message.suffix) : message.suffix; + return object; + }; + + /** + * Converts this InnerOp to JSON. + * @function toJSON + * @memberof ics23.InnerOp + * @instance + * @returns {Object.} JSON object + */ + InnerOp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return InnerOp; + })(); + + ics23.ProofSpec = (function() { + + /** + * Properties of a ProofSpec. + * @memberof ics23 + * @interface IProofSpec + * @property {ics23.ILeafOp|null} [leafSpec] ProofSpec leafSpec + * @property {ics23.IInnerSpec|null} [innerSpec] ProofSpec innerSpec + * @property {number|null} [maxDepth] ProofSpec maxDepth + * @property {number|null} [minDepth] ProofSpec minDepth + */ + + /** + * Constructs a new ProofSpec. + * @memberof ics23 + * @classdesc ProofSpec defines what the expected parameters are for a given proof type. + * This can be stored in the client and used to validate any incoming proofs. + * + * verify(ProofSpec, Proof) -> Proof | Error + * + * As demonstrated in tests, if we don't fix the algorithm used to calculate the + * LeafHash for a given tree, there are many possible key-value pairs that can + * generate a given hash (by interpretting the preimage differently). + * We need this for proper security, requires client knows a priori what + * tree format server uses. But not in code, rather a configuration object. + * @implements IProofSpec + * @constructor + * @param {ics23.IProofSpec=} [properties] Properties to set + */ + function ProofSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProofSpec leafSpec. + * @member {ics23.ILeafOp|null|undefined} leafSpec + * @memberof ics23.ProofSpec + * @instance + */ + ProofSpec.prototype.leafSpec = null; + + /** + * ProofSpec innerSpec. + * @member {ics23.IInnerSpec|null|undefined} innerSpec + * @memberof ics23.ProofSpec + * @instance + */ + ProofSpec.prototype.innerSpec = null; + + /** + * ProofSpec maxDepth. + * @member {number} maxDepth + * @memberof ics23.ProofSpec + * @instance + */ + ProofSpec.prototype.maxDepth = 0; + + /** + * ProofSpec minDepth. + * @member {number} minDepth + * @memberof ics23.ProofSpec + * @instance + */ + ProofSpec.prototype.minDepth = 0; + + /** + * Creates a new ProofSpec instance using the specified properties. + * @function create + * @memberof ics23.ProofSpec + * @static + * @param {ics23.IProofSpec=} [properties] Properties to set + * @returns {ics23.ProofSpec} ProofSpec instance + */ + ProofSpec.create = function create(properties) { + return new ProofSpec(properties); + }; + + /** + * Encodes the specified ProofSpec message. Does not implicitly {@link ics23.ProofSpec.verify|verify} messages. + * @function encode + * @memberof ics23.ProofSpec + * @static + * @param {ics23.IProofSpec} message ProofSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProofSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.leafSpec != null && message.hasOwnProperty("leafSpec")) + $root.ics23.LeafOp.encode(message.leafSpec, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.innerSpec != null && message.hasOwnProperty("innerSpec")) + $root.ics23.InnerSpec.encode(message.innerSpec, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.maxDepth != null && message.hasOwnProperty("maxDepth")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxDepth); + if (message.minDepth != null && message.hasOwnProperty("minDepth")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.minDepth); + return writer; + }; + + /** + * Encodes the specified ProofSpec message, length delimited. Does not implicitly {@link ics23.ProofSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.ProofSpec + * @static + * @param {ics23.IProofSpec} message ProofSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProofSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProofSpec message from the specified reader or buffer. + * @function decode + * @memberof ics23.ProofSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.ProofSpec} ProofSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProofSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.ProofSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.leafSpec = $root.ics23.LeafOp.decode(reader, reader.uint32()); + break; + case 2: + message.innerSpec = $root.ics23.InnerSpec.decode(reader, reader.uint32()); + break; + case 3: + message.maxDepth = reader.int32(); + break; + case 4: + message.minDepth = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProofSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.ProofSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.ProofSpec} ProofSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProofSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProofSpec message. + * @function verify + * @memberof ics23.ProofSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProofSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.leafSpec != null && message.hasOwnProperty("leafSpec")) { + var error = $root.ics23.LeafOp.verify(message.leafSpec); + if (error) + return "leafSpec." + error; + } + if (message.innerSpec != null && message.hasOwnProperty("innerSpec")) { + var error = $root.ics23.InnerSpec.verify(message.innerSpec); + if (error) + return "innerSpec." + error; + } + if (message.maxDepth != null && message.hasOwnProperty("maxDepth")) + if (!$util.isInteger(message.maxDepth)) + return "maxDepth: integer expected"; + if (message.minDepth != null && message.hasOwnProperty("minDepth")) + if (!$util.isInteger(message.minDepth)) + return "minDepth: integer expected"; + return null; + }; + + /** + * Creates a ProofSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.ProofSpec + * @static + * @param {Object.} object Plain object + * @returns {ics23.ProofSpec} ProofSpec + */ + ProofSpec.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.ProofSpec) + return object; + var message = new $root.ics23.ProofSpec(); + if (object.leafSpec != null) { + if (typeof object.leafSpec !== "object") + throw TypeError(".ics23.ProofSpec.leafSpec: object expected"); + message.leafSpec = $root.ics23.LeafOp.fromObject(object.leafSpec); + } + if (object.innerSpec != null) { + if (typeof object.innerSpec !== "object") + throw TypeError(".ics23.ProofSpec.innerSpec: object expected"); + message.innerSpec = $root.ics23.InnerSpec.fromObject(object.innerSpec); + } + if (object.maxDepth != null) + message.maxDepth = object.maxDepth | 0; + if (object.minDepth != null) + message.minDepth = object.minDepth | 0; + return message; + }; + + /** + * Creates a plain object from a ProofSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.ProofSpec + * @static + * @param {ics23.ProofSpec} message ProofSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProofSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.leafSpec = null; + object.innerSpec = null; + object.maxDepth = 0; + object.minDepth = 0; + } + if (message.leafSpec != null && message.hasOwnProperty("leafSpec")) + object.leafSpec = $root.ics23.LeafOp.toObject(message.leafSpec, options); + if (message.innerSpec != null && message.hasOwnProperty("innerSpec")) + object.innerSpec = $root.ics23.InnerSpec.toObject(message.innerSpec, options); + if (message.maxDepth != null && message.hasOwnProperty("maxDepth")) + object.maxDepth = message.maxDepth; + if (message.minDepth != null && message.hasOwnProperty("minDepth")) + object.minDepth = message.minDepth; + return object; + }; + + /** + * Converts this ProofSpec to JSON. + * @function toJSON + * @memberof ics23.ProofSpec + * @instance + * @returns {Object.} JSON object + */ + ProofSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProofSpec; + })(); + + ics23.InnerSpec = (function() { + + /** + * Properties of an InnerSpec. + * @memberof ics23 + * @interface IInnerSpec + * @property {Array.|null} [childOrder] InnerSpec childOrder + * @property {number|null} [childSize] InnerSpec childSize + * @property {number|null} [minPrefixLength] InnerSpec minPrefixLength + * @property {number|null} [maxPrefixLength] InnerSpec maxPrefixLength + * @property {Uint8Array|null} [emptyChild] InnerSpec emptyChild + * @property {ics23.HashOp|null} [hash] InnerSpec hash + */ + + /** + * Constructs a new InnerSpec. + * @memberof ics23 + * @classdesc Represents an InnerSpec. + * @implements IInnerSpec + * @constructor + * @param {ics23.IInnerSpec=} [properties] Properties to set + */ + function InnerSpec(properties) { + this.childOrder = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InnerSpec childOrder. + * @member {Array.} childOrder + * @memberof ics23.InnerSpec + * @instance + */ + InnerSpec.prototype.childOrder = $util.emptyArray; + + /** + * InnerSpec childSize. + * @member {number} childSize + * @memberof ics23.InnerSpec + * @instance + */ + InnerSpec.prototype.childSize = 0; + + /** + * InnerSpec minPrefixLength. + * @member {number} minPrefixLength + * @memberof ics23.InnerSpec + * @instance + */ + InnerSpec.prototype.minPrefixLength = 0; + + /** + * InnerSpec maxPrefixLength. + * @member {number} maxPrefixLength + * @memberof ics23.InnerSpec + * @instance + */ + InnerSpec.prototype.maxPrefixLength = 0; + + /** + * InnerSpec emptyChild. + * @member {Uint8Array} emptyChild + * @memberof ics23.InnerSpec + * @instance + */ + InnerSpec.prototype.emptyChild = $util.newBuffer([]); + + /** + * InnerSpec hash. + * @member {ics23.HashOp} hash + * @memberof ics23.InnerSpec + * @instance + */ + InnerSpec.prototype.hash = 0; + + /** + * Creates a new InnerSpec instance using the specified properties. + * @function create + * @memberof ics23.InnerSpec + * @static + * @param {ics23.IInnerSpec=} [properties] Properties to set + * @returns {ics23.InnerSpec} InnerSpec instance + */ + InnerSpec.create = function create(properties) { + return new InnerSpec(properties); + }; + + /** + * Encodes the specified InnerSpec message. Does not implicitly {@link ics23.InnerSpec.verify|verify} messages. + * @function encode + * @memberof ics23.InnerSpec + * @static + * @param {ics23.IInnerSpec} message InnerSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InnerSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.childOrder != null && message.childOrder.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.childOrder.length; ++i) + writer.int32(message.childOrder[i]); + writer.ldelim(); + } + if (message.childSize != null && message.hasOwnProperty("childSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.childSize); + if (message.minPrefixLength != null && message.hasOwnProperty("minPrefixLength")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.minPrefixLength); + if (message.maxPrefixLength != null && message.hasOwnProperty("maxPrefixLength")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.maxPrefixLength); + if (message.emptyChild != null && message.hasOwnProperty("emptyChild")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.emptyChild); + if (message.hash != null && message.hasOwnProperty("hash")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.hash); + return writer; + }; + + /** + * Encodes the specified InnerSpec message, length delimited. Does not implicitly {@link ics23.InnerSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.InnerSpec + * @static + * @param {ics23.IInnerSpec} message InnerSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InnerSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InnerSpec message from the specified reader or buffer. + * @function decode + * @memberof ics23.InnerSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.InnerSpec} InnerSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InnerSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.InnerSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.childOrder && message.childOrder.length)) + message.childOrder = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.childOrder.push(reader.int32()); + } else + message.childOrder.push(reader.int32()); + break; + case 2: + message.childSize = reader.int32(); + break; + case 3: + message.minPrefixLength = reader.int32(); + break; + case 4: + message.maxPrefixLength = reader.int32(); + break; + case 5: + message.emptyChild = reader.bytes(); + break; + case 6: + message.hash = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InnerSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.InnerSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.InnerSpec} InnerSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InnerSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InnerSpec message. + * @function verify + * @memberof ics23.InnerSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InnerSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.childOrder != null && message.hasOwnProperty("childOrder")) { + if (!Array.isArray(message.childOrder)) + return "childOrder: array expected"; + for (var i = 0; i < message.childOrder.length; ++i) + if (!$util.isInteger(message.childOrder[i])) + return "childOrder: integer[] expected"; + } + if (message.childSize != null && message.hasOwnProperty("childSize")) + if (!$util.isInteger(message.childSize)) + return "childSize: integer expected"; + if (message.minPrefixLength != null && message.hasOwnProperty("minPrefixLength")) + if (!$util.isInteger(message.minPrefixLength)) + return "minPrefixLength: integer expected"; + if (message.maxPrefixLength != null && message.hasOwnProperty("maxPrefixLength")) + if (!$util.isInteger(message.maxPrefixLength)) + return "maxPrefixLength: integer expected"; + if (message.emptyChild != null && message.hasOwnProperty("emptyChild")) + if (!(message.emptyChild && typeof message.emptyChild.length === "number" || $util.isString(message.emptyChild))) + return "emptyChild: buffer expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + switch (message.hash) { + default: + return "hash: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + return null; + }; + + /** + * Creates an InnerSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.InnerSpec + * @static + * @param {Object.} object Plain object + * @returns {ics23.InnerSpec} InnerSpec + */ + InnerSpec.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.InnerSpec) + return object; + var message = new $root.ics23.InnerSpec(); + if (object.childOrder) { + if (!Array.isArray(object.childOrder)) + throw TypeError(".ics23.InnerSpec.childOrder: array expected"); + message.childOrder = []; + for (var i = 0; i < object.childOrder.length; ++i) + message.childOrder[i] = object.childOrder[i] | 0; + } + if (object.childSize != null) + message.childSize = object.childSize | 0; + if (object.minPrefixLength != null) + message.minPrefixLength = object.minPrefixLength | 0; + if (object.maxPrefixLength != null) + message.maxPrefixLength = object.maxPrefixLength | 0; + if (object.emptyChild != null) + if (typeof object.emptyChild === "string") + $util.base64.decode(object.emptyChild, message.emptyChild = $util.newBuffer($util.base64.length(object.emptyChild)), 0); + else if (object.emptyChild.length) + message.emptyChild = object.emptyChild; + switch (object.hash) { + case "NO_HASH": + case 0: + message.hash = 0; + break; + case "SHA256": + case 1: + message.hash = 1; + break; + case "SHA512": + case 2: + message.hash = 2; + break; + case "KECCAK": + case 3: + message.hash = 3; + break; + case "RIPEMD160": + case 4: + message.hash = 4; + break; + case "BITCOIN": + case 5: + message.hash = 5; + break; + case "SHA512_256": + case 6: + message.hash = 6; + break; + } + return message; + }; + + /** + * Creates a plain object from an InnerSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.InnerSpec + * @static + * @param {ics23.InnerSpec} message InnerSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InnerSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.childOrder = []; + if (options.defaults) { + object.childSize = 0; + object.minPrefixLength = 0; + object.maxPrefixLength = 0; + if (options.bytes === String) + object.emptyChild = ""; + else { + object.emptyChild = []; + if (options.bytes !== Array) + object.emptyChild = $util.newBuffer(object.emptyChild); + } + object.hash = options.enums === String ? "NO_HASH" : 0; + } + if (message.childOrder && message.childOrder.length) { + object.childOrder = []; + for (var j = 0; j < message.childOrder.length; ++j) + object.childOrder[j] = message.childOrder[j]; + } + if (message.childSize != null && message.hasOwnProperty("childSize")) + object.childSize = message.childSize; + if (message.minPrefixLength != null && message.hasOwnProperty("minPrefixLength")) + object.minPrefixLength = message.minPrefixLength; + if (message.maxPrefixLength != null && message.hasOwnProperty("maxPrefixLength")) + object.maxPrefixLength = message.maxPrefixLength; + if (message.emptyChild != null && message.hasOwnProperty("emptyChild")) + object.emptyChild = options.bytes === String ? $util.base64.encode(message.emptyChild, 0, message.emptyChild.length) : options.bytes === Array ? Array.prototype.slice.call(message.emptyChild) : message.emptyChild; + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.enums === String ? $root.ics23.HashOp[message.hash] : message.hash; + return object; + }; + + /** + * Converts this InnerSpec to JSON. + * @function toJSON + * @memberof ics23.InnerSpec + * @instance + * @returns {Object.} JSON object + */ + InnerSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return InnerSpec; + })(); + + ics23.BatchProof = (function() { + + /** + * Properties of a BatchProof. + * @memberof ics23 + * @interface IBatchProof + * @property {Array.|null} [entries] BatchProof entries + */ + + /** + * Constructs a new BatchProof. + * @memberof ics23 + * @classdesc Represents a BatchProof. + * @implements IBatchProof + * @constructor + * @param {ics23.IBatchProof=} [properties] Properties to set + */ + function BatchProof(properties) { + this.entries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchProof entries. + * @member {Array.} entries + * @memberof ics23.BatchProof + * @instance + */ + BatchProof.prototype.entries = $util.emptyArray; + + /** + * Creates a new BatchProof instance using the specified properties. + * @function create + * @memberof ics23.BatchProof + * @static + * @param {ics23.IBatchProof=} [properties] Properties to set + * @returns {ics23.BatchProof} BatchProof instance + */ + BatchProof.create = function create(properties) { + return new BatchProof(properties); + }; + + /** + * Encodes the specified BatchProof message. Does not implicitly {@link ics23.BatchProof.verify|verify} messages. + * @function encode + * @memberof ics23.BatchProof + * @static + * @param {ics23.IBatchProof} message BatchProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + $root.ics23.BatchEntry.encode(message.entries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchProof message, length delimited. Does not implicitly {@link ics23.BatchProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.BatchProof + * @static + * @param {ics23.IBatchProof} message BatchProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.BatchProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.BatchProof} BatchProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.BatchProof(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.ics23.BatchEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.BatchProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.BatchProof} BatchProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchProof message. + * @function verify + * @memberof ics23.BatchProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) { + var error = $root.ics23.BatchEntry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + return null; + }; + + /** + * Creates a BatchProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.BatchProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.BatchProof} BatchProof + */ + BatchProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.BatchProof) + return object; + var message = new $root.ics23.BatchProof(); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".ics23.BatchProof.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".ics23.BatchProof.entries: object expected"); + message.entries[i] = $root.ics23.BatchEntry.fromObject(object.entries[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.BatchProof + * @static + * @param {ics23.BatchProof} message BatchProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.ics23.BatchEntry.toObject(message.entries[j], options); + } + return object; + }; + + /** + * Converts this BatchProof to JSON. + * @function toJSON + * @memberof ics23.BatchProof + * @instance + * @returns {Object.} JSON object + */ + BatchProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchProof; + })(); + + ics23.BatchEntry = (function() { + + /** + * Properties of a BatchEntry. + * @memberof ics23 + * @interface IBatchEntry + * @property {ics23.IExistenceProof|null} [exist] BatchEntry exist + * @property {ics23.INonExistenceProof|null} [nonexist] BatchEntry nonexist + */ + + /** + * Constructs a new BatchEntry. + * @memberof ics23 + * @classdesc Represents a BatchEntry. + * @implements IBatchEntry + * @constructor + * @param {ics23.IBatchEntry=} [properties] Properties to set + */ + function BatchEntry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchEntry exist. + * @member {ics23.IExistenceProof|null|undefined} exist + * @memberof ics23.BatchEntry + * @instance + */ + BatchEntry.prototype.exist = null; + + /** + * BatchEntry nonexist. + * @member {ics23.INonExistenceProof|null|undefined} nonexist + * @memberof ics23.BatchEntry + * @instance + */ + BatchEntry.prototype.nonexist = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchEntry proof. + * @member {"exist"|"nonexist"|undefined} proof + * @memberof ics23.BatchEntry + * @instance + */ + Object.defineProperty(BatchEntry.prototype, "proof", { + get: $util.oneOfGetter($oneOfFields = ["exist", "nonexist"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchEntry instance using the specified properties. + * @function create + * @memberof ics23.BatchEntry + * @static + * @param {ics23.IBatchEntry=} [properties] Properties to set + * @returns {ics23.BatchEntry} BatchEntry instance + */ + BatchEntry.create = function create(properties) { + return new BatchEntry(properties); + }; + + /** + * Encodes the specified BatchEntry message. Does not implicitly {@link ics23.BatchEntry.verify|verify} messages. + * @function encode + * @memberof ics23.BatchEntry + * @static + * @param {ics23.IBatchEntry} message BatchEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.exist != null && message.hasOwnProperty("exist")) + $root.ics23.ExistenceProof.encode(message.exist, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nonexist != null && message.hasOwnProperty("nonexist")) + $root.ics23.NonExistenceProof.encode(message.nonexist, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchEntry message, length delimited. Does not implicitly {@link ics23.BatchEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.BatchEntry + * @static + * @param {ics23.IBatchEntry} message BatchEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchEntry message from the specified reader or buffer. + * @function decode + * @memberof ics23.BatchEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.BatchEntry} BatchEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchEntry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.BatchEntry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = $root.ics23.ExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = $root.ics23.NonExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.BatchEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.BatchEntry} BatchEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchEntry message. + * @function verify + * @memberof ics23.BatchEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.exist != null && message.hasOwnProperty("exist")) { + properties.proof = 1; + { + var error = $root.ics23.ExistenceProof.verify(message.exist); + if (error) + return "exist." + error; + } + } + if (message.nonexist != null && message.hasOwnProperty("nonexist")) { + if (properties.proof === 1) + return "proof: multiple values"; + properties.proof = 1; + { + var error = $root.ics23.NonExistenceProof.verify(message.nonexist); + if (error) + return "nonexist." + error; + } + } + return null; + }; + + /** + * Creates a BatchEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.BatchEntry + * @static + * @param {Object.} object Plain object + * @returns {ics23.BatchEntry} BatchEntry + */ + BatchEntry.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.BatchEntry) + return object; + var message = new $root.ics23.BatchEntry(); + if (object.exist != null) { + if (typeof object.exist !== "object") + throw TypeError(".ics23.BatchEntry.exist: object expected"); + message.exist = $root.ics23.ExistenceProof.fromObject(object.exist); + } + if (object.nonexist != null) { + if (typeof object.nonexist !== "object") + throw TypeError(".ics23.BatchEntry.nonexist: object expected"); + message.nonexist = $root.ics23.NonExistenceProof.fromObject(object.nonexist); + } + return message; + }; + + /** + * Creates a plain object from a BatchEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.BatchEntry + * @static + * @param {ics23.BatchEntry} message BatchEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.exist != null && message.hasOwnProperty("exist")) { + object.exist = $root.ics23.ExistenceProof.toObject(message.exist, options); + if (options.oneofs) + object.proof = "exist"; + } + if (message.nonexist != null && message.hasOwnProperty("nonexist")) { + object.nonexist = $root.ics23.NonExistenceProof.toObject(message.nonexist, options); + if (options.oneofs) + object.proof = "nonexist"; + } + return object; + }; + + /** + * Converts this BatchEntry to JSON. + * @function toJSON + * @memberof ics23.BatchEntry + * @instance + * @returns {Object.} JSON object + */ + BatchEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchEntry; + })(); + + ics23.CompressedBatchProof = (function() { + + /** + * Properties of a CompressedBatchProof. + * @memberof ics23 + * @interface ICompressedBatchProof + * @property {Array.|null} [entries] CompressedBatchProof entries + * @property {Array.|null} [lookupInners] CompressedBatchProof lookupInners + */ + + /** + * Constructs a new CompressedBatchProof. + * @memberof ics23 + * @classdesc Represents a CompressedBatchProof. + * @implements ICompressedBatchProof + * @constructor + * @param {ics23.ICompressedBatchProof=} [properties] Properties to set + */ + function CompressedBatchProof(properties) { + this.entries = []; + this.lookupInners = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompressedBatchProof entries. + * @member {Array.} entries + * @memberof ics23.CompressedBatchProof + * @instance + */ + CompressedBatchProof.prototype.entries = $util.emptyArray; + + /** + * CompressedBatchProof lookupInners. + * @member {Array.} lookupInners + * @memberof ics23.CompressedBatchProof + * @instance + */ + CompressedBatchProof.prototype.lookupInners = $util.emptyArray; + + /** + * Creates a new CompressedBatchProof instance using the specified properties. + * @function create + * @memberof ics23.CompressedBatchProof + * @static + * @param {ics23.ICompressedBatchProof=} [properties] Properties to set + * @returns {ics23.CompressedBatchProof} CompressedBatchProof instance + */ + CompressedBatchProof.create = function create(properties) { + return new CompressedBatchProof(properties); + }; + + /** + * Encodes the specified CompressedBatchProof message. Does not implicitly {@link ics23.CompressedBatchProof.verify|verify} messages. + * @function encode + * @memberof ics23.CompressedBatchProof + * @static + * @param {ics23.ICompressedBatchProof} message CompressedBatchProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedBatchProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + $root.ics23.CompressedBatchEntry.encode(message.entries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.lookupInners != null && message.lookupInners.length) + for (var i = 0; i < message.lookupInners.length; ++i) + $root.ics23.InnerOp.encode(message.lookupInners[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompressedBatchProof message, length delimited. Does not implicitly {@link ics23.CompressedBatchProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.CompressedBatchProof + * @static + * @param {ics23.ICompressedBatchProof} message CompressedBatchProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedBatchProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompressedBatchProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.CompressedBatchProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.CompressedBatchProof} CompressedBatchProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedBatchProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CompressedBatchProof(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.ics23.CompressedBatchEntry.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.lookupInners && message.lookupInners.length)) + message.lookupInners = []; + message.lookupInners.push($root.ics23.InnerOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompressedBatchProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.CompressedBatchProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.CompressedBatchProof} CompressedBatchProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedBatchProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompressedBatchProof message. + * @function verify + * @memberof ics23.CompressedBatchProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompressedBatchProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) { + var error = $root.ics23.CompressedBatchEntry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + if (message.lookupInners != null && message.hasOwnProperty("lookupInners")) { + if (!Array.isArray(message.lookupInners)) + return "lookupInners: array expected"; + for (var i = 0; i < message.lookupInners.length; ++i) { + var error = $root.ics23.InnerOp.verify(message.lookupInners[i]); + if (error) + return "lookupInners." + error; + } + } + return null; + }; + + /** + * Creates a CompressedBatchProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.CompressedBatchProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.CompressedBatchProof} CompressedBatchProof + */ + CompressedBatchProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.CompressedBatchProof) + return object; + var message = new $root.ics23.CompressedBatchProof(); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".ics23.CompressedBatchProof.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".ics23.CompressedBatchProof.entries: object expected"); + message.entries[i] = $root.ics23.CompressedBatchEntry.fromObject(object.entries[i]); + } + } + if (object.lookupInners) { + if (!Array.isArray(object.lookupInners)) + throw TypeError(".ics23.CompressedBatchProof.lookupInners: array expected"); + message.lookupInners = []; + for (var i = 0; i < object.lookupInners.length; ++i) { + if (typeof object.lookupInners[i] !== "object") + throw TypeError(".ics23.CompressedBatchProof.lookupInners: object expected"); + message.lookupInners[i] = $root.ics23.InnerOp.fromObject(object.lookupInners[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CompressedBatchProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.CompressedBatchProof + * @static + * @param {ics23.CompressedBatchProof} message CompressedBatchProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompressedBatchProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.entries = []; + object.lookupInners = []; + } + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.ics23.CompressedBatchEntry.toObject(message.entries[j], options); + } + if (message.lookupInners && message.lookupInners.length) { + object.lookupInners = []; + for (var j = 0; j < message.lookupInners.length; ++j) + object.lookupInners[j] = $root.ics23.InnerOp.toObject(message.lookupInners[j], options); + } + return object; + }; + + /** + * Converts this CompressedBatchProof to JSON. + * @function toJSON + * @memberof ics23.CompressedBatchProof + * @instance + * @returns {Object.} JSON object + */ + CompressedBatchProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompressedBatchProof; + })(); + + ics23.CompressedBatchEntry = (function() { + + /** + * Properties of a CompressedBatchEntry. + * @memberof ics23 + * @interface ICompressedBatchEntry + * @property {ics23.ICompressedExistenceProof|null} [exist] CompressedBatchEntry exist + * @property {ics23.ICompressedNonExistenceProof|null} [nonexist] CompressedBatchEntry nonexist + */ + + /** + * Constructs a new CompressedBatchEntry. + * @memberof ics23 + * @classdesc Represents a CompressedBatchEntry. + * @implements ICompressedBatchEntry + * @constructor + * @param {ics23.ICompressedBatchEntry=} [properties] Properties to set + */ + function CompressedBatchEntry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompressedBatchEntry exist. + * @member {ics23.ICompressedExistenceProof|null|undefined} exist + * @memberof ics23.CompressedBatchEntry + * @instance + */ + CompressedBatchEntry.prototype.exist = null; + + /** + * CompressedBatchEntry nonexist. + * @member {ics23.ICompressedNonExistenceProof|null|undefined} nonexist + * @memberof ics23.CompressedBatchEntry + * @instance + */ + CompressedBatchEntry.prototype.nonexist = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CompressedBatchEntry proof. + * @member {"exist"|"nonexist"|undefined} proof + * @memberof ics23.CompressedBatchEntry + * @instance + */ + Object.defineProperty(CompressedBatchEntry.prototype, "proof", { + get: $util.oneOfGetter($oneOfFields = ["exist", "nonexist"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CompressedBatchEntry instance using the specified properties. + * @function create + * @memberof ics23.CompressedBatchEntry + * @static + * @param {ics23.ICompressedBatchEntry=} [properties] Properties to set + * @returns {ics23.CompressedBatchEntry} CompressedBatchEntry instance + */ + CompressedBatchEntry.create = function create(properties) { + return new CompressedBatchEntry(properties); + }; + + /** + * Encodes the specified CompressedBatchEntry message. Does not implicitly {@link ics23.CompressedBatchEntry.verify|verify} messages. + * @function encode + * @memberof ics23.CompressedBatchEntry + * @static + * @param {ics23.ICompressedBatchEntry} message CompressedBatchEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedBatchEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.exist != null && message.hasOwnProperty("exist")) + $root.ics23.CompressedExistenceProof.encode(message.exist, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nonexist != null && message.hasOwnProperty("nonexist")) + $root.ics23.CompressedNonExistenceProof.encode(message.nonexist, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompressedBatchEntry message, length delimited. Does not implicitly {@link ics23.CompressedBatchEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.CompressedBatchEntry + * @static + * @param {ics23.ICompressedBatchEntry} message CompressedBatchEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedBatchEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompressedBatchEntry message from the specified reader or buffer. + * @function decode + * @memberof ics23.CompressedBatchEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.CompressedBatchEntry} CompressedBatchEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedBatchEntry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CompressedBatchEntry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = $root.ics23.CompressedExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = $root.ics23.CompressedNonExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompressedBatchEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.CompressedBatchEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.CompressedBatchEntry} CompressedBatchEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedBatchEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompressedBatchEntry message. + * @function verify + * @memberof ics23.CompressedBatchEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompressedBatchEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.exist != null && message.hasOwnProperty("exist")) { + properties.proof = 1; + { + var error = $root.ics23.CompressedExistenceProof.verify(message.exist); + if (error) + return "exist." + error; + } + } + if (message.nonexist != null && message.hasOwnProperty("nonexist")) { + if (properties.proof === 1) + return "proof: multiple values"; + properties.proof = 1; + { + var error = $root.ics23.CompressedNonExistenceProof.verify(message.nonexist); + if (error) + return "nonexist." + error; + } + } + return null; + }; + + /** + * Creates a CompressedBatchEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.CompressedBatchEntry + * @static + * @param {Object.} object Plain object + * @returns {ics23.CompressedBatchEntry} CompressedBatchEntry + */ + CompressedBatchEntry.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.CompressedBatchEntry) + return object; + var message = new $root.ics23.CompressedBatchEntry(); + if (object.exist != null) { + if (typeof object.exist !== "object") + throw TypeError(".ics23.CompressedBatchEntry.exist: object expected"); + message.exist = $root.ics23.CompressedExistenceProof.fromObject(object.exist); + } + if (object.nonexist != null) { + if (typeof object.nonexist !== "object") + throw TypeError(".ics23.CompressedBatchEntry.nonexist: object expected"); + message.nonexist = $root.ics23.CompressedNonExistenceProof.fromObject(object.nonexist); + } + return message; + }; + + /** + * Creates a plain object from a CompressedBatchEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.CompressedBatchEntry + * @static + * @param {ics23.CompressedBatchEntry} message CompressedBatchEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompressedBatchEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.exist != null && message.hasOwnProperty("exist")) { + object.exist = $root.ics23.CompressedExistenceProof.toObject(message.exist, options); + if (options.oneofs) + object.proof = "exist"; + } + if (message.nonexist != null && message.hasOwnProperty("nonexist")) { + object.nonexist = $root.ics23.CompressedNonExistenceProof.toObject(message.nonexist, options); + if (options.oneofs) + object.proof = "nonexist"; + } + return object; + }; + + /** + * Converts this CompressedBatchEntry to JSON. + * @function toJSON + * @memberof ics23.CompressedBatchEntry + * @instance + * @returns {Object.} JSON object + */ + CompressedBatchEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompressedBatchEntry; + })(); + + ics23.CompressedExistenceProof = (function() { + + /** + * Properties of a CompressedExistenceProof. + * @memberof ics23 + * @interface ICompressedExistenceProof + * @property {Uint8Array|null} [key] CompressedExistenceProof key + * @property {Uint8Array|null} [value] CompressedExistenceProof value + * @property {ics23.ILeafOp|null} [leaf] CompressedExistenceProof leaf + * @property {Array.|null} [path] CompressedExistenceProof path + */ + + /** + * Constructs a new CompressedExistenceProof. + * @memberof ics23 + * @classdesc Represents a CompressedExistenceProof. + * @implements ICompressedExistenceProof + * @constructor + * @param {ics23.ICompressedExistenceProof=} [properties] Properties to set + */ + function CompressedExistenceProof(properties) { + this.path = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompressedExistenceProof key. + * @member {Uint8Array} key + * @memberof ics23.CompressedExistenceProof + * @instance + */ + CompressedExistenceProof.prototype.key = $util.newBuffer([]); + + /** + * CompressedExistenceProof value. + * @member {Uint8Array} value + * @memberof ics23.CompressedExistenceProof + * @instance + */ + CompressedExistenceProof.prototype.value = $util.newBuffer([]); + + /** + * CompressedExistenceProof leaf. + * @member {ics23.ILeafOp|null|undefined} leaf + * @memberof ics23.CompressedExistenceProof + * @instance + */ + CompressedExistenceProof.prototype.leaf = null; + + /** + * CompressedExistenceProof path. + * @member {Array.} path + * @memberof ics23.CompressedExistenceProof + * @instance + */ + CompressedExistenceProof.prototype.path = $util.emptyArray; + + /** + * Creates a new CompressedExistenceProof instance using the specified properties. + * @function create + * @memberof ics23.CompressedExistenceProof + * @static + * @param {ics23.ICompressedExistenceProof=} [properties] Properties to set + * @returns {ics23.CompressedExistenceProof} CompressedExistenceProof instance + */ + CompressedExistenceProof.create = function create(properties) { + return new CompressedExistenceProof(properties); + }; + + /** + * Encodes the specified CompressedExistenceProof message. Does not implicitly {@link ics23.CompressedExistenceProof.verify|verify} messages. + * @function encode + * @memberof ics23.CompressedExistenceProof + * @static + * @param {ics23.ICompressedExistenceProof} message CompressedExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedExistenceProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && message.hasOwnProperty("key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.value != null && message.hasOwnProperty("value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + if (message.leaf != null && message.hasOwnProperty("leaf")) + $root.ics23.LeafOp.encode(message.leaf, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 4, wireType 2 =*/34).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified CompressedExistenceProof message, length delimited. Does not implicitly {@link ics23.CompressedExistenceProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.CompressedExistenceProof + * @static + * @param {ics23.ICompressedExistenceProof} message CompressedExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedExistenceProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompressedExistenceProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.CompressedExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.CompressedExistenceProof} CompressedExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedExistenceProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CompressedExistenceProof(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.leaf = $root.ics23.LeafOp.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompressedExistenceProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.CompressedExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.CompressedExistenceProof} CompressedExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedExistenceProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompressedExistenceProof message. + * @function verify + * @memberof ics23.CompressedExistenceProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompressedExistenceProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + if (message.leaf != null && message.hasOwnProperty("leaf")) { + var error = $root.ics23.LeafOp.verify(message.leaf); + if (error) + return "leaf." + error; + } + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + return null; + }; + + /** + * Creates a CompressedExistenceProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.CompressedExistenceProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.CompressedExistenceProof} CompressedExistenceProof + */ + CompressedExistenceProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.CompressedExistenceProof) + return object; + var message = new $root.ics23.CompressedExistenceProof(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + if (object.leaf != null) { + if (typeof object.leaf !== "object") + throw TypeError(".ics23.CompressedExistenceProof.leaf: object expected"); + message.leaf = $root.ics23.LeafOp.fromObject(object.leaf); + } + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".ics23.CompressedExistenceProof.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + return message; + }; + + /** + * Creates a plain object from a CompressedExistenceProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.CompressedExistenceProof + * @static + * @param {ics23.CompressedExistenceProof} message CompressedExistenceProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompressedExistenceProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + object.leaf = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + if (message.leaf != null && message.hasOwnProperty("leaf")) + object.leaf = $root.ics23.LeafOp.toObject(message.leaf, options); + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + return object; + }; + + /** + * Converts this CompressedExistenceProof to JSON. + * @function toJSON + * @memberof ics23.CompressedExistenceProof + * @instance + * @returns {Object.} JSON object + */ + CompressedExistenceProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompressedExistenceProof; + })(); + + ics23.CompressedNonExistenceProof = (function() { + + /** + * Properties of a CompressedNonExistenceProof. + * @memberof ics23 + * @interface ICompressedNonExistenceProof + * @property {Uint8Array|null} [key] CompressedNonExistenceProof key + * @property {ics23.ICompressedExistenceProof|null} [left] CompressedNonExistenceProof left + * @property {ics23.ICompressedExistenceProof|null} [right] CompressedNonExistenceProof right + */ + + /** + * Constructs a new CompressedNonExistenceProof. + * @memberof ics23 + * @classdesc Represents a CompressedNonExistenceProof. + * @implements ICompressedNonExistenceProof + * @constructor + * @param {ics23.ICompressedNonExistenceProof=} [properties] Properties to set + */ + function CompressedNonExistenceProof(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompressedNonExistenceProof key. + * @member {Uint8Array} key + * @memberof ics23.CompressedNonExistenceProof + * @instance + */ + CompressedNonExistenceProof.prototype.key = $util.newBuffer([]); + + /** + * CompressedNonExistenceProof left. + * @member {ics23.ICompressedExistenceProof|null|undefined} left + * @memberof ics23.CompressedNonExistenceProof + * @instance + */ + CompressedNonExistenceProof.prototype.left = null; + + /** + * CompressedNonExistenceProof right. + * @member {ics23.ICompressedExistenceProof|null|undefined} right + * @memberof ics23.CompressedNonExistenceProof + * @instance + */ + CompressedNonExistenceProof.prototype.right = null; + + /** + * Creates a new CompressedNonExistenceProof instance using the specified properties. + * @function create + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {ics23.ICompressedNonExistenceProof=} [properties] Properties to set + * @returns {ics23.CompressedNonExistenceProof} CompressedNonExistenceProof instance + */ + CompressedNonExistenceProof.create = function create(properties) { + return new CompressedNonExistenceProof(properties); + }; + + /** + * Encodes the specified CompressedNonExistenceProof message. Does not implicitly {@link ics23.CompressedNonExistenceProof.verify|verify} messages. + * @function encode + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {ics23.ICompressedNonExistenceProof} message CompressedNonExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedNonExistenceProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && message.hasOwnProperty("key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.left != null && message.hasOwnProperty("left")) + $root.ics23.CompressedExistenceProof.encode(message.left, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.right != null && message.hasOwnProperty("right")) + $root.ics23.CompressedExistenceProof.encode(message.right, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompressedNonExistenceProof message, length delimited. Does not implicitly {@link ics23.CompressedNonExistenceProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {ics23.ICompressedNonExistenceProof} message CompressedNonExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedNonExistenceProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompressedNonExistenceProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.CompressedNonExistenceProof} CompressedNonExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedNonExistenceProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CompressedNonExistenceProof(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.left = $root.ics23.CompressedExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.right = $root.ics23.CompressedExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompressedNonExistenceProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.CompressedNonExistenceProof} CompressedNonExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedNonExistenceProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompressedNonExistenceProof message. + * @function verify + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompressedNonExistenceProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.left != null && message.hasOwnProperty("left")) { + var error = $root.ics23.CompressedExistenceProof.verify(message.left); + if (error) + return "left." + error; + } + if (message.right != null && message.hasOwnProperty("right")) { + var error = $root.ics23.CompressedExistenceProof.verify(message.right); + if (error) + return "right." + error; + } + return null; + }; + + /** + * Creates a CompressedNonExistenceProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.CompressedNonExistenceProof} CompressedNonExistenceProof + */ + CompressedNonExistenceProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.CompressedNonExistenceProof) + return object; + var message = new $root.ics23.CompressedNonExistenceProof(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.left != null) { + if (typeof object.left !== "object") + throw TypeError(".ics23.CompressedNonExistenceProof.left: object expected"); + message.left = $root.ics23.CompressedExistenceProof.fromObject(object.left); + } + if (object.right != null) { + if (typeof object.right !== "object") + throw TypeError(".ics23.CompressedNonExistenceProof.right: object expected"); + message.right = $root.ics23.CompressedExistenceProof.fromObject(object.right); + } + return message; + }; + + /** + * Creates a plain object from a CompressedNonExistenceProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {ics23.CompressedNonExistenceProof} message CompressedNonExistenceProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompressedNonExistenceProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + object.left = null; + object.right = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.left != null && message.hasOwnProperty("left")) + object.left = $root.ics23.CompressedExistenceProof.toObject(message.left, options); + if (message.right != null && message.hasOwnProperty("right")) + object.right = $root.ics23.CompressedExistenceProof.toObject(message.right, options); + return object; + }; + + /** + * Converts this CompressedNonExistenceProof to JSON. + * @function toJSON + * @memberof ics23.CompressedNonExistenceProof + * @instance + * @returns {Object.} JSON object + */ + CompressedNonExistenceProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompressedNonExistenceProof; + })(); + + return ics23; +})(); + +module.exports = $root; + + +/***/ }), + +/***/ "./node_modules/@confio/ics23/build/ics23.js": +/*!***************************************************!*\ + !*** ./node_modules/@confio/ics23/build/ics23.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.batchVerifyNonMembership = exports.batchVerifyMembership = exports.verifyNonMembership = exports.verifyMembership = void 0; +const compress_1 = __webpack_require__(/*! ./compress */ "./node_modules/@confio/ics23/build/compress.js"); +const proofs_1 = __webpack_require__(/*! ./proofs */ "./node_modules/@confio/ics23/build/proofs.js"); +const specs_1 = __webpack_require__(/*! ./specs */ "./node_modules/@confio/ics23/build/specs.js"); +/* +This implements the client side functions as specified in +https://github.com/cosmos/ics/tree/master/spec/ics-023-vector-commitments + +In particular: + + // Assumes ExistenceProof + type verifyMembership = (root: CommitmentRoot, proof: CommitmentProof, key: Key, value: Value) => boolean + + // Assumes NonExistenceProof + type verifyNonMembership = (root: CommitmentRoot, proof: CommitmentProof, key: Key) => boolean + + // Assumes BatchProof - required ExistenceProofs may be a subset of all items proven + type batchVerifyMembership = (root: CommitmentRoot, proof: CommitmentProof, items: Map) => boolean + + // Assumes BatchProof - required NonExistenceProofs may be a subset of all items proven + type batchVerifyNonMembership = (root: CommitmentRoot, proof: CommitmentProof, keys: Set) => boolean + +We make an adjustment to accept a Spec to ensure the provided proof is in the format of the expected merkle store. +This can avoid an range of attacks on fake preimages, as we need to be careful on how to map key, value -> leaf +and determine neighbors +*/ +/** + * verifyMembership ensures proof is (contains) a valid existence proof for the given + */ +function verifyMembership(proof, spec, root, key, value) { + const norm = (0, compress_1.decompress)(proof); + const exist = getExistForKey(norm, key); + if (!exist) { + return false; + } + try { + (0, proofs_1.verifyExistence)(exist, spec, root, key, value); + return true; + } + catch (_a) { + return false; + } +} +exports.verifyMembership = verifyMembership; +/** + * verifyNonMembership ensures proof is (contains) a valid non-existence proof for the given key + */ +function verifyNonMembership(proof, spec, root, key) { + const norm = (0, compress_1.decompress)(proof); + const nonexist = getNonExistForKey(norm, key); + if (!nonexist) { + return false; + } + try { + (0, proofs_1.verifyNonExistence)(nonexist, spec, root, key); + return true; + } + catch (_a) { + return false; + } +} +exports.verifyNonMembership = verifyNonMembership; +/** + * batchVerifyMembership ensures proof is (contains) a valid existence proof for the given + */ +function batchVerifyMembership(proof, spec, root, items) { + const norm = (0, compress_1.decompress)(proof); + for (const [key, value] of items.entries()) { + if (!verifyMembership(norm, spec, root, key, value)) { + return false; + } + } + return true; +} +exports.batchVerifyMembership = batchVerifyMembership; +/** + * batchVerifyNonMembership ensures proof is (contains) a valid existence proof for the given + */ +function batchVerifyNonMembership(proof, spec, root, keys) { + const norm = (0, compress_1.decompress)(proof); + for (const key of keys) { + if (!verifyNonMembership(norm, spec, root, key)) { + return false; + } + } + return true; +} +exports.batchVerifyNonMembership = batchVerifyNonMembership; +function getExistForKey(proof, key) { + const match = (p) => !!p && (0, specs_1.bytesEqual)(key, p.key); + if (match(proof.exist)) { + return proof.exist; + } + else if (proof.batch) { + return proof.batch.entries.map((x) => x.exist || null).find(match); + } + return undefined; +} +function getNonExistForKey(proof, key) { + const match = (p) => { + return (!!p && + (!p.left || (0, specs_1.bytesBefore)(p.left.key, key)) && + (!p.right || (0, specs_1.bytesBefore)(key, p.right.key))); + }; + if (match(proof.nonexist)) { + return proof.nonexist; + } + else if (proof.batch) { + return proof.batch.entries.map((x) => x.nonexist || null).find(match); + } + return undefined; +} +//# sourceMappingURL=ics23.js.map + +/***/ }), + +/***/ "./node_modules/@confio/ics23/build/index.js": +/*!***************************************************!*\ + !*** ./node_modules/@confio/ics23/build/index.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.verifyNonExistence = exports.verifyExistence = exports.tendermintSpec = exports.iavlSpec = exports.calculateExistenceRoot = exports.verifyNonMembership = exports.verifyMembership = exports.ics23 = void 0; +var codecimpl_1 = __webpack_require__(/*! ./generated/codecimpl */ "./node_modules/@confio/ics23/build/generated/codecimpl.js"); +Object.defineProperty(exports, "ics23", ({ enumerable: true, get: function () { return codecimpl_1.ics23; } })); +var ics23_1 = __webpack_require__(/*! ./ics23 */ "./node_modules/@confio/ics23/build/ics23.js"); +Object.defineProperty(exports, "verifyMembership", ({ enumerable: true, get: function () { return ics23_1.verifyMembership; } })); +Object.defineProperty(exports, "verifyNonMembership", ({ enumerable: true, get: function () { return ics23_1.verifyNonMembership; } })); +var proofs_1 = __webpack_require__(/*! ./proofs */ "./node_modules/@confio/ics23/build/proofs.js"); +Object.defineProperty(exports, "calculateExistenceRoot", ({ enumerable: true, get: function () { return proofs_1.calculateExistenceRoot; } })); +Object.defineProperty(exports, "iavlSpec", ({ enumerable: true, get: function () { return proofs_1.iavlSpec; } })); +Object.defineProperty(exports, "tendermintSpec", ({ enumerable: true, get: function () { return proofs_1.tendermintSpec; } })); +Object.defineProperty(exports, "verifyExistence", ({ enumerable: true, get: function () { return proofs_1.verifyExistence; } })); +Object.defineProperty(exports, "verifyNonExistence", ({ enumerable: true, get: function () { return proofs_1.verifyNonExistence; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@confio/ics23/build/ops.js": +/*!*************************************************!*\ + !*** ./node_modules/@confio/ics23/build/ops.js ***! + \*************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.doHash = exports.applyInner = exports.applyLeaf = void 0; +const ripemd160_1 = __webpack_require__(/*! @noble/hashes/ripemd160 */ "./node_modules/@noble/hashes/ripemd160.js"); +const sha256_1 = __webpack_require__(/*! @noble/hashes/sha256 */ "./node_modules/@noble/hashes/sha256.js"); +const sha512_1 = __webpack_require__(/*! @noble/hashes/sha512 */ "./node_modules/@noble/hashes/sha512.js"); +const codecimpl_1 = __webpack_require__(/*! ./generated/codecimpl */ "./node_modules/@confio/ics23/build/generated/codecimpl.js"); +function applyLeaf(leaf, key, value) { + if (key.length === 0) { + throw new Error("Missing key"); + } + if (value.length === 0) { + throw new Error("Missing value"); + } + const pkey = prepareLeafData(ensureHash(leaf.prehashKey), ensureLength(leaf.length), key); + const pvalue = prepareLeafData(ensureHash(leaf.prehashValue), ensureLength(leaf.length), value); + const data = new Uint8Array([ + ...ensureBytes(leaf.prefix), + ...pkey, + ...pvalue, + ]); + return doHash(ensureHash(leaf.hash), data); +} +exports.applyLeaf = applyLeaf; +function applyInner(inner, child) { + if (child.length === 0) { + throw new Error("Inner op needs child value"); + } + const preimage = new Uint8Array([ + ...ensureBytes(inner.prefix), + ...child, + ...ensureBytes(inner.suffix), + ]); + return doHash(ensureHash(inner.hash), preimage); +} +exports.applyInner = applyInner; +function ensure(maybe, value) { + return maybe === undefined || maybe === null ? value : maybe; +} +const ensureHash = (h) => ensure(h, codecimpl_1.ics23.HashOp.NO_HASH); +const ensureLength = (l) => ensure(l, codecimpl_1.ics23.LengthOp.NO_PREFIX); +const ensureBytes = (b) => ensure(b, new Uint8Array([])); +function prepareLeafData(hashOp, lengthOp, data) { + const h = doHashOrNoop(hashOp, data); + return doLengthOp(lengthOp, h); +} +// doHashOrNoop will return the preimage untouched if hashOp == NONE, +// otherwise, perform doHash +function doHashOrNoop(hashOp, preimage) { + if (hashOp === codecimpl_1.ics23.HashOp.NO_HASH) { + return preimage; + } + return doHash(hashOp, preimage); +} +// doHash will preform the specified hash on the preimage. +// if hashOp == NONE, it will return an error (use doHashOrNoop if you want different behavior) +function doHash(hashOp, preimage) { + switch (hashOp) { + case codecimpl_1.ics23.HashOp.SHA256: + return (0, sha256_1.sha256)(preimage); + case codecimpl_1.ics23.HashOp.SHA512: + return (0, sha512_1.sha512)(preimage); + case codecimpl_1.ics23.HashOp.RIPEMD160: + return (0, ripemd160_1.ripemd160)(preimage); + case codecimpl_1.ics23.HashOp.BITCOIN: + return (0, ripemd160_1.ripemd160)((0, sha256_1.sha256)(preimage)); + case codecimpl_1.ics23.HashOp.SHA512_256: + return (0, sha512_1.sha512_256)(preimage); + } + throw new Error(`Unsupported hashop: ${hashOp}`); +} +exports.doHash = doHash; +// doLengthOp will calculate the proper prefix and return it prepended +// doLengthOp(op, data) -> length(data) || data +function doLengthOp(lengthOp, data) { + switch (lengthOp) { + case codecimpl_1.ics23.LengthOp.NO_PREFIX: + return data; + case codecimpl_1.ics23.LengthOp.VAR_PROTO: + return new Uint8Array([...encodeVarintProto(data.length), ...data]); + case codecimpl_1.ics23.LengthOp.REQUIRE_32_BYTES: + if (data.length !== 32) { + throw new Error(`Length is ${data.length}, not 32 bytes`); + } + return data; + case codecimpl_1.ics23.LengthOp.REQUIRE_64_BYTES: + if (data.length !== 64) { + throw new Error(`Length is ${data.length}, not 64 bytes`); + } + return data; + case codecimpl_1.ics23.LengthOp.FIXED32_LITTLE: + return new Uint8Array([...encodeFixed32Le(data.length), ...data]); + // TODO + // case LengthOp_VAR_RLP: + // case LengthOp_FIXED32_BIG: + // case LengthOp_FIXED64_BIG: + // case LengthOp_FIXED64_LITTLE: + } + throw new Error(`Unsupported lengthop: ${lengthOp}`); +} +function encodeVarintProto(n) { + let enc = []; + let l = n; + while (l >= 128) { + const b = (l % 128) + 128; + enc = [...enc, b]; + l = l / 128; + } + enc = [...enc, l]; + return new Uint8Array(enc); +} +function encodeFixed32Le(n) { + const enc = new Uint8Array(4); + let l = n; + for (let i = enc.length; i > 0; i--) { + enc[Math.abs(i - enc.length)] = l % 256; + l = Math.floor(l / 256); + } + return enc; +} +//# sourceMappingURL=ops.js.map + +/***/ }), + +/***/ "./node_modules/@confio/ics23/build/proofs.js": +/*!****************************************************!*\ + !*** ./node_modules/@confio/ics23/build/proofs.js ***! + \****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ensureLeftNeighbor = exports.ensureSpec = exports.calculateExistenceRoot = exports.verifyNonExistence = exports.verifyExistence = exports.smtSpec = exports.tendermintSpec = exports.iavlSpec = void 0; +const codecimpl_1 = __webpack_require__(/*! ./generated/codecimpl */ "./node_modules/@confio/ics23/build/generated/codecimpl.js"); +const ops_1 = __webpack_require__(/*! ./ops */ "./node_modules/@confio/ics23/build/ops.js"); +const specs_1 = __webpack_require__(/*! ./specs */ "./node_modules/@confio/ics23/build/specs.js"); +exports.iavlSpec = { + leafSpec: { + prefix: Uint8Array.from([0]), + hash: codecimpl_1.ics23.HashOp.SHA256, + prehashValue: codecimpl_1.ics23.HashOp.SHA256, + prehashKey: codecimpl_1.ics23.HashOp.NO_HASH, + length: codecimpl_1.ics23.LengthOp.VAR_PROTO, + }, + innerSpec: { + childOrder: [0, 1], + minPrefixLength: 4, + maxPrefixLength: 12, + childSize: 33, + hash: codecimpl_1.ics23.HashOp.SHA256, + }, +}; +exports.tendermintSpec = { + leafSpec: { + prefix: Uint8Array.from([0]), + hash: codecimpl_1.ics23.HashOp.SHA256, + prehashValue: codecimpl_1.ics23.HashOp.SHA256, + prehashKey: codecimpl_1.ics23.HashOp.NO_HASH, + length: codecimpl_1.ics23.LengthOp.VAR_PROTO, + }, + innerSpec: { + childOrder: [0, 1], + minPrefixLength: 1, + maxPrefixLength: 1, + childSize: 32, + hash: codecimpl_1.ics23.HashOp.SHA256, + }, +}; +exports.smtSpec = { + leafSpec: { + hash: codecimpl_1.ics23.HashOp.SHA256, + prehashKey: codecimpl_1.ics23.HashOp.NO_HASH, + prehashValue: codecimpl_1.ics23.HashOp.SHA256, + length: codecimpl_1.ics23.LengthOp.NO_PREFIX, + prefix: Uint8Array.from([0]), + }, + innerSpec: { + childOrder: [0, 1], + childSize: 32, + minPrefixLength: 1, + maxPrefixLength: 1, + emptyChild: new Uint8Array(32), + hash: codecimpl_1.ics23.HashOp.SHA256, + }, + maxDepth: 256, +}; +// verifyExistence will throw an error if the proof doesn't link key, value -> root +// or if it doesn't fulfill the spec +function verifyExistence(proof, spec, root, key, value) { + ensureSpec(proof, spec); + const calc = calculateExistenceRoot(proof); + (0, specs_1.ensureBytesEqual)(calc, root); + (0, specs_1.ensureBytesEqual)(key, proof.key); + (0, specs_1.ensureBytesEqual)(value, proof.value); +} +exports.verifyExistence = verifyExistence; +// Verify does all checks to ensure the proof has valid non-existence proofs, +// and they ensure the given key is not in the CommitmentState, +// throwing an error if there is an issue +function verifyNonExistence(proof, spec, root, key) { + let leftKey; + let rightKey; + if (proof.left) { + verifyExistence(proof.left, spec, root, proof.left.key, proof.left.value); + leftKey = proof.left.key; + } + if (proof.right) { + verifyExistence(proof.right, spec, root, proof.right.key, proof.right.value); + rightKey = proof.right.key; + } + if (!leftKey && !rightKey) { + throw new Error("neither left nor right proof defined"); + } + if (leftKey) { + (0, specs_1.ensureBytesBefore)(leftKey, key); + } + if (rightKey) { + (0, specs_1.ensureBytesBefore)(key, rightKey); + } + if (!spec.innerSpec) { + throw new Error("no inner spec"); + } + if (!leftKey) { + ensureLeftMost(spec.innerSpec, proof.right.path); + } + else if (!rightKey) { + ensureRightMost(spec.innerSpec, proof.left.path); + } + else { + ensureLeftNeighbor(spec.innerSpec, proof.left.path, proof.right.path); + } + return; +} +exports.verifyNonExistence = verifyNonExistence; +// Calculate determines the root hash that matches the given proof. +// You must validate the result is what you have in a header. +// Returns error if the calculations cannot be performed. +function calculateExistenceRoot(proof) { + if (!proof.key || !proof.value) { + throw new Error("Existence proof needs key and value set"); + } + if (!proof.leaf) { + throw new Error("Existence proof must start with a leaf operation"); + } + const path = proof.path || []; + let res = (0, ops_1.applyLeaf)(proof.leaf, proof.key, proof.value); + for (const inner of path) { + res = (0, ops_1.applyInner)(inner, res); + } + return res; +} +exports.calculateExistenceRoot = calculateExistenceRoot; +// ensureSpec throws an Error if proof doesn't fulfill spec +function ensureSpec(proof, spec) { + if (!proof.leaf) { + throw new Error("Existence proof must start with a leaf operation"); + } + if (!spec.leafSpec) { + throw new Error("Spec must include leafSpec"); + } + if (!spec.innerSpec) { + throw new Error("Spec must include innerSpec"); + } + (0, specs_1.ensureLeaf)(proof.leaf, spec.leafSpec); + const path = proof.path || []; + if (spec.minDepth && path.length < spec.minDepth) { + throw new Error(`Too few inner nodes ${path.length}`); + } + if (spec.maxDepth && path.length > spec.maxDepth) { + throw new Error(`Too many inner nodes ${path.length}`); + } + for (const inner of path) { + (0, specs_1.ensureInner)(inner, spec.leafSpec.prefix, spec.innerSpec); + } +} +exports.ensureSpec = ensureSpec; +function ensureLeftMost(spec, path) { + const { minPrefix, maxPrefix, suffix } = getPadding(spec, 0); + // ensure every step has a prefix and suffix defined to be leftmost + for (const step of path) { + if (!hasPadding(step, minPrefix, maxPrefix, suffix)) { + throw new Error("Step not leftmost"); + } + } +} +function ensureRightMost(spec, path) { + const len = spec.childOrder.length - 1; + const { minPrefix, maxPrefix, suffix } = getPadding(spec, len); + // ensure every step has a prefix and suffix defined to be leftmost + for (const step of path) { + if (!hasPadding(step, minPrefix, maxPrefix, suffix)) { + throw new Error("Step not leftmost"); + } + } +} +function ensureLeftNeighbor(spec, left, right) { + const mutleft = [...left]; + const mutright = [...right]; + let topleft = mutleft.pop(); + let topright = mutright.pop(); + while ((0, specs_1.bytesEqual)(topleft.prefix, topright.prefix) && + (0, specs_1.bytesEqual)(topleft.suffix, topright.suffix)) { + topleft = mutleft.pop(); + topright = mutright.pop(); + } + // now topleft and topright are the first divergent nodes + // make sure they are left and right of each other + if (!isLeftStep(spec, topleft, topright)) { + throw new Error(`Not left neightbor at first divergent step`); + } + // make sure the paths are left and right most possibilities respectively + ensureRightMost(spec, mutleft); + ensureLeftMost(spec, mutright); +} +exports.ensureLeftNeighbor = ensureLeftNeighbor; +// isLeftStep assumes left and right have common parents +// checks if left is exactly one slot to the left of right +function isLeftStep(spec, left, right) { + const leftidx = orderFromPadding(spec, left); + const rightidx = orderFromPadding(spec, right); + return rightidx === leftidx + 1; +} +function orderFromPadding(spec, inner) { + for (let branch = 0; branch < spec.childOrder.length; branch++) { + const { minPrefix, maxPrefix, suffix } = getPadding(spec, branch); + if (hasPadding(inner, minPrefix, maxPrefix, suffix)) { + return branch; + } + } + throw new Error(`Cannot find any valid spacing for this node`); +} +function hasPadding(op, minPrefix, maxPrefix, suffix) { + if ((op.prefix || []).length < minPrefix) { + return false; + } + if ((op.prefix || []).length > maxPrefix) { + return false; + } + return (op.suffix || []).length === suffix; +} +function getPadding(spec, branch) { + const idx = getPosition(spec.childOrder, branch); + // count how many children are in the prefix + const prefix = idx * spec.childSize; + const minPrefix = prefix + spec.minPrefixLength; + const maxPrefix = prefix + spec.maxPrefixLength; + // count how many children are in the suffix + const suffix = (spec.childOrder.length - 1 - idx) * spec.childSize; + return { minPrefix, maxPrefix, suffix }; +} +function getPosition(order, branch) { + if (branch < 0 || branch >= order.length) { + throw new Error(`Invalid branch: ${branch}`); + } + return order.findIndex((val) => val === branch); +} +//# sourceMappingURL=proofs.js.map + +/***/ }), + +/***/ "./node_modules/@confio/ics23/build/specs.js": +/*!***************************************************!*\ + !*** ./node_modules/@confio/ics23/build/specs.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.bytesBefore = exports.ensureBytesBefore = exports.bytesEqual = exports.ensureBytesEqual = exports.ensureInner = exports.ensureLeaf = void 0; +function ensureLeaf(leaf, spec) { + if (leaf.hash !== spec.hash) { + throw new Error(`Unexpected hashOp: ${leaf.hash}`); + } + if (leaf.prehashKey !== spec.prehashKey) { + throw new Error(`Unexpected prehashKey: ${leaf.prehashKey}`); + } + if (leaf.prehashValue !== spec.prehashValue) { + throw new Error(`Unexpected prehashValue: ${leaf.prehashValue}`); + } + if (leaf.length !== spec.length) { + throw new Error(`Unexpected length op: ${leaf.length}`); + } + ensurePrefix(leaf.prefix, spec.prefix); +} +exports.ensureLeaf = ensureLeaf; +function ensureInner(inner, prefix, spec) { + if (inner.hash !== spec.hash) { + throw new Error(`Unexpected hashOp: ${inner.hash}`); + } + if (!inner.prefix) { + throw new Error("No prefix set for inner node"); + } + if (hasPrefix(inner.prefix, prefix)) { + throw new Error(`Inner node has leaf prefix`); + } + if (inner.prefix.length < (spec.minPrefixLength || 0)) { + throw new Error(`Prefix too short: ${inner.prefix.length} bytes`); + } + const maxLeftChildBytes = (spec.childOrder.length - 1) * spec.childSize; + if (inner.prefix.length > (spec.maxPrefixLength || 0) + maxLeftChildBytes) { + throw new Error(`Prefix too long: ${inner.prefix.length} bytes`); + } +} +exports.ensureInner = ensureInner; +function ensurePrefix(check, prefix) { + // no prefix supplied, means everything passes + if (!prefix || prefix.length === 0) { + return; + } + if (!check) { + throw new Error(`Target bytes missing`); + } + ensureBytesEqual(prefix, check.slice(0, prefix.length)); +} +// ensureBytesEqual throws an error if the arrays are different +function ensureBytesEqual(a, b) { + if (a.length !== b.length) { + throw new Error(`Different lengths ${a.length} vs ${b.length}`); + } + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { + throw new Error(`Arrays differ at index ${i}: ${a[i]} vs ${b[i]}`); + } + } +} +exports.ensureBytesEqual = ensureBytesEqual; +function bytesEqual(a, b) { + if (a.length !== b.length) { + return false; + } + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { + return false; + } + } + return true; +} +exports.bytesEqual = bytesEqual; +function hasPrefix(check, prefix) { + // no prefix supplied, means everything passes + if (!prefix || prefix.length === 0) { + return false; + } + if (!check) { + return false; + } + if (check.length <= prefix.length) { + return false; + } + for (let i = 0; i < prefix.length; i++) { + if (check[i] !== prefix[i]) { + return false; + } + } + throw true; +} +// ensureBytesBefore throws an error if first >= last +// we compare byte by byte +function ensureBytesBefore(first, last) { + if (!bytesBefore(first, last)) { + throw new Error("first is after last"); + } +} +exports.ensureBytesBefore = ensureBytesBefore; +function bytesBefore(first, last) { + const min = first.length < last.length ? first.length : last.length; + for (let i = 0; i < min; i++) { + if (first[i] < last[i]) { + return true; + } + if (first[i] > last[i]) { + return false; + } + // if they are equal, continue to next step + } + // if they match, ensure that last is longer than first.. + return first.length < last.length; +} +exports.bytesBefore = bytesBefore; +//# sourceMappingURL=specs.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/addresses.js": +/*!*******************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/addresses.js ***! + \*******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +// See https://github.com/tendermint/tendermint/blob/f2ada0a604b4c0763bda2f64fac53d506d3beca7/docs/spec/blockchain/encoding.md#public-key-cryptography +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pubkeyToAddress = exports.pubkeyToRawAddress = exports.rawSecp256k1PubkeyToRawAddress = exports.rawEd25519PubkeyToRawAddress = void 0; +const crypto_1 = __webpack_require__(/*! @cosmjs/crypto */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js"); +const encoding_2 = __webpack_require__(/*! ./encoding */ "./node_modules/@cosmjs/amino/build/encoding.js"); +const pubkeys_1 = __webpack_require__(/*! ./pubkeys */ "./node_modules/@cosmjs/amino/build/pubkeys.js"); +function rawEd25519PubkeyToRawAddress(pubkeyData) { + if (pubkeyData.length !== 32) { + throw new Error(`Invalid Ed25519 pubkey length: ${pubkeyData.length}`); + } + return (0, crypto_1.sha256)(pubkeyData).slice(0, 20); +} +exports.rawEd25519PubkeyToRawAddress = rawEd25519PubkeyToRawAddress; +function rawSecp256k1PubkeyToRawAddress(pubkeyData) { + if (pubkeyData.length !== 33) { + throw new Error(`Invalid Secp256k1 pubkey length (compressed): ${pubkeyData.length}`); + } + return (0, crypto_1.ripemd160)((0, crypto_1.sha256)(pubkeyData)); +} +exports.rawSecp256k1PubkeyToRawAddress = rawSecp256k1PubkeyToRawAddress; +// For secp256k1 this assumes we already have a compressed pubkey. +function pubkeyToRawAddress(pubkey) { + if ((0, pubkeys_1.isSecp256k1Pubkey)(pubkey)) { + const pubkeyData = (0, encoding_1.fromBase64)(pubkey.value); + return rawSecp256k1PubkeyToRawAddress(pubkeyData); + } + else if ((0, pubkeys_1.isEd25519Pubkey)(pubkey)) { + const pubkeyData = (0, encoding_1.fromBase64)(pubkey.value); + return rawEd25519PubkeyToRawAddress(pubkeyData); + } + else if ((0, pubkeys_1.isMultisigThresholdPubkey)(pubkey)) { + // https://github.com/tendermint/tendermint/blob/38b401657e4ad7a7eeb3c30a3cbf512037df3740/crypto/multisig/threshold_pubkey.go#L71-L74 + const pubkeyData = (0, encoding_2.encodeAminoPubkey)(pubkey); + return (0, crypto_1.sha256)(pubkeyData).slice(0, 20); + } + else { + throw new Error("Unsupported public key type"); + } +} +exports.pubkeyToRawAddress = pubkeyToRawAddress; +function pubkeyToAddress(pubkey, prefix) { + return (0, encoding_1.toBech32)(prefix, pubkeyToRawAddress(pubkey)); +} +exports.pubkeyToAddress = pubkeyToAddress; +//# sourceMappingURL=addresses.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/coins.js": +/*!***************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/coins.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.addCoins = exports.parseCoins = exports.coins = exports.coin = void 0; +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/index.js"); +/** + * Creates a coin. + * + * If your values do not exceed the safe integer range of JS numbers (53 bit), + * you can use the number type here. This is the case for all typical Cosmos SDK + * chains that use the default 6 decimals. + * + * In case you need to supportr larger values, use unsigned integer strings instead. + */ +function coin(amount, denom) { + let outAmount; + if (typeof amount === "number") { + try { + outAmount = new math_1.Uint53(amount).toString(); + } + catch (_err) { + throw new Error("Given amount is not a safe integer. Consider using a string instead to overcome the limitations of JS numbers."); + } + } + else { + if (!amount.match(/^[0-9]+$/)) { + throw new Error("Invalid unsigned integer string format"); + } + outAmount = amount.replace(/^0*/, "") || "0"; + } + return { + amount: outAmount, + denom: denom, + }; +} +exports.coin = coin; +/** + * Creates a list of coins with one element. + */ +function coins(amount, denom) { + return [coin(amount, denom)]; +} +exports.coins = coins; +/** + * Takes a coins list like "819966000ucosm,700000000ustake" and parses it. + * + * A Stargate-ready variant of this function is available via: + * + * ``` + * import { parseCoins } from "@cosmjs/proto-signing"; + * // or + * import { parseCoins } from "@cosmjs/stargate"; + * ``` + */ +function parseCoins(input) { + return input + .replace(/\s/g, "") + .split(",") + .filter(Boolean) + .map((part) => { + const match = part.match(/^([0-9]+)([a-zA-Z]+)/); + if (!match) + throw new Error("Got an invalid coin string"); + return { + amount: match[1].replace(/^0+/, "") || "0", + denom: match[2], + }; + }); +} +exports.parseCoins = parseCoins; +/** + * Function to sum up coins with type Coin + */ +function addCoins(lhs, rhs) { + if (lhs.denom !== rhs.denom) + throw new Error("Trying to add two coins with different denoms"); + return { + amount: math_1.Decimal.fromAtomics(lhs.amount, 0).plus(math_1.Decimal.fromAtomics(rhs.amount, 0)).atomics, + denom: lhs.denom, + }; +} +exports.addCoins = addCoins; +//# sourceMappingURL=coins.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/encoding.js": +/*!******************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/encoding.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.encodeBech32Pubkey = exports.encodeAminoPubkey = exports.decodeBech32Pubkey = exports.decodeAminoPubkey = exports.encodeEd25519Pubkey = exports.encodeSecp256k1Pubkey = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js"); +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/index.js"); +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/index.js"); +const pubkeys_1 = __webpack_require__(/*! ./pubkeys */ "./node_modules/@cosmjs/amino/build/pubkeys.js"); +/** + * Takes a Secp256k1 public key as raw bytes and returns the Amino JSON + * representation of it (the type/value wrapper object). + */ +function encodeSecp256k1Pubkey(pubkey) { + if (pubkey.length !== 33 || (pubkey[0] !== 0x02 && pubkey[0] !== 0x03)) { + throw new Error("Public key must be compressed secp256k1, i.e. 33 bytes starting with 0x02 or 0x03"); + } + return { + type: pubkeys_1.pubkeyType.secp256k1, + value: (0, encoding_1.toBase64)(pubkey), + }; +} +exports.encodeSecp256k1Pubkey = encodeSecp256k1Pubkey; +/** + * Takes an Edd25519 public key as raw bytes and returns the Amino JSON + * representation of it (the type/value wrapper object). + */ +function encodeEd25519Pubkey(pubkey) { + if (pubkey.length !== 32) { + throw new Error("Ed25519 public key must be 32 bytes long"); + } + return { + type: pubkeys_1.pubkeyType.ed25519, + value: (0, encoding_1.toBase64)(pubkey), + }; +} +exports.encodeEd25519Pubkey = encodeEd25519Pubkey; +// As discussed in https://github.com/binance-chain/javascript-sdk/issues/163 +// Prefixes listed here: https://github.com/tendermint/tendermint/blob/d419fffe18531317c28c29a292ad7d253f6cafdf/docs/spec/blockchain/encoding.md#public-key-cryptography +// Last bytes is varint-encoded length prefix +const pubkeyAminoPrefixSecp256k1 = (0, encoding_1.fromHex)("eb5ae987" + "21" /* fixed length */); +const pubkeyAminoPrefixEd25519 = (0, encoding_1.fromHex)("1624de64" + "20" /* fixed length */); +const pubkeyAminoPrefixSr25519 = (0, encoding_1.fromHex)("0dfb1005" + "20" /* fixed length */); +/** See https://github.com/tendermint/tendermint/commit/38b401657e4ad7a7eeb3c30a3cbf512037df3740 */ +const pubkeyAminoPrefixMultisigThreshold = (0, encoding_1.fromHex)("22c1f7e2" /* variable length not included */); +/** + * Decodes a pubkey in the Amino binary format to a type/value object. + */ +function decodeAminoPubkey(data) { + if ((0, utils_1.arrayContentStartsWith)(data, pubkeyAminoPrefixSecp256k1)) { + const rest = data.slice(pubkeyAminoPrefixSecp256k1.length); + if (rest.length !== 33) { + throw new Error("Invalid rest data length. Expected 33 bytes (compressed secp256k1 pubkey)."); + } + return { + type: pubkeys_1.pubkeyType.secp256k1, + value: (0, encoding_1.toBase64)(rest), + }; + } + else if ((0, utils_1.arrayContentStartsWith)(data, pubkeyAminoPrefixEd25519)) { + const rest = data.slice(pubkeyAminoPrefixEd25519.length); + if (rest.length !== 32) { + throw new Error("Invalid rest data length. Expected 32 bytes (Ed25519 pubkey)."); + } + return { + type: pubkeys_1.pubkeyType.ed25519, + value: (0, encoding_1.toBase64)(rest), + }; + } + else if ((0, utils_1.arrayContentStartsWith)(data, pubkeyAminoPrefixSr25519)) { + const rest = data.slice(pubkeyAminoPrefixSr25519.length); + if (rest.length !== 32) { + throw new Error("Invalid rest data length. Expected 32 bytes (Sr25519 pubkey)."); + } + return { + type: pubkeys_1.pubkeyType.sr25519, + value: (0, encoding_1.toBase64)(rest), + }; + } + else if ((0, utils_1.arrayContentStartsWith)(data, pubkeyAminoPrefixMultisigThreshold)) { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + return decodeMultisigPubkey(data); + } + else { + throw new Error("Unsupported public key type. Amino data starts with: " + (0, encoding_1.toHex)(data.slice(0, 5))); + } +} +exports.decodeAminoPubkey = decodeAminoPubkey; +/** + * Decodes a bech32 pubkey to Amino binary, which is then decoded to a type/value object. + * The bech32 prefix is ignored and discareded. + * + * @param bechEncoded the bech32 encoded pubkey + */ +function decodeBech32Pubkey(bechEncoded) { + const { data } = (0, encoding_1.fromBech32)(bechEncoded); + return decodeAminoPubkey(data); +} +exports.decodeBech32Pubkey = decodeBech32Pubkey; +/** + * Uvarint decoder for Amino. + * @see https://github.com/tendermint/go-amino/blob/8e779b71f40d175/decoder.go#L64-76 + * @returns varint as number, and bytes count occupied by varaint + */ +function decodeUvarint(reader) { + if (reader.length < 1) { + throw new Error("Can't decode varint. EOF"); + } + if (reader[0] > 127) { + throw new Error("Decoding numbers > 127 is not supported here. Please tell those lazy CosmJS maintainers to port the binary.Varint implementation from the Go standard library and write some tests."); + } + return [reader[0], 1]; +} +/** + * Decodes a multisig pubkey to type object. + * Pubkey structure [ prefix + const + threshold + loop:(const + pubkeyLength + pubkey ) ] + * [ 4b + 1b + varint + loop:(1b + varint + pubkeyLength bytes) ] + * @param data encoded pubkey + */ +function decodeMultisigPubkey(data) { + const reader = Array.from(data); + // remove multisig amino prefix; + const prefixFromReader = reader.splice(0, pubkeyAminoPrefixMultisigThreshold.length); + if (!(0, utils_1.arrayContentStartsWith)(prefixFromReader, pubkeyAminoPrefixMultisigThreshold)) { + throw new Error("Invalid multisig prefix."); + } + // remove 0x08 threshold prefix; + if (reader.shift() != 0x08) { + throw new Error("Invalid multisig data. Expecting 0x08 prefix before threshold."); + } + // read threshold + const [threshold, thresholdBytesLength] = decodeUvarint(reader); + reader.splice(0, thresholdBytesLength); + // read participants pubkeys + const pubkeys = []; + while (reader.length > 0) { + // remove 0x12 threshold prefix; + if (reader.shift() != 0x12) { + throw new Error("Invalid multisig data. Expecting 0x12 prefix before participant pubkey length."); + } + // read pubkey length + const [pubkeyLength, pubkeyLengthBytesSize] = decodeUvarint(reader); + reader.splice(0, pubkeyLengthBytesSize); + // verify that we can read pubkey + if (reader.length < pubkeyLength) { + throw new Error("Invalid multisig data length."); + } + // read and decode participant pubkey + const encodedPubkey = reader.splice(0, pubkeyLength); + const pubkey = decodeAminoPubkey(Uint8Array.from(encodedPubkey)); + pubkeys.push(pubkey); + } + return { + type: pubkeys_1.pubkeyType.multisigThreshold, + value: { + threshold: threshold.toString(), + pubkeys: pubkeys, + }, + }; +} +/** + * Uvarint encoder for Amino. This is the same encoding as `binary.PutUvarint` from the Go + * standard library. + * + * @see https://github.com/tendermint/go-amino/blob/8e779b71f40d175/encoder.go#L77-L85 + */ +function encodeUvarint(value) { + const checked = math_1.Uint53.fromString(value.toString()).toNumber(); + if (checked > 127) { + throw new Error("Encoding numbers > 127 is not supported here. Please tell those lazy CosmJS maintainers to port the binary.PutUvarint implementation from the Go standard library and write some tests."); + } + return [checked]; +} +/** + * Encodes a public key to binary Amino. + */ +function encodeAminoPubkey(pubkey) { + if ((0, pubkeys_1.isMultisigThresholdPubkey)(pubkey)) { + const out = Array.from(pubkeyAminoPrefixMultisigThreshold); + out.push(0x08); // TODO: What is this? + out.push(...encodeUvarint(pubkey.value.threshold)); + for (const pubkeyData of pubkey.value.pubkeys.map((p) => encodeAminoPubkey(p))) { + out.push(0x12); // TODO: What is this? + out.push(...encodeUvarint(pubkeyData.length)); + out.push(...pubkeyData); + } + return new Uint8Array(out); + } + else if ((0, pubkeys_1.isEd25519Pubkey)(pubkey)) { + return new Uint8Array([...pubkeyAminoPrefixEd25519, ...(0, encoding_1.fromBase64)(pubkey.value)]); + } + else if ((0, pubkeys_1.isSecp256k1Pubkey)(pubkey)) { + return new Uint8Array([...pubkeyAminoPrefixSecp256k1, ...(0, encoding_1.fromBase64)(pubkey.value)]); + } + else { + throw new Error("Unsupported pubkey type"); + } +} +exports.encodeAminoPubkey = encodeAminoPubkey; +/** + * Encodes a public key to binary Amino and then to bech32. + * + * @param pubkey the public key to encode + * @param prefix the bech32 prefix (human readable part) + */ +function encodeBech32Pubkey(pubkey, prefix) { + return (0, encoding_1.toBech32)(prefix, encodeAminoPubkey(pubkey)); +} +exports.encodeBech32Pubkey = encodeBech32Pubkey; +//# sourceMappingURL=encoding.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/index.js": +/*!***************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/index.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.executeKdf = exports.makeStdTx = exports.isStdTx = exports.serializeSignDoc = exports.makeSignDoc = exports.encodeSecp256k1Signature = exports.decodeSignature = exports.Secp256k1Wallet = exports.Secp256k1HdWallet = exports.extractKdfConfiguration = exports.pubkeyType = exports.isSinglePubkey = exports.isSecp256k1Pubkey = exports.isMultisigThresholdPubkey = exports.isEd25519Pubkey = exports.makeCosmoshubPath = exports.createMultisigThresholdPubkey = exports.encodeSecp256k1Pubkey = exports.encodeEd25519Pubkey = exports.encodeBech32Pubkey = exports.encodeAminoPubkey = exports.decodeBech32Pubkey = exports.decodeAminoPubkey = exports.parseCoins = exports.coins = exports.coin = exports.addCoins = exports.rawSecp256k1PubkeyToRawAddress = exports.rawEd25519PubkeyToRawAddress = exports.pubkeyToRawAddress = exports.pubkeyToAddress = void 0; +var addresses_1 = __webpack_require__(/*! ./addresses */ "./node_modules/@cosmjs/amino/build/addresses.js"); +Object.defineProperty(exports, "pubkeyToAddress", ({ enumerable: true, get: function () { return addresses_1.pubkeyToAddress; } })); +Object.defineProperty(exports, "pubkeyToRawAddress", ({ enumerable: true, get: function () { return addresses_1.pubkeyToRawAddress; } })); +Object.defineProperty(exports, "rawEd25519PubkeyToRawAddress", ({ enumerable: true, get: function () { return addresses_1.rawEd25519PubkeyToRawAddress; } })); +Object.defineProperty(exports, "rawSecp256k1PubkeyToRawAddress", ({ enumerable: true, get: function () { return addresses_1.rawSecp256k1PubkeyToRawAddress; } })); +var coins_1 = __webpack_require__(/*! ./coins */ "./node_modules/@cosmjs/amino/build/coins.js"); +Object.defineProperty(exports, "addCoins", ({ enumerable: true, get: function () { return coins_1.addCoins; } })); +Object.defineProperty(exports, "coin", ({ enumerable: true, get: function () { return coins_1.coin; } })); +Object.defineProperty(exports, "coins", ({ enumerable: true, get: function () { return coins_1.coins; } })); +Object.defineProperty(exports, "parseCoins", ({ enumerable: true, get: function () { return coins_1.parseCoins; } })); +var encoding_1 = __webpack_require__(/*! ./encoding */ "./node_modules/@cosmjs/amino/build/encoding.js"); +Object.defineProperty(exports, "decodeAminoPubkey", ({ enumerable: true, get: function () { return encoding_1.decodeAminoPubkey; } })); +Object.defineProperty(exports, "decodeBech32Pubkey", ({ enumerable: true, get: function () { return encoding_1.decodeBech32Pubkey; } })); +Object.defineProperty(exports, "encodeAminoPubkey", ({ enumerable: true, get: function () { return encoding_1.encodeAminoPubkey; } })); +Object.defineProperty(exports, "encodeBech32Pubkey", ({ enumerable: true, get: function () { return encoding_1.encodeBech32Pubkey; } })); +Object.defineProperty(exports, "encodeEd25519Pubkey", ({ enumerable: true, get: function () { return encoding_1.encodeEd25519Pubkey; } })); +Object.defineProperty(exports, "encodeSecp256k1Pubkey", ({ enumerable: true, get: function () { return encoding_1.encodeSecp256k1Pubkey; } })); +var multisig_1 = __webpack_require__(/*! ./multisig */ "./node_modules/@cosmjs/amino/build/multisig.js"); +Object.defineProperty(exports, "createMultisigThresholdPubkey", ({ enumerable: true, get: function () { return multisig_1.createMultisigThresholdPubkey; } })); +var paths_1 = __webpack_require__(/*! ./paths */ "./node_modules/@cosmjs/amino/build/paths.js"); +Object.defineProperty(exports, "makeCosmoshubPath", ({ enumerable: true, get: function () { return paths_1.makeCosmoshubPath; } })); +var pubkeys_1 = __webpack_require__(/*! ./pubkeys */ "./node_modules/@cosmjs/amino/build/pubkeys.js"); +Object.defineProperty(exports, "isEd25519Pubkey", ({ enumerable: true, get: function () { return pubkeys_1.isEd25519Pubkey; } })); +Object.defineProperty(exports, "isMultisigThresholdPubkey", ({ enumerable: true, get: function () { return pubkeys_1.isMultisigThresholdPubkey; } })); +Object.defineProperty(exports, "isSecp256k1Pubkey", ({ enumerable: true, get: function () { return pubkeys_1.isSecp256k1Pubkey; } })); +Object.defineProperty(exports, "isSinglePubkey", ({ enumerable: true, get: function () { return pubkeys_1.isSinglePubkey; } })); +Object.defineProperty(exports, "pubkeyType", ({ enumerable: true, get: function () { return pubkeys_1.pubkeyType; } })); +var secp256k1hdwallet_1 = __webpack_require__(/*! ./secp256k1hdwallet */ "./node_modules/@cosmjs/amino/build/secp256k1hdwallet.js"); +Object.defineProperty(exports, "extractKdfConfiguration", ({ enumerable: true, get: function () { return secp256k1hdwallet_1.extractKdfConfiguration; } })); +Object.defineProperty(exports, "Secp256k1HdWallet", ({ enumerable: true, get: function () { return secp256k1hdwallet_1.Secp256k1HdWallet; } })); +var secp256k1wallet_1 = __webpack_require__(/*! ./secp256k1wallet */ "./node_modules/@cosmjs/amino/build/secp256k1wallet.js"); +Object.defineProperty(exports, "Secp256k1Wallet", ({ enumerable: true, get: function () { return secp256k1wallet_1.Secp256k1Wallet; } })); +var signature_1 = __webpack_require__(/*! ./signature */ "./node_modules/@cosmjs/amino/build/signature.js"); +Object.defineProperty(exports, "decodeSignature", ({ enumerable: true, get: function () { return signature_1.decodeSignature; } })); +Object.defineProperty(exports, "encodeSecp256k1Signature", ({ enumerable: true, get: function () { return signature_1.encodeSecp256k1Signature; } })); +var signdoc_1 = __webpack_require__(/*! ./signdoc */ "./node_modules/@cosmjs/amino/build/signdoc.js"); +Object.defineProperty(exports, "makeSignDoc", ({ enumerable: true, get: function () { return signdoc_1.makeSignDoc; } })); +Object.defineProperty(exports, "serializeSignDoc", ({ enumerable: true, get: function () { return signdoc_1.serializeSignDoc; } })); +var stdtx_1 = __webpack_require__(/*! ./stdtx */ "./node_modules/@cosmjs/amino/build/stdtx.js"); +Object.defineProperty(exports, "isStdTx", ({ enumerable: true, get: function () { return stdtx_1.isStdTx; } })); +Object.defineProperty(exports, "makeStdTx", ({ enumerable: true, get: function () { return stdtx_1.makeStdTx; } })); +var wallet_1 = __webpack_require__(/*! ./wallet */ "./node_modules/@cosmjs/amino/build/wallet.js"); +Object.defineProperty(exports, "executeKdf", ({ enumerable: true, get: function () { return wallet_1.executeKdf; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/multisig.js": +/*!******************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/multisig.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createMultisigThresholdPubkey = exports.compareArrays = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js"); +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/index.js"); +const addresses_1 = __webpack_require__(/*! ./addresses */ "./node_modules/@cosmjs/amino/build/addresses.js"); +/** + * Compare arrays lexicographically. + * + * Returns value < 0 if `a < b`. + * Returns value > 0 if `a > b`. + * Returns 0 if `a === b`. + */ +function compareArrays(a, b) { + const aHex = (0, encoding_1.toHex)(a); + const bHex = (0, encoding_1.toHex)(b); + return aHex === bHex ? 0 : aHex < bHex ? -1 : 1; +} +exports.compareArrays = compareArrays; +function createMultisigThresholdPubkey(pubkeys, threshold, nosort = false) { + const uintThreshold = new math_1.Uint53(threshold); + if (uintThreshold.toNumber() > pubkeys.length) { + throw new Error(`Threshold k = ${uintThreshold.toNumber()} exceeds number of keys n = ${pubkeys.length}`); + } + const outPubkeys = nosort + ? pubkeys + : Array.from(pubkeys).sort((lhs, rhs) => { + // https://github.com/cosmos/cosmos-sdk/blob/v0.42.2/client/keys/add.go#L172-L174 + const addressLhs = (0, addresses_1.pubkeyToRawAddress)(lhs); + const addressRhs = (0, addresses_1.pubkeyToRawAddress)(rhs); + return compareArrays(addressLhs, addressRhs); + }); + return { + type: "tendermint/PubKeyMultisigThreshold", + value: { + threshold: uintThreshold.toString(), + pubkeys: outPubkeys, + }, + }; +} +exports.createMultisigThresholdPubkey = createMultisigThresholdPubkey; +//# sourceMappingURL=multisig.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/paths.js": +/*!***************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/paths.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.makeCosmoshubPath = void 0; +const crypto_1 = __webpack_require__(/*! @cosmjs/crypto */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/index.js"); +/** + * The Cosmos Hub derivation path in the form `m/44'/118'/0'/0/a` + * with 0-based account index `a`. + */ +function makeCosmoshubPath(a) { + return [ + crypto_1.Slip10RawIndex.hardened(44), + crypto_1.Slip10RawIndex.hardened(118), + crypto_1.Slip10RawIndex.hardened(0), + crypto_1.Slip10RawIndex.normal(0), + crypto_1.Slip10RawIndex.normal(a), + ]; +} +exports.makeCosmoshubPath = makeCosmoshubPath; +//# sourceMappingURL=paths.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/pubkeys.js": +/*!*****************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/pubkeys.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isMultisigThresholdPubkey = exports.isSinglePubkey = exports.pubkeyType = exports.isSecp256k1Pubkey = exports.isEd25519Pubkey = void 0; +function isEd25519Pubkey(pubkey) { + return pubkey.type === "tendermint/PubKeyEd25519"; +} +exports.isEd25519Pubkey = isEd25519Pubkey; +function isSecp256k1Pubkey(pubkey) { + return pubkey.type === "tendermint/PubKeySecp256k1"; +} +exports.isSecp256k1Pubkey = isSecp256k1Pubkey; +exports.pubkeyType = { + /** @see https://github.com/tendermint/tendermint/blob/v0.33.0/crypto/ed25519/ed25519.go#L22 */ + secp256k1: "tendermint/PubKeySecp256k1", + /** @see https://github.com/tendermint/tendermint/blob/v0.33.0/crypto/secp256k1/secp256k1.go#L23 */ + ed25519: "tendermint/PubKeyEd25519", + /** @see https://github.com/tendermint/tendermint/blob/v0.33.0/crypto/sr25519/codec.go#L12 */ + sr25519: "tendermint/PubKeySr25519", + multisigThreshold: "tendermint/PubKeyMultisigThreshold", +}; +function isSinglePubkey(pubkey) { + const singPubkeyTypes = [exports.pubkeyType.ed25519, exports.pubkeyType.secp256k1, exports.pubkeyType.sr25519]; + return singPubkeyTypes.includes(pubkey.type); +} +exports.isSinglePubkey = isSinglePubkey; +function isMultisigThresholdPubkey(pubkey) { + return pubkey.type === "tendermint/PubKeyMultisigThreshold"; +} +exports.isMultisigThresholdPubkey = isMultisigThresholdPubkey; +//# sourceMappingURL=pubkeys.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/secp256k1hdwallet.js": +/*!***************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/secp256k1hdwallet.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Secp256k1HdWallet = exports.extractKdfConfiguration = void 0; +const crypto_1 = __webpack_require__(/*! @cosmjs/crypto */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js"); +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/index.js"); +const addresses_1 = __webpack_require__(/*! ./addresses */ "./node_modules/@cosmjs/amino/build/addresses.js"); +const paths_1 = __webpack_require__(/*! ./paths */ "./node_modules/@cosmjs/amino/build/paths.js"); +const signature_1 = __webpack_require__(/*! ./signature */ "./node_modules/@cosmjs/amino/build/signature.js"); +const signdoc_1 = __webpack_require__(/*! ./signdoc */ "./node_modules/@cosmjs/amino/build/signdoc.js"); +const wallet_1 = __webpack_require__(/*! ./wallet */ "./node_modules/@cosmjs/amino/build/wallet.js"); +const serializationTypeV1 = "secp256k1wallet-v1"; +/** + * A KDF configuration that is not very strong but can be used on the main thread. + * It takes about 1 second in Node.js 16.0.0 and should have similar runtimes in other modern Wasm hosts. + */ +const basicPasswordHashingOptions = { + algorithm: "argon2id", + params: { + outputLength: 32, + opsLimit: 24, + memLimitKib: 12 * 1024, + }, +}; +function isDerivationJson(thing) { + if (!(0, utils_1.isNonNullObject)(thing)) + return false; + if (typeof thing.hdPath !== "string") + return false; + if (typeof thing.prefix !== "string") + return false; + return true; +} +function extractKdfConfigurationV1(doc) { + return doc.kdf; +} +function extractKdfConfiguration(serialization) { + const root = JSON.parse(serialization); + if (!(0, utils_1.isNonNullObject)(root)) + throw new Error("Root document is not an object."); + switch (root.type) { + case serializationTypeV1: + return extractKdfConfigurationV1(root); + default: + throw new Error("Unsupported serialization type"); + } +} +exports.extractKdfConfiguration = extractKdfConfiguration; +const defaultOptions = { + bip39Password: "", + hdPaths: [(0, paths_1.makeCosmoshubPath)(0)], + prefix: "cosmos", +}; +class Secp256k1HdWallet { + constructor(mnemonic, options) { + const hdPaths = options.hdPaths ?? defaultOptions.hdPaths; + const prefix = options.prefix ?? defaultOptions.prefix; + this.secret = mnemonic; + this.seed = options.seed; + this.accounts = hdPaths.map((hdPath) => ({ + hdPath: hdPath, + prefix, + })); + } + /** + * Restores a wallet from the given BIP39 mnemonic. + * + * @param mnemonic Any valid English mnemonic. + * @param options An optional `Secp256k1HdWalletOptions` object optionally containing a bip39Password, hdPaths, and prefix. + */ + static async fromMnemonic(mnemonic, options = {}) { + const mnemonicChecked = new crypto_1.EnglishMnemonic(mnemonic); + const seed = await crypto_1.Bip39.mnemonicToSeed(mnemonicChecked, options.bip39Password); + return new Secp256k1HdWallet(mnemonicChecked, { + ...options, + seed: seed, + }); + } + /** + * Generates a new wallet with a BIP39 mnemonic of the given length. + * + * @param length The number of words in the mnemonic (12, 15, 18, 21 or 24). + * @param options An optional `Secp256k1HdWalletOptions` object optionally containing a bip39Password, hdPaths, and prefix. + */ + static async generate(length = 12, options = {}) { + const entropyLength = 4 * Math.floor((11 * length) / 33); + const entropy = crypto_1.Random.getBytes(entropyLength); + const mnemonic = crypto_1.Bip39.encode(entropy); + return Secp256k1HdWallet.fromMnemonic(mnemonic.toString(), options); + } + /** + * Restores a wallet from an encrypted serialization. + * + * @param password The user provided password used to generate an encryption key via a KDF. + * This is not normalized internally (see "Unicode normalization" to learn more). + */ + static async deserialize(serialization, password) { + const root = JSON.parse(serialization); + if (!(0, utils_1.isNonNullObject)(root)) + throw new Error("Root document is not an object."); + switch (root.type) { + case serializationTypeV1: + return Secp256k1HdWallet.deserializeTypeV1(serialization, password); + default: + throw new Error("Unsupported serialization type"); + } + } + /** + * Restores a wallet from an encrypted serialization. + * + * This is an advanced alternative to calling `deserialize(serialization, password)` directly, which allows + * you to offload the KDF execution to a non-UI thread (e.g. in a WebWorker). + * + * The caller is responsible for ensuring the key was derived with the given KDF configuration. This can be + * done using `extractKdfConfiguration(serialization)` and `executeKdf(password, kdfConfiguration)` from this package. + */ + static async deserializeWithEncryptionKey(serialization, encryptionKey) { + const root = JSON.parse(serialization); + if (!(0, utils_1.isNonNullObject)(root)) + throw new Error("Root document is not an object."); + const untypedRoot = root; + switch (untypedRoot.type) { + case serializationTypeV1: { + const decryptedBytes = await (0, wallet_1.decrypt)((0, encoding_1.fromBase64)(untypedRoot.data), encryptionKey, untypedRoot.encryption); + const decryptedDocument = JSON.parse((0, encoding_1.fromUtf8)(decryptedBytes)); + const { mnemonic, accounts } = decryptedDocument; + (0, utils_1.assert)(typeof mnemonic === "string"); + if (!Array.isArray(accounts)) + throw new Error("Property 'accounts' is not an array"); + if (!accounts.every((account) => isDerivationJson(account))) { + throw new Error("Account is not in the correct format."); + } + const firstPrefix = accounts[0].prefix; + if (!accounts.every(({ prefix }) => prefix === firstPrefix)) { + throw new Error("Accounts do not all have the same prefix"); + } + const hdPaths = accounts.map(({ hdPath }) => (0, crypto_1.stringToPath)(hdPath)); + return Secp256k1HdWallet.fromMnemonic(mnemonic, { + hdPaths: hdPaths, + prefix: firstPrefix, + }); + } + default: + throw new Error("Unsupported serialization type"); + } + } + static async deserializeTypeV1(serialization, password) { + const root = JSON.parse(serialization); + if (!(0, utils_1.isNonNullObject)(root)) + throw new Error("Root document is not an object."); + const encryptionKey = await (0, wallet_1.executeKdf)(password, root.kdf); + return Secp256k1HdWallet.deserializeWithEncryptionKey(serialization, encryptionKey); + } + get mnemonic() { + return this.secret.toString(); + } + async getAccounts() { + const accountsWithPrivkeys = await this.getAccountsWithPrivkeys(); + return accountsWithPrivkeys.map(({ algo, pubkey, address }) => ({ + algo: algo, + pubkey: pubkey, + address: address, + })); + } + async signAmino(signerAddress, signDoc) { + const accounts = await this.getAccountsWithPrivkeys(); + const account = accounts.find(({ address }) => address === signerAddress); + if (account === undefined) { + throw new Error(`Address ${signerAddress} not found in wallet`); + } + const { privkey, pubkey } = account; + const message = (0, crypto_1.sha256)((0, signdoc_1.serializeSignDoc)(signDoc)); + const signature = await crypto_1.Secp256k1.createSignature(message, privkey); + const signatureBytes = new Uint8Array([...signature.r(32), ...signature.s(32)]); + return { + signed: signDoc, + signature: (0, signature_1.encodeSecp256k1Signature)(pubkey, signatureBytes), + }; + } + /** + * Generates an encrypted serialization of this wallet. + * + * @param password The user provided password used to generate an encryption key via a KDF. + * This is not normalized internally (see "Unicode normalization" to learn more). + */ + async serialize(password) { + const kdfConfiguration = basicPasswordHashingOptions; + const encryptionKey = await (0, wallet_1.executeKdf)(password, kdfConfiguration); + return this.serializeWithEncryptionKey(encryptionKey, kdfConfiguration); + } + /** + * Generates an encrypted serialization of this wallet. + * + * This is an advanced alternative to calling `serialize(password)` directly, which allows you to + * offload the KDF execution to a non-UI thread (e.g. in a WebWorker). + * + * The caller is responsible for ensuring the key was derived with the given KDF options. If this + * is not the case, the wallet cannot be restored with the original password. + */ + async serializeWithEncryptionKey(encryptionKey, kdfConfiguration) { + const dataToEncrypt = { + mnemonic: this.mnemonic, + accounts: this.accounts.map(({ hdPath, prefix }) => ({ + hdPath: (0, crypto_1.pathToString)(hdPath), + prefix: prefix, + })), + }; + const dataToEncryptRaw = (0, encoding_1.toUtf8)(JSON.stringify(dataToEncrypt)); + const encryptionConfiguration = { + algorithm: wallet_1.supportedAlgorithms.xchacha20poly1305Ietf, + }; + const encryptedData = await (0, wallet_1.encrypt)(dataToEncryptRaw, encryptionKey, encryptionConfiguration); + const out = { + type: serializationTypeV1, + kdf: kdfConfiguration, + encryption: encryptionConfiguration, + data: (0, encoding_1.toBase64)(encryptedData), + }; + return JSON.stringify(out); + } + async getKeyPair(hdPath) { + const { privkey } = crypto_1.Slip10.derivePath(crypto_1.Slip10Curve.Secp256k1, this.seed, hdPath); + const { pubkey } = await crypto_1.Secp256k1.makeKeypair(privkey); + return { + privkey: privkey, + pubkey: crypto_1.Secp256k1.compressPubkey(pubkey), + }; + } + async getAccountsWithPrivkeys() { + return Promise.all(this.accounts.map(async ({ hdPath, prefix }) => { + const { privkey, pubkey } = await this.getKeyPair(hdPath); + const address = (0, encoding_1.toBech32)(prefix, (0, addresses_1.rawSecp256k1PubkeyToRawAddress)(pubkey)); + return { + algo: "secp256k1", + privkey: privkey, + pubkey: pubkey, + address: address, + }; + })); + } +} +exports.Secp256k1HdWallet = Secp256k1HdWallet; +//# sourceMappingURL=secp256k1hdwallet.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/secp256k1wallet.js": +/*!*************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/secp256k1wallet.js ***! + \*************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Secp256k1Wallet = void 0; +const crypto_1 = __webpack_require__(/*! @cosmjs/crypto */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js"); +const addresses_1 = __webpack_require__(/*! ./addresses */ "./node_modules/@cosmjs/amino/build/addresses.js"); +const signature_1 = __webpack_require__(/*! ./signature */ "./node_modules/@cosmjs/amino/build/signature.js"); +const signdoc_1 = __webpack_require__(/*! ./signdoc */ "./node_modules/@cosmjs/amino/build/signdoc.js"); +/** + * A wallet that holds a single secp256k1 keypair. + * + * If you want to work with BIP39 mnemonics and multiple accounts, use Secp256k1HdWallet. + */ +class Secp256k1Wallet { + constructor(privkey, pubkey, prefix) { + this.privkey = privkey; + this.pubkey = pubkey; + this.prefix = prefix; + } + /** + * Creates a Secp256k1Wallet from the given private key + * + * @param privkey The private key. + * @param prefix The bech32 address prefix (human readable part). Defaults to "cosmos". + */ + static async fromKey(privkey, prefix = "cosmos") { + const uncompressed = (await crypto_1.Secp256k1.makeKeypair(privkey)).pubkey; + return new Secp256k1Wallet(privkey, crypto_1.Secp256k1.compressPubkey(uncompressed), prefix); + } + get address() { + return (0, encoding_1.toBech32)(this.prefix, (0, addresses_1.rawSecp256k1PubkeyToRawAddress)(this.pubkey)); + } + async getAccounts() { + return [ + { + algo: "secp256k1", + address: this.address, + pubkey: this.pubkey, + }, + ]; + } + async signAmino(signerAddress, signDoc) { + if (signerAddress !== this.address) { + throw new Error(`Address ${signerAddress} not found in wallet`); + } + const message = new crypto_1.Sha256((0, signdoc_1.serializeSignDoc)(signDoc)).digest(); + const signature = await crypto_1.Secp256k1.createSignature(message, this.privkey); + const signatureBytes = new Uint8Array([...signature.r(32), ...signature.s(32)]); + return { + signed: signDoc, + signature: (0, signature_1.encodeSecp256k1Signature)(this.pubkey, signatureBytes), + }; + } +} +exports.Secp256k1Wallet = Secp256k1Wallet; +//# sourceMappingURL=secp256k1wallet.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/signature.js": +/*!*******************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/signature.js ***! + \*******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.decodeSignature = exports.encodeSecp256k1Signature = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js"); +const encoding_2 = __webpack_require__(/*! ./encoding */ "./node_modules/@cosmjs/amino/build/encoding.js"); +const pubkeys_1 = __webpack_require__(/*! ./pubkeys */ "./node_modules/@cosmjs/amino/build/pubkeys.js"); +/** + * Takes a binary pubkey and signature to create a signature object + * + * @param pubkey a compressed secp256k1 public key + * @param signature a 64 byte fixed length representation of secp256k1 signature components r and s + */ +function encodeSecp256k1Signature(pubkey, signature) { + if (signature.length !== 64) { + throw new Error("Signature must be 64 bytes long. Cosmos SDK uses a 2x32 byte fixed length encoding for the secp256k1 signature integers r and s."); + } + return { + pub_key: (0, encoding_2.encodeSecp256k1Pubkey)(pubkey), + signature: (0, encoding_1.toBase64)(signature), + }; +} +exports.encodeSecp256k1Signature = encodeSecp256k1Signature; +function decodeSignature(signature) { + switch (signature.pub_key.type) { + // Note: please don't add cases here without writing additional unit tests + case pubkeys_1.pubkeyType.secp256k1: + return { + pubkey: (0, encoding_1.fromBase64)(signature.pub_key.value), + signature: (0, encoding_1.fromBase64)(signature.signature), + }; + default: + throw new Error("Unsupported pubkey type"); + } +} +exports.decodeSignature = decodeSignature; +//# sourceMappingURL=signature.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/signdoc.js": +/*!*****************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/signdoc.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.serializeSignDoc = exports.escapeCharacters = exports.makeSignDoc = exports.sortedJsonStringify = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js"); +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/index.js"); +function sortedObject(obj) { + if (typeof obj !== "object" || obj === null) { + return obj; + } + if (Array.isArray(obj)) { + return obj.map(sortedObject); + } + const sortedKeys = Object.keys(obj).sort(); + const result = {}; + // NOTE: Use forEach instead of reduce for performance with large objects eg Wasm code + sortedKeys.forEach((key) => { + result[key] = sortedObject(obj[key]); + }); + return result; +} +/** Returns a JSON string with objects sorted by key */ +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function sortedJsonStringify(obj) { + return JSON.stringify(sortedObject(obj)); +} +exports.sortedJsonStringify = sortedJsonStringify; +function makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence) { + return { + chain_id: chainId, + account_number: math_1.Uint53.fromString(accountNumber.toString()).toString(), + sequence: math_1.Uint53.fromString(sequence.toString()).toString(), + fee: fee, + msgs: msgs, + memo: memo || "", + }; +} +exports.makeSignDoc = makeSignDoc; +/** + * Takes a valid JSON document and performs the following escapings in string values: + * + * `&` -> `\u0026` + * `<` -> `\u003c` + * `>` -> `\u003e` + * + * Since those characters do not occur in other places of the JSON document, only + * string values are affected. + * + * If the input is invalid JSON, the behaviour is undefined. + */ +function escapeCharacters(input) { + // When we migrate to target es2021 or above, we can use replaceAll instead of global patterns. + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll + const amp = /&/g; + const lt = //g; + return input.replace(amp, "\\u0026").replace(lt, "\\u003c").replace(gt, "\\u003e"); +} +exports.escapeCharacters = escapeCharacters; +function serializeSignDoc(signDoc) { + const serialized = escapeCharacters(sortedJsonStringify(signDoc)); + return (0, encoding_1.toUtf8)(serialized); +} +exports.serializeSignDoc = serializeSignDoc; +//# sourceMappingURL=signdoc.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/stdtx.js": +/*!***************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/stdtx.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.makeStdTx = exports.isStdTx = void 0; +function isStdTx(txValue) { + const { memo, msg, fee, signatures } = txValue; + return (typeof memo === "string" && Array.isArray(msg) && typeof fee === "object" && Array.isArray(signatures)); +} +exports.isStdTx = isStdTx; +function makeStdTx(content, signatures) { + return { + msg: content.msgs, + fee: content.fee, + memo: content.memo, + signatures: Array.isArray(signatures) ? signatures : [signatures], + }; +} +exports.makeStdTx = makeStdTx; +//# sourceMappingURL=stdtx.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/build/wallet.js": +/*!****************************************************!*\ + !*** ./node_modules/@cosmjs/amino/build/wallet.js ***! + \****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.decrypt = exports.encrypt = exports.supportedAlgorithms = exports.executeKdf = exports.cosmjsSalt = void 0; +const crypto_1 = __webpack_require__(/*! @cosmjs/crypto */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js"); +/** + * A fixed salt is chosen to archive a deterministic password to key derivation. + * This reduces the scope of a potential rainbow attack to all CosmJS users. + * Must be 16 bytes due to implementation limitations. + */ +exports.cosmjsSalt = (0, encoding_1.toAscii)("The CosmJS salt."); +async function executeKdf(password, configuration) { + switch (configuration.algorithm) { + case "argon2id": { + const options = configuration.params; + if (!(0, crypto_1.isArgon2idOptions)(options)) + throw new Error("Invalid format of argon2id params"); + return crypto_1.Argon2id.execute(password, exports.cosmjsSalt, options); + } + default: + throw new Error("Unsupported KDF algorithm"); + } +} +exports.executeKdf = executeKdf; +exports.supportedAlgorithms = { + xchacha20poly1305Ietf: "xchacha20poly1305-ietf", +}; +async function encrypt(plaintext, encryptionKey, config) { + switch (config.algorithm) { + case exports.supportedAlgorithms.xchacha20poly1305Ietf: { + const nonce = crypto_1.Random.getBytes(crypto_1.xchacha20NonceLength); + // Prepend fixed-length nonce to ciphertext as suggested in the example from https://github.com/jedisct1/libsodium.js#api + return new Uint8Array([ + ...nonce, + ...(await crypto_1.Xchacha20poly1305Ietf.encrypt(plaintext, encryptionKey, nonce)), + ]); + } + default: + throw new Error(`Unsupported encryption algorithm: '${config.algorithm}'`); + } +} +exports.encrypt = encrypt; +async function decrypt(ciphertext, encryptionKey, config) { + switch (config.algorithm) { + case exports.supportedAlgorithms.xchacha20poly1305Ietf: { + const nonce = ciphertext.slice(0, crypto_1.xchacha20NonceLength); + return crypto_1.Xchacha20poly1305Ietf.decrypt(ciphertext.slice(crypto_1.xchacha20NonceLength), encryptionKey, nonce); + } + default: + throw new Error(`Unsupported encryption algorithm: '${config.algorithm}'`); + } +} +exports.decrypt = decrypt; +//# sourceMappingURL=wallet.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/bip39.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/bip39.js ***! + \*******************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Bip39 = exports.EnglishMnemonic = exports.mnemonicToEntropy = exports.entropyToMnemonic = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js"); +const pbkdf2_1 = __webpack_require__(/*! ./pbkdf2 */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/pbkdf2.js"); +const sha_1 = __webpack_require__(/*! ./sha */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/sha.js"); +const wordlist = [ + "abandon", + "ability", + "able", + "about", + "above", + "absent", + "absorb", + "abstract", + "absurd", + "abuse", + "access", + "accident", + "account", + "accuse", + "achieve", + "acid", + "acoustic", + "acquire", + "across", + "act", + "action", + "actor", + "actress", + "actual", + "adapt", + "add", + "addict", + "address", + "adjust", + "admit", + "adult", + "advance", + "advice", + "aerobic", + "affair", + "afford", + "afraid", + "again", + "age", + "agent", + "agree", + "ahead", + "aim", + "air", + "airport", + "aisle", + "alarm", + "album", + "alcohol", + "alert", + "alien", + "all", + "alley", + "allow", + "almost", + "alone", + "alpha", + "already", + "also", + "alter", + "always", + "amateur", + "amazing", + "among", + "amount", + "amused", + "analyst", + "anchor", + "ancient", + "anger", + "angle", + "angry", + "animal", + "ankle", + "announce", + "annual", + "another", + "answer", + "antenna", + "antique", + "anxiety", + "any", + "apart", + "apology", + "appear", + "apple", + "approve", + "april", + "arch", + "arctic", + "area", + "arena", + "argue", + "arm", + "armed", + "armor", + "army", + "around", + "arrange", + "arrest", + "arrive", + "arrow", + "art", + "artefact", + "artist", + "artwork", + "ask", + "aspect", + "assault", + "asset", + "assist", + "assume", + "asthma", + "athlete", + "atom", + "attack", + "attend", + "attitude", + "attract", + "auction", + "audit", + "august", + "aunt", + "author", + "auto", + "autumn", + "average", + "avocado", + "avoid", + "awake", + "aware", + "away", + "awesome", + "awful", + "awkward", + "axis", + "baby", + "bachelor", + "bacon", + "badge", + "bag", + "balance", + "balcony", + "ball", + "bamboo", + "banana", + "banner", + "bar", + "barely", + "bargain", + "barrel", + "base", + "basic", + "basket", + "battle", + "beach", + "bean", + "beauty", + "because", + "become", + "beef", + "before", + "begin", + "behave", + "behind", + "believe", + "below", + "belt", + "bench", + "benefit", + "best", + "betray", + "better", + "between", + "beyond", + "bicycle", + "bid", + "bike", + "bind", + "biology", + "bird", + "birth", + "bitter", + "black", + "blade", + "blame", + "blanket", + "blast", + "bleak", + "bless", + "blind", + "blood", + "blossom", + "blouse", + "blue", + "blur", + "blush", + "board", + "boat", + "body", + "boil", + "bomb", + "bone", + "bonus", + "book", + "boost", + "border", + "boring", + "borrow", + "boss", + "bottom", + "bounce", + "box", + "boy", + "bracket", + "brain", + "brand", + "brass", + "brave", + "bread", + "breeze", + "brick", + "bridge", + "brief", + "bright", + "bring", + "brisk", + "broccoli", + "broken", + "bronze", + "broom", + "brother", + "brown", + "brush", + "bubble", + "buddy", + "budget", + "buffalo", + "build", + "bulb", + "bulk", + "bullet", + "bundle", + "bunker", + "burden", + "burger", + "burst", + "bus", + "business", + "busy", + "butter", + "buyer", + "buzz", + "cabbage", + "cabin", + "cable", + "cactus", + "cage", + "cake", + "call", + "calm", + "camera", + "camp", + "can", + "canal", + "cancel", + "candy", + "cannon", + "canoe", + "canvas", + "canyon", + "capable", + "capital", + "captain", + "car", + "carbon", + "card", + "cargo", + "carpet", + "carry", + "cart", + "case", + "cash", + "casino", + "castle", + "casual", + "cat", + "catalog", + "catch", + "category", + "cattle", + "caught", + "cause", + "caution", + "cave", + "ceiling", + "celery", + "cement", + "census", + "century", + "cereal", + "certain", + "chair", + "chalk", + "champion", + "change", + "chaos", + "chapter", + "charge", + "chase", + "chat", + "cheap", + "check", + "cheese", + "chef", + "cherry", + "chest", + "chicken", + "chief", + "child", + "chimney", + "choice", + "choose", + "chronic", + "chuckle", + "chunk", + "churn", + "cigar", + "cinnamon", + "circle", + "citizen", + "city", + "civil", + "claim", + "clap", + "clarify", + "claw", + "clay", + "clean", + "clerk", + "clever", + "click", + "client", + "cliff", + "climb", + "clinic", + "clip", + "clock", + "clog", + "close", + "cloth", + "cloud", + "clown", + "club", + "clump", + "cluster", + "clutch", + "coach", + "coast", + "coconut", + "code", + "coffee", + "coil", + "coin", + "collect", + "color", + "column", + "combine", + "come", + "comfort", + "comic", + "common", + "company", + "concert", + "conduct", + "confirm", + "congress", + "connect", + "consider", + "control", + "convince", + "cook", + "cool", + "copper", + "copy", + "coral", + "core", + "corn", + "correct", + "cost", + "cotton", + "couch", + "country", + "couple", + "course", + "cousin", + "cover", + "coyote", + "crack", + "cradle", + "craft", + "cram", + "crane", + "crash", + "crater", + "crawl", + "crazy", + "cream", + "credit", + "creek", + "crew", + "cricket", + "crime", + "crisp", + "critic", + "crop", + "cross", + "crouch", + "crowd", + "crucial", + "cruel", + "cruise", + "crumble", + "crunch", + "crush", + "cry", + "crystal", + "cube", + "culture", + "cup", + "cupboard", + "curious", + "current", + "curtain", + "curve", + "cushion", + "custom", + "cute", + "cycle", + "dad", + "damage", + "damp", + "dance", + "danger", + "daring", + "dash", + "daughter", + "dawn", + "day", + "deal", + "debate", + "debris", + "decade", + "december", + "decide", + "decline", + "decorate", + "decrease", + "deer", + "defense", + "define", + "defy", + "degree", + "delay", + "deliver", + "demand", + "demise", + "denial", + "dentist", + "deny", + "depart", + "depend", + "deposit", + "depth", + "deputy", + "derive", + "describe", + "desert", + "design", + "desk", + "despair", + "destroy", + "detail", + "detect", + "develop", + "device", + "devote", + "diagram", + "dial", + "diamond", + "diary", + "dice", + "diesel", + "diet", + "differ", + "digital", + "dignity", + "dilemma", + "dinner", + "dinosaur", + "direct", + "dirt", + "disagree", + "discover", + "disease", + "dish", + "dismiss", + "disorder", + "display", + "distance", + "divert", + "divide", + "divorce", + "dizzy", + "doctor", + "document", + "dog", + "doll", + "dolphin", + "domain", + "donate", + "donkey", + "donor", + "door", + "dose", + "double", + "dove", + "draft", + "dragon", + "drama", + "drastic", + "draw", + "dream", + "dress", + "drift", + "drill", + "drink", + "drip", + "drive", + "drop", + "drum", + "dry", + "duck", + "dumb", + "dune", + "during", + "dust", + "dutch", + "duty", + "dwarf", + "dynamic", + "eager", + "eagle", + "early", + "earn", + "earth", + "easily", + "east", + "easy", + "echo", + "ecology", + "economy", + "edge", + "edit", + "educate", + "effort", + "egg", + "eight", + "either", + "elbow", + "elder", + "electric", + "elegant", + "element", + "elephant", + "elevator", + "elite", + "else", + "embark", + "embody", + "embrace", + "emerge", + "emotion", + "employ", + "empower", + "empty", + "enable", + "enact", + "end", + "endless", + "endorse", + "enemy", + "energy", + "enforce", + "engage", + "engine", + "enhance", + "enjoy", + "enlist", + "enough", + "enrich", + "enroll", + "ensure", + "enter", + "entire", + "entry", + "envelope", + "episode", + "equal", + "equip", + "era", + "erase", + "erode", + "erosion", + "error", + "erupt", + "escape", + "essay", + "essence", + "estate", + "eternal", + "ethics", + "evidence", + "evil", + "evoke", + "evolve", + "exact", + "example", + "excess", + "exchange", + "excite", + "exclude", + "excuse", + "execute", + "exercise", + "exhaust", + "exhibit", + "exile", + "exist", + "exit", + "exotic", + "expand", + "expect", + "expire", + "explain", + "expose", + "express", + "extend", + "extra", + "eye", + "eyebrow", + "fabric", + "face", + "faculty", + "fade", + "faint", + "faith", + "fall", + "false", + "fame", + "family", + "famous", + "fan", + "fancy", + "fantasy", + "farm", + "fashion", + "fat", + "fatal", + "father", + "fatigue", + "fault", + "favorite", + "feature", + "february", + "federal", + "fee", + "feed", + "feel", + "female", + "fence", + "festival", + "fetch", + "fever", + "few", + "fiber", + "fiction", + "field", + "figure", + "file", + "film", + "filter", + "final", + "find", + "fine", + "finger", + "finish", + "fire", + "firm", + "first", + "fiscal", + "fish", + "fit", + "fitness", + "fix", + "flag", + "flame", + "flash", + "flat", + "flavor", + "flee", + "flight", + "flip", + "float", + "flock", + "floor", + "flower", + "fluid", + "flush", + "fly", + "foam", + "focus", + "fog", + "foil", + "fold", + "follow", + "food", + "foot", + "force", + "forest", + "forget", + "fork", + "fortune", + "forum", + "forward", + "fossil", + "foster", + "found", + "fox", + "fragile", + "frame", + "frequent", + "fresh", + "friend", + "fringe", + "frog", + "front", + "frost", + "frown", + "frozen", + "fruit", + "fuel", + "fun", + "funny", + "furnace", + "fury", + "future", + "gadget", + "gain", + "galaxy", + "gallery", + "game", + "gap", + "garage", + "garbage", + "garden", + "garlic", + "garment", + "gas", + "gasp", + "gate", + "gather", + "gauge", + "gaze", + "general", + "genius", + "genre", + "gentle", + "genuine", + "gesture", + "ghost", + "giant", + "gift", + "giggle", + "ginger", + "giraffe", + "girl", + "give", + "glad", + "glance", + "glare", + "glass", + "glide", + "glimpse", + "globe", + "gloom", + "glory", + "glove", + "glow", + "glue", + "goat", + "goddess", + "gold", + "good", + "goose", + "gorilla", + "gospel", + "gossip", + "govern", + "gown", + "grab", + "grace", + "grain", + "grant", + "grape", + "grass", + "gravity", + "great", + "green", + "grid", + "grief", + "grit", + "grocery", + "group", + "grow", + "grunt", + "guard", + "guess", + "guide", + "guilt", + "guitar", + "gun", + "gym", + "habit", + "hair", + "half", + "hammer", + "hamster", + "hand", + "happy", + "harbor", + "hard", + "harsh", + "harvest", + "hat", + "have", + "hawk", + "hazard", + "head", + "health", + "heart", + "heavy", + "hedgehog", + "height", + "hello", + "helmet", + "help", + "hen", + "hero", + "hidden", + "high", + "hill", + "hint", + "hip", + "hire", + "history", + "hobby", + "hockey", + "hold", + "hole", + "holiday", + "hollow", + "home", + "honey", + "hood", + "hope", + "horn", + "horror", + "horse", + "hospital", + "host", + "hotel", + "hour", + "hover", + "hub", + "huge", + "human", + "humble", + "humor", + "hundred", + "hungry", + "hunt", + "hurdle", + "hurry", + "hurt", + "husband", + "hybrid", + "ice", + "icon", + "idea", + "identify", + "idle", + "ignore", + "ill", + "illegal", + "illness", + "image", + "imitate", + "immense", + "immune", + "impact", + "impose", + "improve", + "impulse", + "inch", + "include", + "income", + "increase", + "index", + "indicate", + "indoor", + "industry", + "infant", + "inflict", + "inform", + "inhale", + "inherit", + "initial", + "inject", + "injury", + "inmate", + "inner", + "innocent", + "input", + "inquiry", + "insane", + "insect", + "inside", + "inspire", + "install", + "intact", + "interest", + "into", + "invest", + "invite", + "involve", + "iron", + "island", + "isolate", + "issue", + "item", + "ivory", + "jacket", + "jaguar", + "jar", + "jazz", + "jealous", + "jeans", + "jelly", + "jewel", + "job", + "join", + "joke", + "journey", + "joy", + "judge", + "juice", + "jump", + "jungle", + "junior", + "junk", + "just", + "kangaroo", + "keen", + "keep", + "ketchup", + "key", + "kick", + "kid", + "kidney", + "kind", + "kingdom", + "kiss", + "kit", + "kitchen", + "kite", + "kitten", + "kiwi", + "knee", + "knife", + "knock", + "know", + "lab", + "label", + "labor", + "ladder", + "lady", + "lake", + "lamp", + "language", + "laptop", + "large", + "later", + "latin", + "laugh", + "laundry", + "lava", + "law", + "lawn", + "lawsuit", + "layer", + "lazy", + "leader", + "leaf", + "learn", + "leave", + "lecture", + "left", + "leg", + "legal", + "legend", + "leisure", + "lemon", + "lend", + "length", + "lens", + "leopard", + "lesson", + "letter", + "level", + "liar", + "liberty", + "library", + "license", + "life", + "lift", + "light", + "like", + "limb", + "limit", + "link", + "lion", + "liquid", + "list", + "little", + "live", + "lizard", + "load", + "loan", + "lobster", + "local", + "lock", + "logic", + "lonely", + "long", + "loop", + "lottery", + "loud", + "lounge", + "love", + "loyal", + "lucky", + "luggage", + "lumber", + "lunar", + "lunch", + "luxury", + "lyrics", + "machine", + "mad", + "magic", + "magnet", + "maid", + "mail", + "main", + "major", + "make", + "mammal", + "man", + "manage", + "mandate", + "mango", + "mansion", + "manual", + "maple", + "marble", + "march", + "margin", + "marine", + "market", + "marriage", + "mask", + "mass", + "master", + "match", + "material", + "math", + "matrix", + "matter", + "maximum", + "maze", + "meadow", + "mean", + "measure", + "meat", + "mechanic", + "medal", + "media", + "melody", + "melt", + "member", + "memory", + "mention", + "menu", + "mercy", + "merge", + "merit", + "merry", + "mesh", + "message", + "metal", + "method", + "middle", + "midnight", + "milk", + "million", + "mimic", + "mind", + "minimum", + "minor", + "minute", + "miracle", + "mirror", + "misery", + "miss", + "mistake", + "mix", + "mixed", + "mixture", + "mobile", + "model", + "modify", + "mom", + "moment", + "monitor", + "monkey", + "monster", + "month", + "moon", + "moral", + "more", + "morning", + "mosquito", + "mother", + "motion", + "motor", + "mountain", + "mouse", + "move", + "movie", + "much", + "muffin", + "mule", + "multiply", + "muscle", + "museum", + "mushroom", + "music", + "must", + "mutual", + "myself", + "mystery", + "myth", + "naive", + "name", + "napkin", + "narrow", + "nasty", + "nation", + "nature", + "near", + "neck", + "need", + "negative", + "neglect", + "neither", + "nephew", + "nerve", + "nest", + "net", + "network", + "neutral", + "never", + "news", + "next", + "nice", + "night", + "noble", + "noise", + "nominee", + "noodle", + "normal", + "north", + "nose", + "notable", + "note", + "nothing", + "notice", + "novel", + "now", + "nuclear", + "number", + "nurse", + "nut", + "oak", + "obey", + "object", + "oblige", + "obscure", + "observe", + "obtain", + "obvious", + "occur", + "ocean", + "october", + "odor", + "off", + "offer", + "office", + "often", + "oil", + "okay", + "old", + "olive", + "olympic", + "omit", + "once", + "one", + "onion", + "online", + "only", + "open", + "opera", + "opinion", + "oppose", + "option", + "orange", + "orbit", + "orchard", + "order", + "ordinary", + "organ", + "orient", + "original", + "orphan", + "ostrich", + "other", + "outdoor", + "outer", + "output", + "outside", + "oval", + "oven", + "over", + "own", + "owner", + "oxygen", + "oyster", + "ozone", + "pact", + "paddle", + "page", + "pair", + "palace", + "palm", + "panda", + "panel", + "panic", + "panther", + "paper", + "parade", + "parent", + "park", + "parrot", + "party", + "pass", + "patch", + "path", + "patient", + "patrol", + "pattern", + "pause", + "pave", + "payment", + "peace", + "peanut", + "pear", + "peasant", + "pelican", + "pen", + "penalty", + "pencil", + "people", + "pepper", + "perfect", + "permit", + "person", + "pet", + "phone", + "photo", + "phrase", + "physical", + "piano", + "picnic", + "picture", + "piece", + "pig", + "pigeon", + "pill", + "pilot", + "pink", + "pioneer", + "pipe", + "pistol", + "pitch", + "pizza", + "place", + "planet", + "plastic", + "plate", + "play", + "please", + "pledge", + "pluck", + "plug", + "plunge", + "poem", + "poet", + "point", + "polar", + "pole", + "police", + "pond", + "pony", + "pool", + "popular", + "portion", + "position", + "possible", + "post", + "potato", + "pottery", + "poverty", + "powder", + "power", + "practice", + "praise", + "predict", + "prefer", + "prepare", + "present", + "pretty", + "prevent", + "price", + "pride", + "primary", + "print", + "priority", + "prison", + "private", + "prize", + "problem", + "process", + "produce", + "profit", + "program", + "project", + "promote", + "proof", + "property", + "prosper", + "protect", + "proud", + "provide", + "public", + "pudding", + "pull", + "pulp", + "pulse", + "pumpkin", + "punch", + "pupil", + "puppy", + "purchase", + "purity", + "purpose", + "purse", + "push", + "put", + "puzzle", + "pyramid", + "quality", + "quantum", + "quarter", + "question", + "quick", + "quit", + "quiz", + "quote", + "rabbit", + "raccoon", + "race", + "rack", + "radar", + "radio", + "rail", + "rain", + "raise", + "rally", + "ramp", + "ranch", + "random", + "range", + "rapid", + "rare", + "rate", + "rather", + "raven", + "raw", + "razor", + "ready", + "real", + "reason", + "rebel", + "rebuild", + "recall", + "receive", + "recipe", + "record", + "recycle", + "reduce", + "reflect", + "reform", + "refuse", + "region", + "regret", + "regular", + "reject", + "relax", + "release", + "relief", + "rely", + "remain", + "remember", + "remind", + "remove", + "render", + "renew", + "rent", + "reopen", + "repair", + "repeat", + "replace", + "report", + "require", + "rescue", + "resemble", + "resist", + "resource", + "response", + "result", + "retire", + "retreat", + "return", + "reunion", + "reveal", + "review", + "reward", + "rhythm", + "rib", + "ribbon", + "rice", + "rich", + "ride", + "ridge", + "rifle", + "right", + "rigid", + "ring", + "riot", + "ripple", + "risk", + "ritual", + "rival", + "river", + "road", + "roast", + "robot", + "robust", + "rocket", + "romance", + "roof", + "rookie", + "room", + "rose", + "rotate", + "rough", + "round", + "route", + "royal", + "rubber", + "rude", + "rug", + "rule", + "run", + "runway", + "rural", + "sad", + "saddle", + "sadness", + "safe", + "sail", + "salad", + "salmon", + "salon", + "salt", + "salute", + "same", + "sample", + "sand", + "satisfy", + "satoshi", + "sauce", + "sausage", + "save", + "say", + "scale", + "scan", + "scare", + "scatter", + "scene", + "scheme", + "school", + "science", + "scissors", + "scorpion", + "scout", + "scrap", + "screen", + "script", + "scrub", + "sea", + "search", + "season", + "seat", + "second", + "secret", + "section", + "security", + "seed", + "seek", + "segment", + "select", + "sell", + "seminar", + "senior", + "sense", + "sentence", + "series", + "service", + "session", + "settle", + "setup", + "seven", + "shadow", + "shaft", + "shallow", + "share", + "shed", + "shell", + "sheriff", + "shield", + "shift", + "shine", + "ship", + "shiver", + "shock", + "shoe", + "shoot", + "shop", + "short", + "shoulder", + "shove", + "shrimp", + "shrug", + "shuffle", + "shy", + "sibling", + "sick", + "side", + "siege", + "sight", + "sign", + "silent", + "silk", + "silly", + "silver", + "similar", + "simple", + "since", + "sing", + "siren", + "sister", + "situate", + "six", + "size", + "skate", + "sketch", + "ski", + "skill", + "skin", + "skirt", + "skull", + "slab", + "slam", + "sleep", + "slender", + "slice", + "slide", + "slight", + "slim", + "slogan", + "slot", + "slow", + "slush", + "small", + "smart", + "smile", + "smoke", + "smooth", + "snack", + "snake", + "snap", + "sniff", + "snow", + "soap", + "soccer", + "social", + "sock", + "soda", + "soft", + "solar", + "soldier", + "solid", + "solution", + "solve", + "someone", + "song", + "soon", + "sorry", + "sort", + "soul", + "sound", + "soup", + "source", + "south", + "space", + "spare", + "spatial", + "spawn", + "speak", + "special", + "speed", + "spell", + "spend", + "sphere", + "spice", + "spider", + "spike", + "spin", + "spirit", + "split", + "spoil", + "sponsor", + "spoon", + "sport", + "spot", + "spray", + "spread", + "spring", + "spy", + "square", + "squeeze", + "squirrel", + "stable", + "stadium", + "staff", + "stage", + "stairs", + "stamp", + "stand", + "start", + "state", + "stay", + "steak", + "steel", + "stem", + "step", + "stereo", + "stick", + "still", + "sting", + "stock", + "stomach", + "stone", + "stool", + "story", + "stove", + "strategy", + "street", + "strike", + "strong", + "struggle", + "student", + "stuff", + "stumble", + "style", + "subject", + "submit", + "subway", + "success", + "such", + "sudden", + "suffer", + "sugar", + "suggest", + "suit", + "summer", + "sun", + "sunny", + "sunset", + "super", + "supply", + "supreme", + "sure", + "surface", + "surge", + "surprise", + "surround", + "survey", + "suspect", + "sustain", + "swallow", + "swamp", + "swap", + "swarm", + "swear", + "sweet", + "swift", + "swim", + "swing", + "switch", + "sword", + "symbol", + "symptom", + "syrup", + "system", + "table", + "tackle", + "tag", + "tail", + "talent", + "talk", + "tank", + "tape", + "target", + "task", + "taste", + "tattoo", + "taxi", + "teach", + "team", + "tell", + "ten", + "tenant", + "tennis", + "tent", + "term", + "test", + "text", + "thank", + "that", + "theme", + "then", + "theory", + "there", + "they", + "thing", + "this", + "thought", + "three", + "thrive", + "throw", + "thumb", + "thunder", + "ticket", + "tide", + "tiger", + "tilt", + "timber", + "time", + "tiny", + "tip", + "tired", + "tissue", + "title", + "toast", + "tobacco", + "today", + "toddler", + "toe", + "together", + "toilet", + "token", + "tomato", + "tomorrow", + "tone", + "tongue", + "tonight", + "tool", + "tooth", + "top", + "topic", + "topple", + "torch", + "tornado", + "tortoise", + "toss", + "total", + "tourist", + "toward", + "tower", + "town", + "toy", + "track", + "trade", + "traffic", + "tragic", + "train", + "transfer", + "trap", + "trash", + "travel", + "tray", + "treat", + "tree", + "trend", + "trial", + "tribe", + "trick", + "trigger", + "trim", + "trip", + "trophy", + "trouble", + "truck", + "true", + "truly", + "trumpet", + "trust", + "truth", + "try", + "tube", + "tuition", + "tumble", + "tuna", + "tunnel", + "turkey", + "turn", + "turtle", + "twelve", + "twenty", + "twice", + "twin", + "twist", + "two", + "type", + "typical", + "ugly", + "umbrella", + "unable", + "unaware", + "uncle", + "uncover", + "under", + "undo", + "unfair", + "unfold", + "unhappy", + "uniform", + "unique", + "unit", + "universe", + "unknown", + "unlock", + "until", + "unusual", + "unveil", + "update", + "upgrade", + "uphold", + "upon", + "upper", + "upset", + "urban", + "urge", + "usage", + "use", + "used", + "useful", + "useless", + "usual", + "utility", + "vacant", + "vacuum", + "vague", + "valid", + "valley", + "valve", + "van", + "vanish", + "vapor", + "various", + "vast", + "vault", + "vehicle", + "velvet", + "vendor", + "venture", + "venue", + "verb", + "verify", + "version", + "very", + "vessel", + "veteran", + "viable", + "vibrant", + "vicious", + "victory", + "video", + "view", + "village", + "vintage", + "violin", + "virtual", + "virus", + "visa", + "visit", + "visual", + "vital", + "vivid", + "vocal", + "voice", + "void", + "volcano", + "volume", + "vote", + "voyage", + "wage", + "wagon", + "wait", + "walk", + "wall", + "walnut", + "want", + "warfare", + "warm", + "warrior", + "wash", + "wasp", + "waste", + "water", + "wave", + "way", + "wealth", + "weapon", + "wear", + "weasel", + "weather", + "web", + "wedding", + "weekend", + "weird", + "welcome", + "west", + "wet", + "whale", + "what", + "wheat", + "wheel", + "when", + "where", + "whip", + "whisper", + "wide", + "width", + "wife", + "wild", + "will", + "win", + "window", + "wine", + "wing", + "wink", + "winner", + "winter", + "wire", + "wisdom", + "wise", + "wish", + "witness", + "wolf", + "woman", + "wonder", + "wood", + "wool", + "word", + "work", + "world", + "worry", + "worth", + "wrap", + "wreck", + "wrestle", + "wrist", + "write", + "wrong", + "yard", + "year", + "yellow", + "you", + "young", + "youth", + "zebra", + "zero", + "zone", + "zoo", +]; +function bytesToBitstring(bytes) { + return Array.from(bytes) + .map((byte) => byte.toString(2).padStart(8, "0")) + .join(""); +} +function deriveChecksumBits(entropy) { + const entropyLengthBits = entropy.length * 8; // "ENT" (in bits) + const checksumLengthBits = entropyLengthBits / 32; // "CS" (in bits) + const hash = (0, sha_1.sha256)(entropy); + return bytesToBitstring(hash).slice(0, checksumLengthBits); +} +function bitstringToByte(bin) { + return parseInt(bin, 2); +} +const allowedEntropyLengths = [16, 20, 24, 28, 32]; +const allowedWordLengths = [12, 15, 18, 21, 24]; +function entropyToMnemonic(entropy) { + if (allowedEntropyLengths.indexOf(entropy.length) === -1) { + throw new Error("invalid input length"); + } + const entropyBits = bytesToBitstring(entropy); + const checksumBits = deriveChecksumBits(entropy); + const bits = entropyBits + checksumBits; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const chunks = bits.match(/(.{11})/g); + const words = chunks.map((binary) => { + const index = bitstringToByte(binary); + return wordlist[index]; + }); + return words.join(" "); +} +exports.entropyToMnemonic = entropyToMnemonic; +const invalidNumberOfWorks = "Invalid number of words"; +const wordNotInWordlist = "Found word that is not in the wordlist"; +const invalidEntropy = "Invalid entropy"; +const invalidChecksum = "Invalid mnemonic checksum"; +function normalize(str) { + return str.normalize("NFKD"); +} +function mnemonicToEntropy(mnemonic) { + const words = normalize(mnemonic).split(" "); + if (!allowedWordLengths.includes(words.length)) { + throw new Error(invalidNumberOfWorks); + } + // convert word indices to 11 bit binary strings + const bits = words + .map((word) => { + const index = wordlist.indexOf(word); + if (index === -1) { + throw new Error(wordNotInWordlist); + } + return index.toString(2).padStart(11, "0"); + }) + .join(""); + // split the binary string into ENT/CS + const dividerIndex = Math.floor(bits.length / 33) * 32; + const entropyBits = bits.slice(0, dividerIndex); + const checksumBits = bits.slice(dividerIndex); + // calculate the checksum and compare + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const entropyBytes = entropyBits.match(/(.{1,8})/g).map(bitstringToByte); + if (entropyBytes.length < 16 || entropyBytes.length > 32 || entropyBytes.length % 4 !== 0) { + throw new Error(invalidEntropy); + } + const entropy = Uint8Array.from(entropyBytes); + const newChecksum = deriveChecksumBits(entropy); + if (newChecksum !== checksumBits) { + throw new Error(invalidChecksum); + } + return entropy; +} +exports.mnemonicToEntropy = mnemonicToEntropy; +class EnglishMnemonic { + constructor(mnemonic) { + if (!EnglishMnemonic.mnemonicMatcher.test(mnemonic)) { + throw new Error("Invalid mnemonic format"); + } + const words = mnemonic.split(" "); + const allowedWordsLengths = [12, 15, 18, 21, 24]; + if (allowedWordsLengths.indexOf(words.length) === -1) { + throw new Error(`Invalid word count in mnemonic (allowed: ${allowedWordsLengths} got: ${words.length})`); + } + for (const word of words) { + if (EnglishMnemonic.wordlist.indexOf(word) === -1) { + throw new Error("Mnemonic contains invalid word"); + } + } + // Throws with informative error message if mnemonic is not valid + mnemonicToEntropy(mnemonic); + this.data = mnemonic; + } + toString() { + return this.data; + } +} +exports.EnglishMnemonic = EnglishMnemonic; +EnglishMnemonic.wordlist = wordlist; +// list of space separated lower case words (1 or more) +EnglishMnemonic.mnemonicMatcher = /^[a-z]+( [a-z]+)*$/; +class Bip39 { + /** + * Encodes raw entropy of length 16, 20, 24, 28 or 32 bytes as an English mnemonic between 12 and 24 words. + * + * | Entropy | Words | + * |--------------------|-------| + * | 128 bit (16 bytes) | 12 | + * | 160 bit (20 bytes) | 15 | + * | 192 bit (24 bytes) | 18 | + * | 224 bit (28 bytes) | 21 | + * | 256 bit (32 bytes) | 24 | + * + * + * @see https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#generating-the-mnemonic + * @param entropy The entropy to be encoded. This must be cryptographically secure. + */ + static encode(entropy) { + return new EnglishMnemonic(entropyToMnemonic(entropy)); + } + static decode(mnemonic) { + return mnemonicToEntropy(mnemonic.toString()); + } + static async mnemonicToSeed(mnemonic, password) { + const mnemonicBytes = (0, encoding_1.toUtf8)(normalize(mnemonic.toString())); + const salt = "mnemonic" + (password ? normalize(password) : ""); + const saltBytes = (0, encoding_1.toUtf8)(salt); + return (0, pbkdf2_1.pbkdf2Sha512)(mnemonicBytes, saltBytes, 2048, 64); + } +} +exports.Bip39 = Bip39; +//# sourceMappingURL=bip39.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/hmac.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/hmac.js ***! + \******************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Hmac = void 0; +class Hmac { + constructor(hashFunctionConstructor, originalKey) { + // This implementation is based on https://en.wikipedia.org/wiki/HMAC#Implementation + // with the addition of incremental hashing support. Thus part of the algorithm + // is in the constructor and the rest in digest(). + const blockSize = new hashFunctionConstructor().blockSize; + this.hash = (data) => new hashFunctionConstructor().update(data).digest(); + let key = originalKey; + if (key.length > blockSize) { + key = this.hash(key); + } + if (key.length < blockSize) { + const zeroPadding = new Uint8Array(blockSize - key.length); + key = new Uint8Array([...key, ...zeroPadding]); + } + // eslint-disable-next-line no-bitwise + this.oKeyPad = key.map((keyByte) => keyByte ^ 0x5c); + // eslint-disable-next-line no-bitwise + this.iKeyPad = key.map((keyByte) => keyByte ^ 0x36); + this.messageHasher = new hashFunctionConstructor(); + this.blockSize = blockSize; + this.update(this.iKeyPad); + } + update(data) { + this.messageHasher.update(data); + return this; + } + digest() { + const innerHash = this.messageHasher.digest(); + return this.hash(new Uint8Array([...this.oKeyPad, ...innerHash])); + } +} +exports.Hmac = Hmac; +//# sourceMappingURL=hmac.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/index.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/index.js ***! + \*******************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.stringToPath = exports.Slip10RawIndex = exports.slip10CurveFromString = exports.Slip10Curve = exports.Slip10 = exports.pathToString = exports.sha512 = exports.Sha512 = exports.sha256 = exports.Sha256 = exports.Secp256k1Signature = exports.ExtendedSecp256k1Signature = exports.Secp256k1 = exports.ripemd160 = exports.Ripemd160 = exports.Random = exports.Xchacha20poly1305Ietf = exports.xchacha20NonceLength = exports.isArgon2idOptions = exports.Ed25519Keypair = exports.Ed25519 = exports.Argon2id = exports.keccak256 = exports.Keccak256 = exports.Hmac = exports.EnglishMnemonic = exports.Bip39 = void 0; +var bip39_1 = __webpack_require__(/*! ./bip39 */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/bip39.js"); +Object.defineProperty(exports, "Bip39", ({ enumerable: true, get: function () { return bip39_1.Bip39; } })); +Object.defineProperty(exports, "EnglishMnemonic", ({ enumerable: true, get: function () { return bip39_1.EnglishMnemonic; } })); +var hmac_1 = __webpack_require__(/*! ./hmac */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/hmac.js"); +Object.defineProperty(exports, "Hmac", ({ enumerable: true, get: function () { return hmac_1.Hmac; } })); +var keccak_1 = __webpack_require__(/*! ./keccak */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/keccak.js"); +Object.defineProperty(exports, "Keccak256", ({ enumerable: true, get: function () { return keccak_1.Keccak256; } })); +Object.defineProperty(exports, "keccak256", ({ enumerable: true, get: function () { return keccak_1.keccak256; } })); +var libsodium_1 = __webpack_require__(/*! ./libsodium */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/libsodium.js"); +Object.defineProperty(exports, "Argon2id", ({ enumerable: true, get: function () { return libsodium_1.Argon2id; } })); +Object.defineProperty(exports, "Ed25519", ({ enumerable: true, get: function () { return libsodium_1.Ed25519; } })); +Object.defineProperty(exports, "Ed25519Keypair", ({ enumerable: true, get: function () { return libsodium_1.Ed25519Keypair; } })); +Object.defineProperty(exports, "isArgon2idOptions", ({ enumerable: true, get: function () { return libsodium_1.isArgon2idOptions; } })); +Object.defineProperty(exports, "xchacha20NonceLength", ({ enumerable: true, get: function () { return libsodium_1.xchacha20NonceLength; } })); +Object.defineProperty(exports, "Xchacha20poly1305Ietf", ({ enumerable: true, get: function () { return libsodium_1.Xchacha20poly1305Ietf; } })); +var random_1 = __webpack_require__(/*! ./random */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/random.js"); +Object.defineProperty(exports, "Random", ({ enumerable: true, get: function () { return random_1.Random; } })); +var ripemd_1 = __webpack_require__(/*! ./ripemd */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/ripemd.js"); +Object.defineProperty(exports, "Ripemd160", ({ enumerable: true, get: function () { return ripemd_1.Ripemd160; } })); +Object.defineProperty(exports, "ripemd160", ({ enumerable: true, get: function () { return ripemd_1.ripemd160; } })); +var secp256k1_1 = __webpack_require__(/*! ./secp256k1 */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/secp256k1.js"); +Object.defineProperty(exports, "Secp256k1", ({ enumerable: true, get: function () { return secp256k1_1.Secp256k1; } })); +var secp256k1signature_1 = __webpack_require__(/*! ./secp256k1signature */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/secp256k1signature.js"); +Object.defineProperty(exports, "ExtendedSecp256k1Signature", ({ enumerable: true, get: function () { return secp256k1signature_1.ExtendedSecp256k1Signature; } })); +Object.defineProperty(exports, "Secp256k1Signature", ({ enumerable: true, get: function () { return secp256k1signature_1.Secp256k1Signature; } })); +var sha_1 = __webpack_require__(/*! ./sha */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/sha.js"); +Object.defineProperty(exports, "Sha256", ({ enumerable: true, get: function () { return sha_1.Sha256; } })); +Object.defineProperty(exports, "sha256", ({ enumerable: true, get: function () { return sha_1.sha256; } })); +Object.defineProperty(exports, "Sha512", ({ enumerable: true, get: function () { return sha_1.Sha512; } })); +Object.defineProperty(exports, "sha512", ({ enumerable: true, get: function () { return sha_1.sha512; } })); +var slip10_1 = __webpack_require__(/*! ./slip10 */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/slip10.js"); +Object.defineProperty(exports, "pathToString", ({ enumerable: true, get: function () { return slip10_1.pathToString; } })); +Object.defineProperty(exports, "Slip10", ({ enumerable: true, get: function () { return slip10_1.Slip10; } })); +Object.defineProperty(exports, "Slip10Curve", ({ enumerable: true, get: function () { return slip10_1.Slip10Curve; } })); +Object.defineProperty(exports, "slip10CurveFromString", ({ enumerable: true, get: function () { return slip10_1.slip10CurveFromString; } })); +Object.defineProperty(exports, "Slip10RawIndex", ({ enumerable: true, get: function () { return slip10_1.Slip10RawIndex; } })); +Object.defineProperty(exports, "stringToPath", ({ enumerable: true, get: function () { return slip10_1.stringToPath; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/keccak.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/keccak.js ***! + \********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.keccak256 = exports.Keccak256 = void 0; +const sha3_1 = __webpack_require__(/*! @noble/hashes/sha3 */ "./node_modules/@noble/hashes/sha3.js"); +const utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/utils.js"); +class Keccak256 { + constructor(firstData) { + this.blockSize = 512 / 8; + this.impl = sha3_1.keccak_256.create(); + if (firstData) { + this.update(firstData); + } + } + update(data) { + this.impl.update((0, utils_1.toRealUint8Array)(data)); + return this; + } + digest() { + return this.impl.digest(); + } +} +exports.Keccak256 = Keccak256; +/** Convenience function equivalent to `new Keccak256(data).digest()` */ +function keccak256(data) { + return new Keccak256(data).digest(); +} +exports.keccak256 = keccak256; +//# sourceMappingURL=keccak.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/libsodium.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/libsodium.js ***! + \***********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +// Keep all classes requiring libsodium-js in one file as having multiple +// requiring of the libsodium-wrappers module currently crashes browsers +// +// libsodium.js API: https://gist.github.com/webmaster128/b2dbe6d54d36dd168c9fabf441b9b09c +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Xchacha20poly1305Ietf = exports.xchacha20NonceLength = exports.Ed25519 = exports.Ed25519Keypair = exports.Argon2id = exports.isArgon2idOptions = void 0; +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/index.js"); +const libsodium_wrappers_1 = __importDefault(__webpack_require__(/*! libsodium-wrappers */ "./node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js")); +function isArgon2idOptions(thing) { + if (!(0, utils_1.isNonNullObject)(thing)) + return false; + if (typeof thing.outputLength !== "number") + return false; + if (typeof thing.opsLimit !== "number") + return false; + if (typeof thing.memLimitKib !== "number") + return false; + return true; +} +exports.isArgon2idOptions = isArgon2idOptions; +class Argon2id { + static async execute(password, salt, options) { + await libsodium_wrappers_1.default.ready; + return libsodium_wrappers_1.default.crypto_pwhash(options.outputLength, password, salt, // libsodium only supports 16 byte salts and will throw when you don't respect that + options.opsLimit, options.memLimitKib * 1024, libsodium_wrappers_1.default.crypto_pwhash_ALG_ARGON2ID13); + } +} +exports.Argon2id = Argon2id; +class Ed25519Keypair { + constructor(privkey, pubkey) { + this.privkey = privkey; + this.pubkey = pubkey; + } + // a libsodium privkey has the format ` + ` + static fromLibsodiumPrivkey(libsodiumPrivkey) { + if (libsodiumPrivkey.length !== 64) { + throw new Error(`Unexpected key length ${libsodiumPrivkey.length}. Must be 64.`); + } + return new Ed25519Keypair(libsodiumPrivkey.slice(0, 32), libsodiumPrivkey.slice(32, 64)); + } + toLibsodiumPrivkey() { + return new Uint8Array([...this.privkey, ...this.pubkey]); + } +} +exports.Ed25519Keypair = Ed25519Keypair; +class Ed25519 { + /** + * Generates a keypair deterministically from a given 32 bytes seed. + * + * This seed equals the Ed25519 private key. + * For implementation details see crypto_sign_seed_keypair in + * https://download.libsodium.org/doc/public-key_cryptography/public-key_signatures.html + * and diagram on https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/ + */ + static async makeKeypair(seed) { + await libsodium_wrappers_1.default.ready; + const keypair = libsodium_wrappers_1.default.crypto_sign_seed_keypair(seed); + return Ed25519Keypair.fromLibsodiumPrivkey(keypair.privateKey); + } + static async createSignature(message, keyPair) { + await libsodium_wrappers_1.default.ready; + return libsodium_wrappers_1.default.crypto_sign_detached(message, keyPair.toLibsodiumPrivkey()); + } + static async verifySignature(signature, message, pubkey) { + await libsodium_wrappers_1.default.ready; + return libsodium_wrappers_1.default.crypto_sign_verify_detached(signature, message, pubkey); + } +} +exports.Ed25519 = Ed25519; +/** + * Nonce length in bytes for all flavours of XChaCha20. + * + * @see https://libsodium.gitbook.io/doc/advanced/stream_ciphers/xchacha20#notes + */ +exports.xchacha20NonceLength = 24; +class Xchacha20poly1305Ietf { + static async encrypt(message, key, nonce) { + await libsodium_wrappers_1.default.ready; + const additionalData = null; + return libsodium_wrappers_1.default.crypto_aead_xchacha20poly1305_ietf_encrypt(message, additionalData, null, // secret nonce: unused and should be null (https://download.libsodium.org/doc/secret-key_cryptography/aead/chacha20-poly1305/xchacha20-poly1305_construction) + nonce, key); + } + static async decrypt(ciphertext, key, nonce) { + await libsodium_wrappers_1.default.ready; + const additionalData = null; + return libsodium_wrappers_1.default.crypto_aead_xchacha20poly1305_ietf_decrypt(null, // secret nonce: unused and should be null (https://download.libsodium.org/doc/secret-key_cryptography/aead/chacha20-poly1305/xchacha20-poly1305_construction) + ciphertext, additionalData, nonce, key); + } +} +exports.Xchacha20poly1305Ietf = Xchacha20poly1305Ietf; +//# sourceMappingURL=libsodium.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/pbkdf2.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/pbkdf2.js ***! + \********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pbkdf2Sha512 = exports.pbkdf2Sha512Noble = exports.pbkdf2Sha512NodeCrypto = exports.pbkdf2Sha512Subtle = exports.getSubtle = exports.getNodeCrypto = void 0; +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/index.js"); +const pbkdf2_1 = __webpack_require__(/*! @noble/hashes/pbkdf2 */ "./node_modules/@noble/hashes/pbkdf2.js"); +const sha512_1 = __webpack_require__(/*! @noble/hashes/sha512 */ "./node_modules/@noble/hashes/sha512.js"); +/** + * Returns the Node.js crypto module when available and `undefined` + * otherwise. + * + * Detects an unimplemented fallback module from Webpack 5 and returns + * `undefined` in that case. + */ +async function getNodeCrypto() { + try { + const nodeCrypto = await Promise.resolve().then(() => __importStar(__webpack_require__(/*! crypto */ "./node_modules/crypto-browserify/index.js"))); + // We get `Object{default: Object{}}` as a fallback when using + // `crypto: false` in Webpack 5, which we interprete as unavailable. + if (typeof nodeCrypto === "object" && Object.keys(nodeCrypto).length <= 1) { + return undefined; + } + return nodeCrypto; + } + catch { + return undefined; + } +} +exports.getNodeCrypto = getNodeCrypto; +async function getSubtle() { + // From Node.js 15 onwards, webcrypto is available in globalThis. + // In version 15 and 16 this was stored under the webcrypto key. + // With Node.js 17 it was moved to the same locations where browsers + // make it available. + // Loading `require("crypto")` here seems unnecessary since it only + // causes issues with bundlers and does not increase compatibility. + // Browsers and Node.js 17+ + let subtle = globalThis?.crypto?.subtle; + // Node.js 15+ + if (!subtle) + subtle = globalThis?.crypto?.webcrypto?.subtle; + return subtle; +} +exports.getSubtle = getSubtle; +async function pbkdf2Sha512Subtle( +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +subtle, secret, salt, iterations, keylen) { + (0, utils_1.assert)(subtle, "Argument subtle is falsy"); + (0, utils_1.assert)(typeof subtle === "object", "Argument subtle is not of type object"); + (0, utils_1.assert)(typeof subtle.importKey === "function", "subtle.importKey is not a function"); + (0, utils_1.assert)(typeof subtle.deriveBits === "function", "subtle.deriveBits is not a function"); + return subtle.importKey("raw", secret, { name: "PBKDF2" }, false, ["deriveBits"]).then((key) => subtle + .deriveBits({ + name: "PBKDF2", + salt: salt, + iterations: iterations, + hash: { name: "SHA-512" }, + }, key, keylen * 8) + .then((buffer) => new Uint8Array(buffer))); +} +exports.pbkdf2Sha512Subtle = pbkdf2Sha512Subtle; +/** + * Implements pbkdf2-sha512 using the Node.js crypro module (`import "crypto"`). + * This does not use subtle from [Crypto](https://developer.mozilla.org/en-US/docs/Web/API/Crypto). + */ +async function pbkdf2Sha512NodeCrypto( +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +nodeCrypto, secret, salt, iterations, keylen) { + (0, utils_1.assert)(nodeCrypto, "Argument nodeCrypto is falsy"); + (0, utils_1.assert)(typeof nodeCrypto === "object", "Argument nodeCrypto is not of type object"); + (0, utils_1.assert)(typeof nodeCrypto.pbkdf2 === "function", "nodeCrypto.pbkdf2 is not a function"); + return new Promise((resolve, reject) => { + nodeCrypto.pbkdf2(secret, salt, iterations, keylen, "sha512", (error, result) => { + if (error) { + reject(error); + } + else { + resolve(Uint8Array.from(result)); + } + }); + }); +} +exports.pbkdf2Sha512NodeCrypto = pbkdf2Sha512NodeCrypto; +async function pbkdf2Sha512Noble(secret, salt, iterations, keylen) { + return (0, pbkdf2_1.pbkdf2Async)(sha512_1.sha512, secret, salt, { c: iterations, dkLen: keylen }); +} +exports.pbkdf2Sha512Noble = pbkdf2Sha512Noble; +/** + * A pbkdf2 implementation for BIP39. This is not exported at package level and thus a private API. + */ +async function pbkdf2Sha512(secret, salt, iterations, keylen) { + const subtle = await getSubtle(); + if (subtle) { + return pbkdf2Sha512Subtle(subtle, secret, salt, iterations, keylen); + } + else { + const nodeCrypto = await getNodeCrypto(); + if (nodeCrypto) { + return pbkdf2Sha512NodeCrypto(nodeCrypto, secret, salt, iterations, keylen); + } + else { + return pbkdf2Sha512Noble(secret, salt, iterations, keylen); + } + } +} +exports.pbkdf2Sha512 = pbkdf2Sha512; +//# sourceMappingURL=pbkdf2.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/random.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/random.js ***! + \********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Random = void 0; +class Random { + /** + * Returns `count` cryptographically secure random bytes + */ + static getBytes(count) { + try { + const globalObject = typeof window === "object" ? window : self; + const cryptoApi = typeof globalObject.crypto !== "undefined" ? globalObject.crypto : globalObject.msCrypto; + const out = new Uint8Array(count); + cryptoApi.getRandomValues(out); + return out; + } + catch { + try { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const crypto = __webpack_require__(/*! crypto */ "./node_modules/crypto-browserify/index.js"); + return new Uint8Array([...crypto.randomBytes(count)]); + } + catch { + throw new Error("No secure random number generator found"); + } + } + } +} +exports.Random = Random; +//# sourceMappingURL=random.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/ripemd.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/ripemd.js ***! + \********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ripemd160 = exports.Ripemd160 = void 0; +const ripemd160_1 = __webpack_require__(/*! @noble/hashes/ripemd160 */ "./node_modules/@noble/hashes/ripemd160.js"); +const utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/utils.js"); +class Ripemd160 { + constructor(firstData) { + this.blockSize = 512 / 8; + this.impl = ripemd160_1.ripemd160.create(); + if (firstData) { + this.update(firstData); + } + } + update(data) { + this.impl.update((0, utils_1.toRealUint8Array)(data)); + return this; + } + digest() { + return this.impl.digest(); + } +} +exports.Ripemd160 = Ripemd160; +/** Convenience function equivalent to `new Ripemd160(data).digest()` */ +function ripemd160(data) { + return new Ripemd160(data).digest(); +} +exports.ripemd160 = ripemd160; +//# sourceMappingURL=ripemd.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/secp256k1.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/secp256k1.js ***! + \***********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Secp256k1 = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js"); +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +const elliptic_1 = __importDefault(__webpack_require__(/*! elliptic */ "./node_modules/elliptic/lib/elliptic.js")); +const secp256k1signature_1 = __webpack_require__(/*! ./secp256k1signature */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/secp256k1signature.js"); +const secp256k1 = new elliptic_1.default.ec("secp256k1"); +const secp256k1N = new bn_js_1.default("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", "hex"); +class Secp256k1 { + /** + * Takes a 32 byte private key and returns a privkey/pubkey pair. + * + * The resulting pubkey is uncompressed. For the use in Cosmos it should + * be compressed first using `Secp256k1.compressPubkey`. + */ + static async makeKeypair(privkey) { + if (privkey.length !== 32) { + // is this check missing in secp256k1.validatePrivateKey? + // https://github.com/bitjson/bitcoin-ts/issues/4 + throw new Error("input data is not a valid secp256k1 private key"); + } + const keypair = secp256k1.keyFromPrivate(privkey); + if (keypair.validate().result !== true) { + throw new Error("input data is not a valid secp256k1 private key"); + } + // range test that is not part of the elliptic implementation + const privkeyAsBigInteger = new bn_js_1.default(privkey); + if (privkeyAsBigInteger.gte(secp256k1N)) { + // not strictly smaller than N + throw new Error("input data is not a valid secp256k1 private key"); + } + const out = { + privkey: (0, encoding_1.fromHex)(keypair.getPrivate("hex")), + // encodes uncompressed as + // - 1-byte prefix "04" + // - 32-byte x coordinate + // - 32-byte y coordinate + pubkey: Uint8Array.from(keypair.getPublic("array")), + }; + return out; + } + /** + * Creates a signature that is + * - deterministic (RFC 6979) + * - lowS signature + * - DER encoded + */ + static async createSignature(messageHash, privkey) { + if (messageHash.length === 0) { + throw new Error("Message hash must not be empty"); + } + if (messageHash.length > 32) { + throw new Error("Message hash length must not exceed 32 bytes"); + } + const keypair = secp256k1.keyFromPrivate(privkey); + // the `canonical` option ensures creation of lowS signature representations + const { r, s, recoveryParam } = keypair.sign(messageHash, { canonical: true }); + if (typeof recoveryParam !== "number") + throw new Error("Recovery param missing"); + return new secp256k1signature_1.ExtendedSecp256k1Signature(Uint8Array.from(r.toArray()), Uint8Array.from(s.toArray()), recoveryParam); + } + static async verifySignature(signature, messageHash, pubkey) { + if (messageHash.length === 0) { + throw new Error("Message hash must not be empty"); + } + if (messageHash.length > 32) { + throw new Error("Message hash length must not exceed 32 bytes"); + } + const keypair = secp256k1.keyFromPublic(pubkey); + // From https://github.com/indutny/elliptic: + // + // Sign the message's hash (input must be an array, or a hex-string) + // + // Signature MUST be either: + // 1) DER-encoded signature as hex-string; or + // 2) DER-encoded signature as buffer; or + // 3) object with two hex-string properties (r and s); or + // 4) object with two buffer properties (r and s) + // + // Uint8Array is not a Buffer, but elliptic seems to be happy with the interface + // common to both types. Uint8Array is not an array of ints but the interface is + // similar + try { + return keypair.verify(messageHash, signature.toDer()); + } + catch (error) { + return false; + } + } + static recoverPubkey(signature, messageHash) { + const signatureForElliptic = { r: (0, encoding_1.toHex)(signature.r()), s: (0, encoding_1.toHex)(signature.s()) }; + const point = secp256k1.recoverPubKey(messageHash, signatureForElliptic, signature.recovery); + const keypair = secp256k1.keyFromPublic(point); + return (0, encoding_1.fromHex)(keypair.getPublic(false, "hex")); + } + /** + * Takes a compressed or uncompressed pubkey and return a compressed one. + * + * This function is idempotent. + */ + static compressPubkey(pubkey) { + switch (pubkey.length) { + case 33: + return pubkey; + case 65: + return Uint8Array.from(secp256k1.keyFromPublic(pubkey).getPublic(true, "array")); + default: + throw new Error("Invalid pubkey length"); + } + } + /** + * Takes a compressed or uncompressed pubkey and returns an uncompressed one. + * + * This function is idempotent. + */ + static uncompressPubkey(pubkey) { + switch (pubkey.length) { + case 33: + return Uint8Array.from(secp256k1.keyFromPublic(pubkey).getPublic(false, "array")); + case 65: + return pubkey; + default: + throw new Error("Invalid pubkey length"); + } + } + static trimRecoveryByte(signature) { + switch (signature.length) { + case 64: + return signature; + case 65: + return signature.slice(0, 64); + default: + throw new Error("Invalid signature length"); + } + } +} +exports.Secp256k1 = Secp256k1; +//# sourceMappingURL=secp256k1.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/secp256k1signature.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/secp256k1signature.js ***! + \********************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ExtendedSecp256k1Signature = exports.Secp256k1Signature = void 0; +function trimLeadingNullBytes(inData) { + let numberOfLeadingNullBytes = 0; + for (const byte of inData) { + if (byte === 0x00) { + numberOfLeadingNullBytes++; + } + else { + break; + } + } + return inData.slice(numberOfLeadingNullBytes); +} +const derTagInteger = 0x02; +class Secp256k1Signature { + constructor(r, s) { + if (r.length > 32 || r.length === 0 || r[0] === 0x00) { + throw new Error("Unsigned integer r must be encoded as unpadded big endian."); + } + if (s.length > 32 || s.length === 0 || s[0] === 0x00) { + throw new Error("Unsigned integer s must be encoded as unpadded big endian."); + } + this.data = { + r: r, + s: s, + }; + } + /** + * Takes the pair of integers (r, s) as 2x32 byte of binary data. + * + * Note: This is the format Cosmos SDK uses natively. + * + * @param data a 64 byte value containing integers r and s. + */ + static fromFixedLength(data) { + if (data.length !== 64) { + throw new Error(`Got invalid data length: ${data.length}. Expected 2x 32 bytes for the pair (r, s)`); + } + return new Secp256k1Signature(trimLeadingNullBytes(data.slice(0, 32)), trimLeadingNullBytes(data.slice(32, 64))); + } + static fromDer(data) { + let pos = 0; + if (data[pos++] !== 0x30) { + throw new Error("Prefix 0x30 expected"); + } + const bodyLength = data[pos++]; + if (data.length - pos !== bodyLength) { + throw new Error("Data length mismatch detected"); + } + // r + const rTag = data[pos++]; + if (rTag !== derTagInteger) { + throw new Error("INTEGER tag expected"); + } + const rLength = data[pos++]; + if (rLength >= 0x80) { + throw new Error("Decoding length values above 127 not supported"); + } + const rData = data.slice(pos, pos + rLength); + pos += rLength; + // s + const sTag = data[pos++]; + if (sTag !== derTagInteger) { + throw new Error("INTEGER tag expected"); + } + const sLength = data[pos++]; + if (sLength >= 0x80) { + throw new Error("Decoding length values above 127 not supported"); + } + const sData = data.slice(pos, pos + sLength); + pos += sLength; + return new Secp256k1Signature( + // r/s data can contain leading 0 bytes to express integers being non-negative in DER + trimLeadingNullBytes(rData), trimLeadingNullBytes(sData)); + } + r(length) { + if (length === undefined) { + return this.data.r; + } + else { + const paddingLength = length - this.data.r.length; + if (paddingLength < 0) { + throw new Error("Length too small to hold parameter r"); + } + const padding = new Uint8Array(paddingLength); + return new Uint8Array([...padding, ...this.data.r]); + } + } + s(length) { + if (length === undefined) { + return this.data.s; + } + else { + const paddingLength = length - this.data.s.length; + if (paddingLength < 0) { + throw new Error("Length too small to hold parameter s"); + } + const padding = new Uint8Array(paddingLength); + return new Uint8Array([...padding, ...this.data.s]); + } + } + toFixedLength() { + return new Uint8Array([...this.r(32), ...this.s(32)]); + } + toDer() { + // DER supports negative integers but our data is unsigned. Thus we need to prepend + // a leading 0 byte when the higest bit is set to differentiate nagative values + const rEncoded = this.data.r[0] >= 0x80 ? new Uint8Array([0, ...this.data.r]) : this.data.r; + const sEncoded = this.data.s[0] >= 0x80 ? new Uint8Array([0, ...this.data.s]) : this.data.s; + const rLength = rEncoded.length; + const sLength = sEncoded.length; + const data = new Uint8Array([derTagInteger, rLength, ...rEncoded, derTagInteger, sLength, ...sEncoded]); + return new Uint8Array([0x30, data.length, ...data]); + } +} +exports.Secp256k1Signature = Secp256k1Signature; +/** + * A Secp256k1Signature plus the recovery parameter + */ +class ExtendedSecp256k1Signature extends Secp256k1Signature { + constructor(r, s, recovery) { + super(r, s); + if (!Number.isInteger(recovery)) { + throw new Error("The recovery parameter must be an integer."); + } + if (recovery < 0 || recovery > 4) { + throw new Error("The recovery parameter must be one of 0, 1, 2, 3."); + } + this.recovery = recovery; + } + /** + * Decode extended signature from the simple fixed length encoding + * described in toFixedLength(). + */ + static fromFixedLength(data) { + if (data.length !== 65) { + throw new Error(`Got invalid data length ${data.length}. Expected 32 + 32 + 1`); + } + return new ExtendedSecp256k1Signature(trimLeadingNullBytes(data.slice(0, 32)), trimLeadingNullBytes(data.slice(32, 64)), data[64]); + } + /** + * A simple custom encoding that encodes the extended signature as + * r (32 bytes) | s (32 bytes) | recovery param (1 byte) + * where | denotes concatenation of bonary data. + */ + toFixedLength() { + return new Uint8Array([...this.r(32), ...this.s(32), this.recovery]); + } +} +exports.ExtendedSecp256k1Signature = ExtendedSecp256k1Signature; +//# sourceMappingURL=secp256k1signature.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/sha.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/sha.js ***! + \*****************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.sha512 = exports.Sha512 = exports.sha256 = exports.Sha256 = void 0; +const sha256_1 = __webpack_require__(/*! @noble/hashes/sha256 */ "./node_modules/@noble/hashes/sha256.js"); +const sha512_1 = __webpack_require__(/*! @noble/hashes/sha512 */ "./node_modules/@noble/hashes/sha512.js"); +const utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/utils.js"); +class Sha256 { + constructor(firstData) { + this.blockSize = 512 / 8; + this.impl = sha256_1.sha256.create(); + if (firstData) { + this.update(firstData); + } + } + update(data) { + this.impl.update((0, utils_1.toRealUint8Array)(data)); + return this; + } + digest() { + return this.impl.digest(); + } +} +exports.Sha256 = Sha256; +/** Convenience function equivalent to `new Sha256(data).digest()` */ +function sha256(data) { + return new Sha256(data).digest(); +} +exports.sha256 = sha256; +class Sha512 { + constructor(firstData) { + this.blockSize = 1024 / 8; + this.impl = sha512_1.sha512.create(); + if (firstData) { + this.update(firstData); + } + } + update(data) { + this.impl.update((0, utils_1.toRealUint8Array)(data)); + return this; + } + digest() { + return this.impl.digest(); + } +} +exports.Sha512 = Sha512; +/** Convenience function equivalent to `new Sha512(data).digest()` */ +function sha512(data) { + return new Sha512(data).digest(); +} +exports.sha512 = sha512; +//# sourceMappingURL=sha.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/slip10.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/slip10.js ***! + \********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.stringToPath = exports.pathToString = exports.Slip10 = exports.Slip10RawIndex = exports.slip10CurveFromString = exports.Slip10Curve = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js"); +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/index.js"); +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +const elliptic_1 = __importDefault(__webpack_require__(/*! elliptic */ "./node_modules/elliptic/lib/elliptic.js")); +const hmac_1 = __webpack_require__(/*! ./hmac */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/hmac.js"); +const sha_1 = __webpack_require__(/*! ./sha */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/sha.js"); +/** + * Raw values must match the curve string in SLIP-0010 master key generation + * + * @see https://github.com/satoshilabs/slips/blob/master/slip-0010.md#master-key-generation + */ +var Slip10Curve; +(function (Slip10Curve) { + Slip10Curve["Secp256k1"] = "Bitcoin seed"; + Slip10Curve["Ed25519"] = "ed25519 seed"; +})(Slip10Curve = exports.Slip10Curve || (exports.Slip10Curve = {})); +/** + * Reverse mapping of Slip10Curve + */ +function slip10CurveFromString(curveString) { + switch (curveString) { + case Slip10Curve.Ed25519: + return Slip10Curve.Ed25519; + case Slip10Curve.Secp256k1: + return Slip10Curve.Secp256k1; + default: + throw new Error(`Unknown curve string: '${curveString}'`); + } +} +exports.slip10CurveFromString = slip10CurveFromString; +class Slip10RawIndex extends math_1.Uint32 { + static hardened(hardenedIndex) { + return new Slip10RawIndex(hardenedIndex + 2 ** 31); + } + static normal(normalIndex) { + return new Slip10RawIndex(normalIndex); + } + isHardened() { + return this.data >= 2 ** 31; + } +} +exports.Slip10RawIndex = Slip10RawIndex; +const secp256k1 = new elliptic_1.default.ec("secp256k1"); +// Universal private key derivation accoring to +// https://github.com/satoshilabs/slips/blob/master/slip-0010.md +class Slip10 { + static derivePath(curve, seed, path) { + let result = this.master(curve, seed); + for (const rawIndex of path) { + result = this.child(curve, result.privkey, result.chainCode, rawIndex); + } + return result; + } + static master(curve, seed) { + const i = new hmac_1.Hmac(sha_1.Sha512, (0, encoding_1.toAscii)(curve)).update(seed).digest(); + const il = i.slice(0, 32); + const ir = i.slice(32, 64); + if (curve !== Slip10Curve.Ed25519 && (this.isZero(il) || this.isGteN(curve, il))) { + return this.master(curve, i); + } + return { + chainCode: ir, + privkey: il, + }; + } + static child(curve, parentPrivkey, parentChainCode, rawIndex) { + let i; + if (rawIndex.isHardened()) { + const payload = new Uint8Array([0x00, ...parentPrivkey, ...rawIndex.toBytesBigEndian()]); + i = new hmac_1.Hmac(sha_1.Sha512, parentChainCode).update(payload).digest(); + } + else { + if (curve === Slip10Curve.Ed25519) { + throw new Error("Normal keys are not allowed with ed25519"); + } + else { + // Step 1 of https://github.com/satoshilabs/slips/blob/master/slip-0010.md#private-parent-key--private-child-key + // Calculate I = HMAC-SHA512(Key = c_par, Data = ser_P(point(k_par)) || ser_32(i)). + // where the functions point() and ser_p() are defined in BIP-0032 + const data = new Uint8Array([ + ...Slip10.serializedPoint(curve, new bn_js_1.default(parentPrivkey)), + ...rawIndex.toBytesBigEndian(), + ]); + i = new hmac_1.Hmac(sha_1.Sha512, parentChainCode).update(data).digest(); + } + } + return this.childImpl(curve, parentPrivkey, parentChainCode, rawIndex, i); + } + /** + * Implementation of ser_P(point(k_par)) from BIP-0032 + * + * @see https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki + */ + static serializedPoint(curve, p) { + switch (curve) { + case Slip10Curve.Secp256k1: + return (0, encoding_1.fromHex)(secp256k1.g.mul(p).encodeCompressed("hex")); + default: + throw new Error("curve not supported"); + } + } + static childImpl(curve, parentPrivkey, parentChainCode, rawIndex, i) { + // step 2 (of the Private parent key → private child key algorithm) + const il = i.slice(0, 32); + const ir = i.slice(32, 64); + // step 3 + const returnChainCode = ir; + // step 4 + if (curve === Slip10Curve.Ed25519) { + return { + chainCode: returnChainCode, + privkey: il, + }; + } + // step 5 + const n = this.n(curve); + const returnChildKeyAsNumber = new bn_js_1.default(il).add(new bn_js_1.default(parentPrivkey)).mod(n); + const returnChildKey = Uint8Array.from(returnChildKeyAsNumber.toArray("be", 32)); + // step 6 + if (this.isGteN(curve, il) || this.isZero(returnChildKey)) { + const newI = new hmac_1.Hmac(sha_1.Sha512, parentChainCode) + .update(new Uint8Array([0x01, ...ir, ...rawIndex.toBytesBigEndian()])) + .digest(); + return this.childImpl(curve, parentPrivkey, parentChainCode, rawIndex, newI); + } + // step 7 + return { + chainCode: returnChainCode, + privkey: returnChildKey, + }; + } + static isZero(privkey) { + return privkey.every((byte) => byte === 0); + } + static isGteN(curve, privkey) { + const keyAsNumber = new bn_js_1.default(privkey); + return keyAsNumber.gte(this.n(curve)); + } + static n(curve) { + switch (curve) { + case Slip10Curve.Secp256k1: + return new bn_js_1.default("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", 16); + default: + throw new Error("curve not supported"); + } + } +} +exports.Slip10 = Slip10; +function pathToString(path) { + return path.reduce((current, component) => { + const componentString = component.isHardened() + ? `${component.toNumber() - 2 ** 31}'` + : component.toString(); + return current + "/" + componentString; + }, "m"); +} +exports.pathToString = pathToString; +function stringToPath(input) { + if (!input.startsWith("m")) + throw new Error("Path string must start with 'm'"); + let rest = input.slice(1); + const out = new Array(); + while (rest) { + const match = rest.match(/^\/([0-9]+)('?)/); + if (!match) + throw new Error("Syntax error while reading path component"); + const [fullMatch, numberString, apostrophe] = match; + const value = math_1.Uint53.fromString(numberString).toNumber(); + if (value >= 2 ** 31) + throw new Error("Component value too high. Must not exceed 2**31-1."); + if (apostrophe) + out.push(Slip10RawIndex.hardened(value)); + else + out.push(Slip10RawIndex.normal(value)); + rest = rest.slice(fullMatch.length); + } + return out; +} +exports.stringToPath = stringToPath; +//# sourceMappingURL=slip10.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/utils.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/crypto/build/utils.js ***! + \*******************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toRealUint8Array = void 0; +// See https://github.com/paulmillr/noble-hashes/issues/25 for why this is needed +function toRealUint8Array(data) { + if (data instanceof Uint8Array) + return data; + else + return Uint8Array.from(data); +} +exports.toRealUint8Array = toRealUint8Array; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/ascii.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/ascii.js ***! + \*********************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromAscii = exports.toAscii = void 0; +function toAscii(input) { + const toNums = (str) => str.split("").map((x) => { + const charCode = x.charCodeAt(0); + // 0x00–0x1F control characters + // 0x20–0x7E printable characters + // 0x7F delete character + // 0x80–0xFF out of 7 bit ascii range + if (charCode < 0x20 || charCode > 0x7e) { + throw new Error("Cannot encode character that is out of printable ASCII range: " + charCode); + } + return charCode; + }); + return Uint8Array.from(toNums(input)); +} +exports.toAscii = toAscii; +function fromAscii(data) { + const fromNums = (listOfNumbers) => listOfNumbers.map((x) => { + // 0x00–0x1F control characters + // 0x20–0x7E printable characters + // 0x7F delete character + // 0x80–0xFF out of 7 bit ascii range + if (x < 0x20 || x > 0x7e) { + throw new Error("Cannot decode character that is out of printable ASCII range: " + x); + } + return String.fromCharCode(x); + }); + return fromNums(Array.from(data)).join(""); +} +exports.fromAscii = fromAscii; +//# sourceMappingURL=ascii.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/base64.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/base64.js ***! + \**********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromBase64 = exports.toBase64 = void 0; +const base64js = __importStar(__webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")); +function toBase64(data) { + return base64js.fromByteArray(data); +} +exports.toBase64 = toBase64; +function fromBase64(base64String) { + if (!base64String.match(/^[a-zA-Z0-9+/]*={0,2}$/)) { + throw new Error("Invalid base64 string format"); + } + return base64js.toByteArray(base64String); +} +exports.fromBase64 = fromBase64; +//# sourceMappingURL=base64.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/bech32.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/bech32.js ***! + \**********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.normalizeBech32 = exports.fromBech32 = exports.toBech32 = void 0; +const bech32 = __importStar(__webpack_require__(/*! bech32 */ "./node_modules/bech32/index.js")); +function toBech32(prefix, data, limit) { + const address = bech32.encode(prefix, bech32.toWords(data), limit); + return address; +} +exports.toBech32 = toBech32; +function fromBech32(address, limit = Infinity) { + const decodedAddress = bech32.decode(address, limit); + return { + prefix: decodedAddress.prefix, + data: new Uint8Array(bech32.fromWords(decodedAddress.words)), + }; +} +exports.fromBech32 = fromBech32; +/** + * Takes a bech32 address and returns a normalized (i.e. lower case) representation of it. + * + * The input is validated along the way, which makes this significantly safer than + * using `address.toLowerCase()`. + */ +function normalizeBech32(address) { + const { prefix, data } = fromBech32(address); + return toBech32(prefix, data); +} +exports.normalizeBech32 = normalizeBech32; +//# sourceMappingURL=bech32.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/hex.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/hex.js ***! + \*******************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromHex = exports.toHex = void 0; +function toHex(data) { + let out = ""; + for (const byte of data) { + out += ("0" + byte.toString(16)).slice(-2); + } + return out; +} +exports.toHex = toHex; +function fromHex(hexstring) { + if (hexstring.length % 2 !== 0) { + throw new Error("hex string length must be a multiple of 2"); + } + const out = new Uint8Array(hexstring.length / 2); + for (let i = 0; i < out.length; i++) { + const j = 2 * i; + const hexByteAsString = hexstring.slice(j, j + 2); + if (!hexByteAsString.match(/[0-9a-f]{2}/i)) { + throw new Error("hex string contains invalid characters"); + } + out[i] = parseInt(hexByteAsString, 16); + } + return out; +} +exports.fromHex = fromHex; +//# sourceMappingURL=hex.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/index.js ***! + \*********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toUtf8 = exports.fromUtf8 = exports.toRfc3339 = exports.fromRfc3339 = exports.toHex = exports.fromHex = exports.toBech32 = exports.normalizeBech32 = exports.fromBech32 = exports.toBase64 = exports.fromBase64 = exports.toAscii = exports.fromAscii = void 0; +var ascii_1 = __webpack_require__(/*! ./ascii */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/ascii.js"); +Object.defineProperty(exports, "fromAscii", ({ enumerable: true, get: function () { return ascii_1.fromAscii; } })); +Object.defineProperty(exports, "toAscii", ({ enumerable: true, get: function () { return ascii_1.toAscii; } })); +var base64_1 = __webpack_require__(/*! ./base64 */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/base64.js"); +Object.defineProperty(exports, "fromBase64", ({ enumerable: true, get: function () { return base64_1.fromBase64; } })); +Object.defineProperty(exports, "toBase64", ({ enumerable: true, get: function () { return base64_1.toBase64; } })); +var bech32_1 = __webpack_require__(/*! ./bech32 */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/bech32.js"); +Object.defineProperty(exports, "fromBech32", ({ enumerable: true, get: function () { return bech32_1.fromBech32; } })); +Object.defineProperty(exports, "normalizeBech32", ({ enumerable: true, get: function () { return bech32_1.normalizeBech32; } })); +Object.defineProperty(exports, "toBech32", ({ enumerable: true, get: function () { return bech32_1.toBech32; } })); +var hex_1 = __webpack_require__(/*! ./hex */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/hex.js"); +Object.defineProperty(exports, "fromHex", ({ enumerable: true, get: function () { return hex_1.fromHex; } })); +Object.defineProperty(exports, "toHex", ({ enumerable: true, get: function () { return hex_1.toHex; } })); +var rfc3339_1 = __webpack_require__(/*! ./rfc3339 */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/rfc3339.js"); +Object.defineProperty(exports, "fromRfc3339", ({ enumerable: true, get: function () { return rfc3339_1.fromRfc3339; } })); +Object.defineProperty(exports, "toRfc3339", ({ enumerable: true, get: function () { return rfc3339_1.toRfc3339; } })); +var utf8_1 = __webpack_require__(/*! ./utf8 */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/utf8.js"); +Object.defineProperty(exports, "fromUtf8", ({ enumerable: true, get: function () { return utf8_1.fromUtf8; } })); +Object.defineProperty(exports, "toUtf8", ({ enumerable: true, get: function () { return utf8_1.toUtf8; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/rfc3339.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/rfc3339.js ***! + \***********************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toRfc3339 = exports.fromRfc3339 = void 0; +const rfc3339Matcher = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?((?:[+-]\d{2}:\d{2})|Z)$/; +function padded(integer, length = 2) { + return integer.toString().padStart(length, "0"); +} +function fromRfc3339(str) { + const matches = rfc3339Matcher.exec(str); + if (!matches) { + throw new Error("Date string is not in RFC3339 format"); + } + const year = +matches[1]; + const month = +matches[2]; + const day = +matches[3]; + const hour = +matches[4]; + const minute = +matches[5]; + const second = +matches[6]; + // fractional seconds match either undefined or a string like ".1", ".123456789" + const milliSeconds = matches[7] ? Math.floor(+matches[7] * 1000) : 0; + let tzOffsetSign; + let tzOffsetHours; + let tzOffsetMinutes; + // if timezone is undefined, it must be Z or nothing (otherwise the group would have captured). + if (matches[8] === "Z") { + tzOffsetSign = 1; + tzOffsetHours = 0; + tzOffsetMinutes = 0; + } + else { + tzOffsetSign = matches[8].substring(0, 1) === "-" ? -1 : 1; + tzOffsetHours = +matches[8].substring(1, 3); + tzOffsetMinutes = +matches[8].substring(4, 6); + } + const tzOffset = tzOffsetSign * (tzOffsetHours * 60 + tzOffsetMinutes) * 60; // seconds + const timestamp = Date.UTC(year, month - 1, day, hour, minute, second, milliSeconds) - tzOffset * 1000; + return new Date(timestamp); +} +exports.fromRfc3339 = fromRfc3339; +function toRfc3339(date) { + const year = date.getUTCFullYear(); + const month = padded(date.getUTCMonth() + 1); + const day = padded(date.getUTCDate()); + const hour = padded(date.getUTCHours()); + const minute = padded(date.getUTCMinutes()); + const second = padded(date.getUTCSeconds()); + const ms = padded(date.getUTCMilliseconds(), 3); + return `${year}-${month}-${day}T${hour}:${minute}:${second}.${ms}Z`; +} +exports.toRfc3339 = toRfc3339; +//# sourceMappingURL=rfc3339.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/utf8.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/encoding/build/utf8.js ***! + \********************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromUtf8 = exports.toUtf8 = void 0; +function toUtf8(str) { + return new TextEncoder().encode(str); +} +exports.toUtf8 = toUtf8; +/** + * Takes UTF-8 data and decodes it to a string. + * + * In lossy mode, the replacement character � is used to substitude invalid + * encodings. By default lossy mode is off and invalid data will lead to exceptions. + */ +function fromUtf8(data, lossy = false) { + const fatal = !lossy; + return new TextDecoder("utf-8", { fatal }).decode(data); +} +exports.fromUtf8 = fromUtf8; +//# sourceMappingURL=utf8.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/decimal.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/decimal.js ***! + \*******************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Decimal = void 0; +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +// Too large values lead to massive memory usage. Limit to something sensible. +// The largest value we need is 18 (Ether). +const maxFractionalDigits = 100; +/** + * A type for arbitrary precision, non-negative decimals. + * + * Instances of this class are immutable. + */ +class Decimal { + constructor(atomics, fractionalDigits) { + if (!atomics.match(/^[0-9]+$/)) { + throw new Error("Invalid string format. Only non-negative integers in decimal representation supported."); + } + this.data = { + atomics: new bn_js_1.default(atomics), + fractionalDigits: fractionalDigits, + }; + } + static fromUserInput(input, fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + const badCharacter = input.match(/[^0-9.]/); + if (badCharacter) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + throw new Error(`Invalid character at position ${badCharacter.index + 1}`); + } + let whole; + let fractional; + if (input === "") { + whole = "0"; + fractional = ""; + } + else if (input.search(/\./) === -1) { + // integer format, no separator + whole = input; + fractional = ""; + } + else { + const parts = input.split("."); + switch (parts.length) { + case 0: + case 1: + throw new Error("Fewer than two elements in split result. This must not happen here."); + case 2: + if (!parts[1]) + throw new Error("Fractional part missing"); + whole = parts[0]; + fractional = parts[1].replace(/0+$/, ""); + break; + default: + throw new Error("More than one separator found"); + } + } + if (fractional.length > fractionalDigits) { + throw new Error("Got more fractional digits than supported"); + } + const quantity = `${whole}${fractional.padEnd(fractionalDigits, "0")}`; + return new Decimal(quantity, fractionalDigits); + } + static fromAtomics(atomics, fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal(atomics, fractionalDigits); + } + /** + * Creates a Decimal with value 0.0 and the given number of fractial digits. + * + * Fractional digits are not relevant for the value but needed to be able + * to perform arithmetic operations with other decimals. + */ + static zero(fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal("0", fractionalDigits); + } + /** + * Creates a Decimal with value 1.0 and the given number of fractial digits. + * + * Fractional digits are not relevant for the value but needed to be able + * to perform arithmetic operations with other decimals. + */ + static one(fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal("1" + "0".repeat(fractionalDigits), fractionalDigits); + } + static verifyFractionalDigits(fractionalDigits) { + if (!Number.isInteger(fractionalDigits)) + throw new Error("Fractional digits is not an integer"); + if (fractionalDigits < 0) + throw new Error("Fractional digits must not be negative"); + if (fractionalDigits > maxFractionalDigits) { + throw new Error(`Fractional digits must not exceed ${maxFractionalDigits}`); + } + } + static compare(a, b) { + if (a.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + return a.data.atomics.cmp(new bn_js_1.default(b.atomics)); + } + get atomics() { + return this.data.atomics.toString(); + } + get fractionalDigits() { + return this.data.fractionalDigits; + } + /** Creates a new instance with the same value */ + clone() { + return new Decimal(this.atomics, this.fractionalDigits); + } + /** Returns the greatest decimal <= this which has no fractional part (rounding down) */ + floor() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return this.clone(); + } + else { + return Decimal.fromAtomics(whole.mul(factor).toString(), this.fractionalDigits); + } + } + /** Returns the smallest decimal >= this which has no fractional part (rounding up) */ + ceil() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return this.clone(); + } + else { + return Decimal.fromAtomics(whole.addn(1).mul(factor).toString(), this.fractionalDigits); + } + } + toString() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return whole.toString(); + } + else { + const fullFractionalPart = fractional.toString().padStart(this.data.fractionalDigits, "0"); + const trimmedFractionalPart = fullFractionalPart.replace(/0+$/, ""); + return `${whole.toString()}.${trimmedFractionalPart}`; + } + } + /** + * Returns an approximation as a float type. Only use this if no + * exact calculation is required. + */ + toFloatApproximation() { + const out = Number(this.toString()); + if (Number.isNaN(out)) + throw new Error("Conversion to number failed"); + return out; + } + /** + * a.plus(b) returns a+b. + * + * Both values need to have the same fractional digits. + */ + plus(b) { + if (this.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + const sum = this.data.atomics.add(new bn_js_1.default(b.atomics)); + return new Decimal(sum.toString(), this.fractionalDigits); + } + /** + * a.minus(b) returns a-b. + * + * Both values need to have the same fractional digits. + * The resulting difference needs to be non-negative. + */ + minus(b) { + if (this.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + const difference = this.data.atomics.sub(new bn_js_1.default(b.atomics)); + if (difference.ltn(0)) + throw new Error("Difference must not be negative"); + return new Decimal(difference.toString(), this.fractionalDigits); + } + /** + * a.multiply(b) returns a*b. + * + * We only allow multiplication by unsigned integers to avoid rounding errors. + */ + multiply(b) { + const product = this.data.atomics.mul(new bn_js_1.default(b.toString())); + return new Decimal(product.toString(), this.fractionalDigits); + } + equals(b) { + return Decimal.compare(this, b) === 0; + } + isLessThan(b) { + return Decimal.compare(this, b) < 0; + } + isLessThanOrEqual(b) { + return Decimal.compare(this, b) <= 0; + } + isGreaterThan(b) { + return Decimal.compare(this, b) > 0; + } + isGreaterThanOrEqual(b) { + return Decimal.compare(this, b) >= 0; + } +} +exports.Decimal = Decimal; +//# sourceMappingURL=decimal.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/index.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/index.js ***! + \*****************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Uint64 = exports.Uint53 = exports.Uint32 = exports.Int53 = exports.Decimal = void 0; +var decimal_1 = __webpack_require__(/*! ./decimal */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/decimal.js"); +Object.defineProperty(exports, "Decimal", ({ enumerable: true, get: function () { return decimal_1.Decimal; } })); +var integers_1 = __webpack_require__(/*! ./integers */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/integers.js"); +Object.defineProperty(exports, "Int53", ({ enumerable: true, get: function () { return integers_1.Int53; } })); +Object.defineProperty(exports, "Uint32", ({ enumerable: true, get: function () { return integers_1.Uint32; } })); +Object.defineProperty(exports, "Uint53", ({ enumerable: true, get: function () { return integers_1.Uint53; } })); +Object.defineProperty(exports, "Uint64", ({ enumerable: true, get: function () { return integers_1.Uint64; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/integers.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/math/build/integers.js ***! + \********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Uint64 = exports.Uint53 = exports.Int53 = exports.Uint32 = void 0; +/* eslint-disable no-bitwise */ +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +const uint64MaxValue = new bn_js_1.default("18446744073709551615", 10, "be"); +class Uint32 { + constructor(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + if (input < 0 || input > 4294967295) { + throw new Error("Input not in uint32 range: " + input.toString()); + } + this.data = input; + } + /** @deprecated use Uint32.fromBytes */ + static fromBigEndianBytes(bytes) { + return Uint32.fromBytes(bytes); + } + /** + * Creates a Uint32 from a fixed length byte array. + * + * @param bytes a list of exactly 4 bytes + * @param endianess defaults to big endian + */ + static fromBytes(bytes, endianess = "be") { + if (bytes.length !== 4) { + throw new Error("Invalid input length. Expected 4 bytes."); + } + for (let i = 0; i < bytes.length; ++i) { + if (!Number.isInteger(bytes[i]) || bytes[i] > 255 || bytes[i] < 0) { + throw new Error("Invalid value in byte. Found: " + bytes[i]); + } + } + const beBytes = endianess === "be" ? bytes : Array.from(bytes).reverse(); + // Use mulitiplication instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint32(beBytes[0] * 2 ** 24 + beBytes[1] * 2 ** 16 + beBytes[2] * 2 ** 8 + beBytes[3]); + } + static fromString(str) { + if (!str.match(/^[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Uint32(Number.parseInt(str, 10)); + } + toBytesBigEndian() { + // Use division instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint8Array([ + Math.floor(this.data / 2 ** 24) & 0xff, + Math.floor(this.data / 2 ** 16) & 0xff, + Math.floor(this.data / 2 ** 8) & 0xff, + Math.floor(this.data / 2 ** 0) & 0xff, + ]); + } + toBytesLittleEndian() { + // Use division instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint8Array([ + Math.floor(this.data / 2 ** 0) & 0xff, + Math.floor(this.data / 2 ** 8) & 0xff, + Math.floor(this.data / 2 ** 16) & 0xff, + Math.floor(this.data / 2 ** 24) & 0xff, + ]); + } + toNumber() { + return this.data; + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Uint32 = Uint32; +class Int53 { + constructor(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + if (input < Number.MIN_SAFE_INTEGER || input > Number.MAX_SAFE_INTEGER) { + throw new Error("Input not in int53 range: " + input.toString()); + } + this.data = input; + } + static fromString(str) { + if (!str.match(/^-?[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Int53(Number.parseInt(str, 10)); + } + toNumber() { + return this.data; + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Int53 = Int53; +class Uint53 { + constructor(input) { + const signed = new Int53(input); + if (signed.toNumber() < 0) { + throw new Error("Input is negative"); + } + this.data = signed; + } + static fromString(str) { + const signed = Int53.fromString(str); + return new Uint53(signed.toNumber()); + } + toNumber() { + return this.data.toNumber(); + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Uint53 = Uint53; +class Uint64 { + constructor(data) { + if (data.isNeg()) { + throw new Error("Input is negative"); + } + if (data.gt(uint64MaxValue)) { + throw new Error("Input exceeds uint64 range"); + } + this.data = data; + } + /** @deprecated use Uint64.fromBytes */ + static fromBytesBigEndian(bytes) { + return Uint64.fromBytes(bytes); + } + /** + * Creates a Uint64 from a fixed length byte array. + * + * @param bytes a list of exactly 8 bytes + * @param endianess defaults to big endian + */ + static fromBytes(bytes, endianess = "be") { + if (bytes.length !== 8) { + throw new Error("Invalid input length. Expected 8 bytes."); + } + for (let i = 0; i < bytes.length; ++i) { + if (!Number.isInteger(bytes[i]) || bytes[i] > 255 || bytes[i] < 0) { + throw new Error("Invalid value in byte. Found: " + bytes[i]); + } + } + const beBytes = endianess === "be" ? Array.from(bytes) : Array.from(bytes).reverse(); + return new Uint64(new bn_js_1.default(beBytes)); + } + static fromString(str) { + if (!str.match(/^[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Uint64(new bn_js_1.default(str, 10, "be")); + } + static fromNumber(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + let bigint; + try { + bigint = new bn_js_1.default(input); + } + catch { + throw new Error("Input is not a safe integer"); + } + return new Uint64(bigint); + } + toBytesBigEndian() { + return Uint8Array.from(this.data.toArray("be", 8)); + } + toBytesLittleEndian() { + return Uint8Array.from(this.data.toArray("le", 8)); + } + toString() { + return this.data.toString(10); + } + toBigInt() { + return BigInt(this.toString()); + } + toNumber() { + return this.data.toNumber(); + } +} +exports.Uint64 = Uint64; +// Assign classes to unused variables in order to verify static interface conformance at compile time. +// Workaround for https://github.com/microsoft/TypeScript/issues/33892 +const _int53Class = Int53; +const _uint53Class = Uint53; +const _uint32Class = Uint32; +const _uint64Class = Uint64; +//# sourceMappingURL=integers.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/arrays.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/arrays.js ***! + \*******************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.arrayContentStartsWith = exports.arrayContentEquals = void 0; +/** + * Compares the content of two arrays-like objects for equality. + * + * Equality is defined as having equal length and element values, where element equality means `===` returning `true`. + * + * This allows you to compare the content of a Buffer, Uint8Array or number[], ignoring the specific type. + * As a consequence, this returns different results than Jasmine's `toEqual`, which ensures elements have the same type. + */ +function arrayContentEquals(a, b) { + if (a.length !== b.length) + return false; + for (let i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; +} +exports.arrayContentEquals = arrayContentEquals; +/** + * Checks if `a` starts with the contents of `b`. + * + * This requires equality of the element values, where element equality means `===` returning `true`. + * + * This allows you to compare the content of a Buffer, Uint8Array or number[], ignoring the specific type. + * As a consequence, this returns different results than Jasmine's `toEqual`, which ensures elements have the same type. + */ +function arrayContentStartsWith(a, b) { + if (a.length < b.length) + return false; + for (let i = 0; i < b.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; +} +exports.arrayContentStartsWith = arrayContentStartsWith; +//# sourceMappingURL=arrays.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/assert.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/assert.js ***! + \*******************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.assertDefinedAndNotNull = exports.assertDefined = exports.assert = void 0; +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function assert(condition, msg) { + if (!condition) { + throw new Error(msg || "condition is not truthy"); + } +} +exports.assert = assert; +function assertDefined(value, msg) { + if (value === undefined) { + throw new Error(msg ?? "value is undefined"); + } +} +exports.assertDefined = assertDefined; +function assertDefinedAndNotNull(value, msg) { + if (value === undefined || value === null) { + throw new Error(msg ?? "value is undefined or null"); + } +} +exports.assertDefinedAndNotNull = assertDefinedAndNotNull; +//# sourceMappingURL=assert.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/index.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/index.js ***! + \******************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isUint8Array = exports.isNonNullObject = exports.isDefined = exports.sleep = exports.assertDefinedAndNotNull = exports.assertDefined = exports.assert = exports.arrayContentStartsWith = exports.arrayContentEquals = void 0; +var arrays_1 = __webpack_require__(/*! ./arrays */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/arrays.js"); +Object.defineProperty(exports, "arrayContentEquals", ({ enumerable: true, get: function () { return arrays_1.arrayContentEquals; } })); +Object.defineProperty(exports, "arrayContentStartsWith", ({ enumerable: true, get: function () { return arrays_1.arrayContentStartsWith; } })); +var assert_1 = __webpack_require__(/*! ./assert */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/assert.js"); +Object.defineProperty(exports, "assert", ({ enumerable: true, get: function () { return assert_1.assert; } })); +Object.defineProperty(exports, "assertDefined", ({ enumerable: true, get: function () { return assert_1.assertDefined; } })); +Object.defineProperty(exports, "assertDefinedAndNotNull", ({ enumerable: true, get: function () { return assert_1.assertDefinedAndNotNull; } })); +var sleep_1 = __webpack_require__(/*! ./sleep */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/sleep.js"); +Object.defineProperty(exports, "sleep", ({ enumerable: true, get: function () { return sleep_1.sleep; } })); +var typechecks_1 = __webpack_require__(/*! ./typechecks */ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/typechecks.js"); +Object.defineProperty(exports, "isDefined", ({ enumerable: true, get: function () { return typechecks_1.isDefined; } })); +Object.defineProperty(exports, "isNonNullObject", ({ enumerable: true, get: function () { return typechecks_1.isNonNullObject; } })); +Object.defineProperty(exports, "isUint8Array", ({ enumerable: true, get: function () { return typechecks_1.isUint8Array; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/sleep.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/sleep.js ***! + \******************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.sleep = void 0; +async function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} +exports.sleep = sleep; +//# sourceMappingURL=sleep.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/typechecks.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@cosmjs/amino/node_modules/@cosmjs/utils/build/typechecks.js ***! + \***********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isDefined = exports.isUint8Array = exports.isNonNullObject = void 0; +/** + * Checks if data is a non-null object (i.e. matches the TypeScript object type). + * + * Note: this returns true for arrays, which are objects in JavaScript + * even though array and object are different types in JSON. + * + * @see https://www.typescriptlang.org/docs/handbook/basic-types.html#object + */ +// eslint-disable-next-line @typescript-eslint/ban-types +function isNonNullObject(data) { + return typeof data === "object" && data !== null; +} +exports.isNonNullObject = isNonNullObject; +/** + * Checks if data is an Uint8Array. Note: Buffer is treated as not a Uint8Array + */ +function isUint8Array(data) { + if (!isNonNullObject(data)) + return false; + // Avoid instanceof check which is unreliable in some JS environments + // https://medium.com/@simonwarta/limitations-of-the-instanceof-operator-f4bcdbe7a400 + // Use check that was discussed in https://github.com/crypto-browserify/pbkdf2/pull/81 + if (Object.prototype.toString.call(data) !== "[object Uint8Array]") + return false; + if (typeof Buffer !== "undefined" && typeof Buffer.isBuffer !== "undefined") { + // Buffer.isBuffer is available at runtime + if (Buffer.isBuffer(data)) + return false; + } + return true; +} +exports.isUint8Array = isUint8Array; +/** + * Checks if input is not undefined in a TypeScript-friendly way. + * + * This is convenient to use in e.g. `Array.filter` as it will convert + * the type of a `Array` to `Array`. + */ +function isDefined(value) { + return value !== undefined; +} +exports.isDefined = isDefined; +//# sourceMappingURL=typechecks.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/encoding/build/ascii.js": +/*!******************************************************!*\ + !*** ./node_modules/@cosmjs/encoding/build/ascii.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromAscii = exports.toAscii = void 0; +function toAscii(input) { + const toNums = (str) => str.split("").map((x) => { + const charCode = x.charCodeAt(0); + // 0x00–0x1F control characters + // 0x20–0x7E printable characters + // 0x7F delete character + // 0x80–0xFF out of 7 bit ascii range + if (charCode < 0x20 || charCode > 0x7e) { + throw new Error("Cannot encode character that is out of printable ASCII range: " + charCode); + } + return charCode; + }); + return Uint8Array.from(toNums(input)); +} +exports.toAscii = toAscii; +function fromAscii(data) { + const fromNums = (listOfNumbers) => listOfNumbers.map((x) => { + // 0x00–0x1F control characters + // 0x20–0x7E printable characters + // 0x7F delete character + // 0x80–0xFF out of 7 bit ascii range + if (x < 0x20 || x > 0x7e) { + throw new Error("Cannot decode character that is out of printable ASCII range: " + x); + } + return String.fromCharCode(x); + }); + return fromNums(Array.from(data)).join(""); +} +exports.fromAscii = fromAscii; +//# sourceMappingURL=ascii.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/encoding/build/base64.js": +/*!*******************************************************!*\ + !*** ./node_modules/@cosmjs/encoding/build/base64.js ***! + \*******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromBase64 = exports.toBase64 = void 0; +const base64js = __importStar(__webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")); +function toBase64(data) { + return base64js.fromByteArray(data); +} +exports.toBase64 = toBase64; +function fromBase64(base64String) { + if (!base64String.match(/^[a-zA-Z0-9+/]*={0,2}$/)) { + throw new Error("Invalid base64 string format"); + } + return base64js.toByteArray(base64String); +} +exports.fromBase64 = fromBase64; +//# sourceMappingURL=base64.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/encoding/build/bech32.js": +/*!*******************************************************!*\ + !*** ./node_modules/@cosmjs/encoding/build/bech32.js ***! + \*******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Bech32 = exports.normalizeBech32 = exports.fromBech32 = exports.toBech32 = void 0; +const bech32 = __importStar(__webpack_require__(/*! bech32 */ "./node_modules/bech32/index.js")); +function toBech32(prefix, data, limit) { + const address = bech32.encode(prefix, bech32.toWords(data), limit); + return address; +} +exports.toBech32 = toBech32; +function fromBech32(address, limit = Infinity) { + const decodedAddress = bech32.decode(address, limit); + return { + prefix: decodedAddress.prefix, + data: new Uint8Array(bech32.fromWords(decodedAddress.words)), + }; +} +exports.fromBech32 = fromBech32; +/** + * Takes a bech32 address and returns a normalized (i.e. lower case) representation of it. + * + * The input is validated along the way, which makes this significantly safer than + * using `address.toLowerCase()`. + */ +function normalizeBech32(address) { + const { prefix, data } = fromBech32(address); + return toBech32(prefix, data); +} +exports.normalizeBech32 = normalizeBech32; +/** + * @deprecated This class is deprecated and will be removed soon. Please use fromBech32() and toBech32() instead. For more details please refer to https://github.com/cosmos/cosmjs/issues/1053. + */ +class Bech32 { + /** + * @deprecated This class is deprecated and will be removed soon. Please use fromBech32() and toBech32() instead. For more details please refer to https://github.com/cosmos/cosmjs/issues/1053. + */ + static encode(prefix, data, limit) { + return toBech32(prefix, data, limit); + } + /** + * @deprecated This class is deprecated and will be removed soon. Please use fromBech32() and toBech32() instead. For more details please refer to https://github.com/cosmos/cosmjs/issues/1053. + */ + static decode(address, limit = Infinity) { + return fromBech32(address, limit); + } +} +exports.Bech32 = Bech32; +//# sourceMappingURL=bech32.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/encoding/build/hex.js": +/*!****************************************************!*\ + !*** ./node_modules/@cosmjs/encoding/build/hex.js ***! + \****************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromHex = exports.toHex = void 0; +function toHex(data) { + let out = ""; + for (const byte of data) { + out += ("0" + byte.toString(16)).slice(-2); + } + return out; +} +exports.toHex = toHex; +function fromHex(hexstring) { + if (hexstring.length % 2 !== 0) { + throw new Error("hex string length must be a multiple of 2"); + } + const out = new Uint8Array(hexstring.length / 2); + for (let i = 0; i < out.length; i++) { + const j = 2 * i; + const hexByteAsString = hexstring.slice(j, j + 2); + if (!hexByteAsString.match(/[0-9a-f]{2}/i)) { + throw new Error("hex string contains invalid characters"); + } + out[i] = parseInt(hexByteAsString, 16); + } + return out; +} +exports.fromHex = fromHex; +//# sourceMappingURL=hex.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/encoding/build/index.js": +/*!******************************************************!*\ + !*** ./node_modules/@cosmjs/encoding/build/index.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toUtf8 = exports.fromUtf8 = exports.toRfc3339 = exports.fromRfc3339 = exports.toHex = exports.fromHex = exports.toBech32 = exports.normalizeBech32 = exports.fromBech32 = exports.Bech32 = exports.toBase64 = exports.fromBase64 = exports.toAscii = exports.fromAscii = void 0; +var ascii_1 = __webpack_require__(/*! ./ascii */ "./node_modules/@cosmjs/encoding/build/ascii.js"); +Object.defineProperty(exports, "fromAscii", ({ enumerable: true, get: function () { return ascii_1.fromAscii; } })); +Object.defineProperty(exports, "toAscii", ({ enumerable: true, get: function () { return ascii_1.toAscii; } })); +var base64_1 = __webpack_require__(/*! ./base64 */ "./node_modules/@cosmjs/encoding/build/base64.js"); +Object.defineProperty(exports, "fromBase64", ({ enumerable: true, get: function () { return base64_1.fromBase64; } })); +Object.defineProperty(exports, "toBase64", ({ enumerable: true, get: function () { return base64_1.toBase64; } })); +var bech32_1 = __webpack_require__(/*! ./bech32 */ "./node_modules/@cosmjs/encoding/build/bech32.js"); +Object.defineProperty(exports, "Bech32", ({ enumerable: true, get: function () { return bech32_1.Bech32; } })); +Object.defineProperty(exports, "fromBech32", ({ enumerable: true, get: function () { return bech32_1.fromBech32; } })); +Object.defineProperty(exports, "normalizeBech32", ({ enumerable: true, get: function () { return bech32_1.normalizeBech32; } })); +Object.defineProperty(exports, "toBech32", ({ enumerable: true, get: function () { return bech32_1.toBech32; } })); +var hex_1 = __webpack_require__(/*! ./hex */ "./node_modules/@cosmjs/encoding/build/hex.js"); +Object.defineProperty(exports, "fromHex", ({ enumerable: true, get: function () { return hex_1.fromHex; } })); +Object.defineProperty(exports, "toHex", ({ enumerable: true, get: function () { return hex_1.toHex; } })); +var rfc3339_1 = __webpack_require__(/*! ./rfc3339 */ "./node_modules/@cosmjs/encoding/build/rfc3339.js"); +Object.defineProperty(exports, "fromRfc3339", ({ enumerable: true, get: function () { return rfc3339_1.fromRfc3339; } })); +Object.defineProperty(exports, "toRfc3339", ({ enumerable: true, get: function () { return rfc3339_1.toRfc3339; } })); +var utf8_1 = __webpack_require__(/*! ./utf8 */ "./node_modules/@cosmjs/encoding/build/utf8.js"); +Object.defineProperty(exports, "fromUtf8", ({ enumerable: true, get: function () { return utf8_1.fromUtf8; } })); +Object.defineProperty(exports, "toUtf8", ({ enumerable: true, get: function () { return utf8_1.toUtf8; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/encoding/build/rfc3339.js": +/*!********************************************************!*\ + !*** ./node_modules/@cosmjs/encoding/build/rfc3339.js ***! + \********************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toRfc3339 = exports.fromRfc3339 = void 0; +const rfc3339Matcher = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?((?:[+-]\d{2}:\d{2})|Z)$/; +function padded(integer, length = 2) { + return integer.toString().padStart(length, "0"); +} +function fromRfc3339(str) { + const matches = rfc3339Matcher.exec(str); + if (!matches) { + throw new Error("Date string is not in RFC3339 format"); + } + const year = +matches[1]; + const month = +matches[2]; + const day = +matches[3]; + const hour = +matches[4]; + const minute = +matches[5]; + const second = +matches[6]; + // fractional seconds match either undefined or a string like ".1", ".123456789" + const milliSeconds = matches[7] ? Math.floor(+matches[7] * 1000) : 0; + let tzOffsetSign; + let tzOffsetHours; + let tzOffsetMinutes; + // if timezone is undefined, it must be Z or nothing (otherwise the group would have captured). + if (matches[8] === "Z") { + tzOffsetSign = 1; + tzOffsetHours = 0; + tzOffsetMinutes = 0; + } + else { + tzOffsetSign = matches[8].substring(0, 1) === "-" ? -1 : 1; + tzOffsetHours = +matches[8].substring(1, 3); + tzOffsetMinutes = +matches[8].substring(4, 6); + } + const tzOffset = tzOffsetSign * (tzOffsetHours * 60 + tzOffsetMinutes) * 60; // seconds + const timestamp = Date.UTC(year, month - 1, day, hour, minute, second, milliSeconds) - tzOffset * 1000; + return new Date(timestamp); +} +exports.fromRfc3339 = fromRfc3339; +function toRfc3339(date) { + const year = date.getUTCFullYear(); + const month = padded(date.getUTCMonth() + 1); + const day = padded(date.getUTCDate()); + const hour = padded(date.getUTCHours()); + const minute = padded(date.getUTCMinutes()); + const second = padded(date.getUTCSeconds()); + const ms = padded(date.getUTCMilliseconds(), 3); + return `${year}-${month}-${day}T${hour}:${minute}:${second}.${ms}Z`; +} +exports.toRfc3339 = toRfc3339; +//# sourceMappingURL=rfc3339.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/encoding/build/utf8.js": +/*!*****************************************************!*\ + !*** ./node_modules/@cosmjs/encoding/build/utf8.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromUtf8 = exports.toUtf8 = void 0; +function toUtf8(str) { + return new TextEncoder().encode(str); +} +exports.toUtf8 = toUtf8; +/** + * Takes UTF-8 data and decodes it to a string. + * + * In lossy mode, the replacement character � is used to substitude invalid + * encodings. By default lossy mode is off and invalid data will lead to exceptions. + */ +function fromUtf8(data, lossy = false) { + const fatal = !lossy; + return new TextDecoder("utf-8", { fatal }).decode(data); +} +exports.fromUtf8 = fromUtf8; +//# sourceMappingURL=utf8.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/build/compatibility.js": +/*!**************************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/build/compatibility.js ***! + \**************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isJsonCompatibleDictionary = exports.isJsonCompatibleArray = exports.isJsonCompatibleValue = void 0; +function isJsonCompatibleValue(value) { + if (typeof value === "string" || + typeof value === "number" || + typeof value === "boolean" || + value === null || + // eslint-disable-next-line @typescript-eslint/no-use-before-define + isJsonCompatibleArray(value) || + // eslint-disable-next-line @typescript-eslint/no-use-before-define + isJsonCompatibleDictionary(value)) { + return true; + } + else { + return false; + } +} +exports.isJsonCompatibleValue = isJsonCompatibleValue; +function isJsonCompatibleArray(value) { + if (!Array.isArray(value)) { + return false; + } + for (const item of value) { + if (!isJsonCompatibleValue(item)) { + return false; + } + } + // all items okay + return true; +} +exports.isJsonCompatibleArray = isJsonCompatibleArray; +function isJsonCompatibleDictionary(data) { + if (typeof data !== "object" || data === null) { + // data must be a non-null object + return false; + } + // Exclude special kind of objects like Array, Date or Uint8Array + // Object.prototype.toString() returns a specified value: + // http://www.ecma-international.org/ecma-262/7.0/index.html#sec-object.prototype.tostring + if (Object.prototype.toString.call(data) !== "[object Object]") { + return false; + } + return Object.values(data).every(isJsonCompatibleValue); +} +exports.isJsonCompatibleDictionary = isJsonCompatibleDictionary; +//# sourceMappingURL=compatibility.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/build/id.js": +/*!***************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/build/id.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.makeJsonRpcId = void 0; +// Start with 10001 to avoid possible collisions with all hand-selected values like e.g. 1,2,3,42,100 +let counter = 10000; +/** + * Creates a new ID to be used for creating a JSON-RPC request. + * + * Multiple calls of this produce unique values. + * + * The output may be any value compatible to JSON-RPC request IDs with an undefined output format and generation logic. + */ +function makeJsonRpcId() { + return (counter += 1); +} +exports.makeJsonRpcId = makeJsonRpcId; +//# sourceMappingURL=id.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/build/index.js": +/*!******************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/build/index.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.jsonRpcCode = exports.isJsonRpcSuccessResponse = exports.isJsonRpcErrorResponse = exports.parseJsonRpcSuccessResponse = exports.parseJsonRpcResponse = exports.parseJsonRpcRequest = exports.parseJsonRpcId = exports.parseJsonRpcErrorResponse = exports.JsonRpcClient = exports.makeJsonRpcId = void 0; +var id_1 = __webpack_require__(/*! ./id */ "./node_modules/@cosmjs/json-rpc/build/id.js"); +Object.defineProperty(exports, "makeJsonRpcId", ({ enumerable: true, get: function () { return id_1.makeJsonRpcId; } })); +var jsonrpcclient_1 = __webpack_require__(/*! ./jsonrpcclient */ "./node_modules/@cosmjs/json-rpc/build/jsonrpcclient.js"); +Object.defineProperty(exports, "JsonRpcClient", ({ enumerable: true, get: function () { return jsonrpcclient_1.JsonRpcClient; } })); +var parse_1 = __webpack_require__(/*! ./parse */ "./node_modules/@cosmjs/json-rpc/build/parse.js"); +Object.defineProperty(exports, "parseJsonRpcErrorResponse", ({ enumerable: true, get: function () { return parse_1.parseJsonRpcErrorResponse; } })); +Object.defineProperty(exports, "parseJsonRpcId", ({ enumerable: true, get: function () { return parse_1.parseJsonRpcId; } })); +Object.defineProperty(exports, "parseJsonRpcRequest", ({ enumerable: true, get: function () { return parse_1.parseJsonRpcRequest; } })); +Object.defineProperty(exports, "parseJsonRpcResponse", ({ enumerable: true, get: function () { return parse_1.parseJsonRpcResponse; } })); +Object.defineProperty(exports, "parseJsonRpcSuccessResponse", ({ enumerable: true, get: function () { return parse_1.parseJsonRpcSuccessResponse; } })); +var types_1 = __webpack_require__(/*! ./types */ "./node_modules/@cosmjs/json-rpc/build/types.js"); +Object.defineProperty(exports, "isJsonRpcErrorResponse", ({ enumerable: true, get: function () { return types_1.isJsonRpcErrorResponse; } })); +Object.defineProperty(exports, "isJsonRpcSuccessResponse", ({ enumerable: true, get: function () { return types_1.isJsonRpcSuccessResponse; } })); +Object.defineProperty(exports, "jsonRpcCode", ({ enumerable: true, get: function () { return types_1.jsonRpcCode; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/build/jsonrpcclient.js": +/*!**************************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/build/jsonrpcclient.js ***! + \**************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.JsonRpcClient = void 0; +const stream_1 = __webpack_require__(/*! @cosmjs/stream */ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/index.js"); +const types_1 = __webpack_require__(/*! ./types */ "./node_modules/@cosmjs/json-rpc/build/types.js"); +/** + * A thin wrapper that is used to bring together requests and responses by ID. + * + * Using this class is only advised for continous communication channels like + * WebSockets or WebWorker messaging. + */ +class JsonRpcClient { + constructor(connection) { + this.connection = connection; + } + async run(request) { + const filteredStream = this.connection.responseStream.filter((r) => r.id === request.id); + const pendingResponses = (0, stream_1.firstEvent)(filteredStream); + this.connection.sendRequest(request); + const response = await pendingResponses; + if ((0, types_1.isJsonRpcErrorResponse)(response)) { + const error = response.error; + throw new Error(`JSON RPC error: code=${error.code}; message='${error.message}'`); + } + return response; + } +} +exports.JsonRpcClient = JsonRpcClient; +//# sourceMappingURL=jsonrpcclient.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/build/parse.js": +/*!******************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/build/parse.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.parseJsonRpcResponse = exports.parseJsonRpcSuccessResponse = exports.parseJsonRpcErrorResponse = exports.parseJsonRpcRequest = exports.parseJsonRpcId = void 0; +const compatibility_1 = __webpack_require__(/*! ./compatibility */ "./node_modules/@cosmjs/json-rpc/build/compatibility.js"); +/** + * Extracts ID field from request or response object. + * + * Returns `null` when no valid ID was found. + */ +function parseJsonRpcId(data) { + if (!(0, compatibility_1.isJsonCompatibleDictionary)(data)) { + throw new Error("Data must be JSON compatible dictionary"); + } + const id = data.id; + if (typeof id !== "number" && typeof id !== "string") { + return null; + } + return id; +} +exports.parseJsonRpcId = parseJsonRpcId; +function parseJsonRpcRequest(data) { + if (!(0, compatibility_1.isJsonCompatibleDictionary)(data)) { + throw new Error("Data must be JSON compatible dictionary"); + } + if (data.jsonrpc !== "2.0") { + throw new Error(`Got unexpected jsonrpc version: ${data.jsonrpc}`); + } + const id = parseJsonRpcId(data); + if (id === null) { + throw new Error("Invalid id field"); + } + const method = data.method; + if (typeof method !== "string") { + throw new Error("Invalid method field"); + } + if (!(0, compatibility_1.isJsonCompatibleArray)(data.params) && !(0, compatibility_1.isJsonCompatibleDictionary)(data.params)) { + throw new Error("Invalid params field"); + } + return { + jsonrpc: "2.0", + id: id, + method: method, + params: data.params, + }; +} +exports.parseJsonRpcRequest = parseJsonRpcRequest; +function parseError(error) { + if (typeof error.code !== "number") { + throw new Error("Error property 'code' is not a number"); + } + if (typeof error.message !== "string") { + throw new Error("Error property 'message' is not a string"); + } + let maybeUndefinedData; + if (error.data === undefined) { + maybeUndefinedData = undefined; + } + else if ((0, compatibility_1.isJsonCompatibleValue)(error.data)) { + maybeUndefinedData = error.data; + } + else { + throw new Error("Error property 'data' is defined but not a JSON compatible value."); + } + return { + code: error.code, + message: error.message, + ...(maybeUndefinedData !== undefined ? { data: maybeUndefinedData } : {}), + }; +} +/** Throws if data is not a JsonRpcErrorResponse */ +function parseJsonRpcErrorResponse(data) { + if (!(0, compatibility_1.isJsonCompatibleDictionary)(data)) { + throw new Error("Data must be JSON compatible dictionary"); + } + if (data.jsonrpc !== "2.0") { + throw new Error(`Got unexpected jsonrpc version: ${JSON.stringify(data)}`); + } + const id = data.id; + if (typeof id !== "number" && typeof id !== "string" && id !== null) { + throw new Error("Invalid id field"); + } + if (typeof data.error === "undefined" || !(0, compatibility_1.isJsonCompatibleDictionary)(data.error)) { + throw new Error("Invalid error field"); + } + return { + jsonrpc: "2.0", + id: id, + error: parseError(data.error), + }; +} +exports.parseJsonRpcErrorResponse = parseJsonRpcErrorResponse; +/** Throws if data is not a JsonRpcSuccessResponse */ +function parseJsonRpcSuccessResponse(data) { + if (!(0, compatibility_1.isJsonCompatibleDictionary)(data)) { + throw new Error("Data must be JSON compatible dictionary"); + } + if (data.jsonrpc !== "2.0") { + throw new Error(`Got unexpected jsonrpc version: ${JSON.stringify(data)}`); + } + const id = data.id; + if (typeof id !== "number" && typeof id !== "string") { + throw new Error("Invalid id field"); + } + if (typeof data.result === "undefined") { + throw new Error("Invalid result field"); + } + const result = data.result; + return { + jsonrpc: "2.0", + id: id, + result: result, + }; +} +exports.parseJsonRpcSuccessResponse = parseJsonRpcSuccessResponse; +/** + * Returns a JsonRpcErrorResponse if input can be parsed as a JSON-RPC error. Otherwise parses + * input as JsonRpcSuccessResponse. Throws if input is neither a valid error nor success response. + */ +function parseJsonRpcResponse(data) { + let response; + try { + response = parseJsonRpcErrorResponse(data); + } + catch (_) { + response = parseJsonRpcSuccessResponse(data); + } + return response; +} +exports.parseJsonRpcResponse = parseJsonRpcResponse; +//# sourceMappingURL=parse.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/build/types.js": +/*!******************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/build/types.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.jsonRpcCode = exports.isJsonRpcSuccessResponse = exports.isJsonRpcErrorResponse = void 0; +function isJsonRpcErrorResponse(response) { + return typeof response.error === "object"; +} +exports.isJsonRpcErrorResponse = isJsonRpcErrorResponse; +function isJsonRpcSuccessResponse(response) { + return !isJsonRpcErrorResponse(response); +} +exports.isJsonRpcSuccessResponse = isJsonRpcSuccessResponse; +/** + * Error codes as specified in JSON-RPC 2.0 + * + * @see https://www.jsonrpc.org/specification#error_object + */ +exports.jsonRpcCode = { + parseError: -32700, + invalidRequest: -32600, + methodNotFound: -32601, + invalidParams: -32602, + internalError: -32603, + // server error (Reserved for implementation-defined server-errors.): + // -32000 to -32099 + serverError: { + default: -32000, + }, +}; +//# sourceMappingURL=types.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/concat.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/concat.js ***! + \***********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.concat = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +/** + * An implementation of concat that buffers all source stream events + * + * Marble diagram: + * + * ```text + * --1--2---3---4-| + * -a--b-c--d-| + * --------X---------Y---------Z- + * concat + * --1--2---3---4-abcdXY-------Z- + * ``` + * + * This is inspired by RxJS's concat as documented at http://rxmarbles.com/#concat and behaves + * differently than xstream's concat as discussed in https://github.com/staltz/xstream/issues/170. + * + */ +function concat(...streams) { + const subscriptions = new Array(); + const queues = new Array(); // one queue per stream + const completedStreams = new Set(); + let activeStreamIndex = 0; + function reset() { + while (subscriptions.length > 0) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const subscription = subscriptions.shift(); + subscription.unsubscribe(); + } + queues.length = 0; + completedStreams.clear(); + activeStreamIndex = 0; + } + const producer = { + start: (listener) => { + streams.forEach((_) => queues.push([])); + function emitAllQueuesEvents(streamIndex) { + // eslint-disable-next-line no-constant-condition + while (true) { + const element = queues[streamIndex].shift(); + if (element === undefined) { + return; + } + listener.next(element); + } + } + function isDone() { + return activeStreamIndex >= streams.length; + } + if (isDone()) { + listener.complete(); + return; + } + streams.forEach((stream, index) => { + subscriptions.push(stream.subscribe({ + next: (value) => { + if (index === activeStreamIndex) { + listener.next(value); + } + else { + queues[index].push(value); + } + }, + complete: () => { + completedStreams.add(index); + while (completedStreams.has(activeStreamIndex)) { + // this stream completed: emit all and move on + emitAllQueuesEvents(activeStreamIndex); + activeStreamIndex++; + } + if (isDone()) { + listener.complete(); + } + else { + // now active stream can have some events queued but did not yet complete + emitAllQueuesEvents(activeStreamIndex); + } + }, + error: (error) => { + listener.error(error); + reset(); + }, + })); + }); + }, + stop: () => { + reset(); + }, + }; + return xstream_1.Stream.create(producer); +} +exports.concat = concat; +//# sourceMappingURL=concat.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/defaultvalueproducer.js": +/*!*************************************************************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/defaultvalueproducer.js ***! + \*************************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DefaultValueProducer = void 0; +// allows pre-producing values before anyone is listening +class DefaultValueProducer { + constructor(value, callbacks) { + this.callbacks = callbacks; + this.internalValue = value; + } + get value() { + return this.internalValue; + } + /** + * Update the current value. + * + * If producer is active (i.e. someone is listening), this emits an event. + * If not, just the current value is updated. + */ + update(value) { + this.internalValue = value; + if (this.listener) { + this.listener.next(value); + } + } + /** + * Produce an error + */ + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + error(error) { + if (this.listener) { + this.listener.error(error); + } + } + /** + * Called by the stream. Do not call this directly. + */ + start(listener) { + this.listener = listener; + listener.next(this.internalValue); + if (this.callbacks) { + this.callbacks.onStarted(); + } + } + /** + * Called by the stream. Do not call this directly. + */ + stop() { + if (this.callbacks) { + this.callbacks.onStop(); + } + this.listener = undefined; + } +} +exports.DefaultValueProducer = DefaultValueProducer; +//# sourceMappingURL=defaultvalueproducer.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/dropduplicates.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/dropduplicates.js ***! + \*******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.dropDuplicates = void 0; +/** + * Drops duplicate values in a stream. + * + * Marble diagram: + * + * ```text + * -1-1-1-2-4-3-3-4-- + * dropDuplicates + * -1-----2-4-3------ + * ``` + * + * Each value must be uniquely identified by a string given by + * valueToKey(value). + * + * Internally this maintains a set of keys that have been processed already, + * i.e. memory consumption and Set lookup times should be considered when + * using this function. + */ +function dropDuplicates(valueToKey) { + const operand = (instream) => { + const emittedKeys = new Set(); + const deduplicatedStream = instream + .filter((value) => !emittedKeys.has(valueToKey(value))) + .debug((value) => emittedKeys.add(valueToKey(value))); + return deduplicatedStream; + }; + return operand; +} +exports.dropDuplicates = dropDuplicates; +//# sourceMappingURL=dropduplicates.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/index.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/index.js ***! + \**********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ValueAndUpdates = exports.toListPromise = exports.fromListPromise = exports.firstEvent = exports.dropDuplicates = exports.DefaultValueProducer = exports.concat = void 0; +var concat_1 = __webpack_require__(/*! ./concat */ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/concat.js"); +Object.defineProperty(exports, "concat", ({ enumerable: true, get: function () { return concat_1.concat; } })); +var defaultvalueproducer_1 = __webpack_require__(/*! ./defaultvalueproducer */ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/defaultvalueproducer.js"); +Object.defineProperty(exports, "DefaultValueProducer", ({ enumerable: true, get: function () { return defaultvalueproducer_1.DefaultValueProducer; } })); +var dropduplicates_1 = __webpack_require__(/*! ./dropduplicates */ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/dropduplicates.js"); +Object.defineProperty(exports, "dropDuplicates", ({ enumerable: true, get: function () { return dropduplicates_1.dropDuplicates; } })); +var promise_1 = __webpack_require__(/*! ./promise */ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/promise.js"); +Object.defineProperty(exports, "firstEvent", ({ enumerable: true, get: function () { return promise_1.firstEvent; } })); +Object.defineProperty(exports, "fromListPromise", ({ enumerable: true, get: function () { return promise_1.fromListPromise; } })); +Object.defineProperty(exports, "toListPromise", ({ enumerable: true, get: function () { return promise_1.toListPromise; } })); +__exportStar(__webpack_require__(/*! ./reducer */ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/reducer.js"), exports); +var valueandupdates_1 = __webpack_require__(/*! ./valueandupdates */ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/valueandupdates.js"); +Object.defineProperty(exports, "ValueAndUpdates", ({ enumerable: true, get: function () { return valueandupdates_1.ValueAndUpdates; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/promise.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/promise.js ***! + \************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.firstEvent = exports.toListPromise = exports.fromListPromise = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +/** + * Emits one event for each list element as soon as the promise resolves + */ +function fromListPromise(promise) { + const producer = { + start: (listener) => { + // the code in `start` runs as soon as anyone listens to the stream + promise + .then((iterable) => { + for (const element of iterable) { + listener.next(element); + } + listener.complete(); + }) + .catch((error) => listener.error(error)); + }, + // eslint-disable-next-line @typescript-eslint/no-empty-function + stop: () => { }, + }; + return xstream_1.Stream.create(producer); +} +exports.fromListPromise = fromListPromise; +/** + * Listens to stream and collects events. When `count` events are collected, + * the promise resolves with an array of events. + * + * Rejects if stream completes before `count` events are collected. + */ +async function toListPromise(stream, count) { + return new Promise((resolve, reject) => { + if (count === 0) { + resolve([]); + return; + } + const events = new Array(); + // take() unsubscribes from source stream automatically + stream.take(count).subscribe({ + next: (event) => { + events.push(event); + if (events.length === count) { + resolve(events); + } + }, + complete: () => { + reject(`Stream completed before all events could be collected. ` + + `Collected ${events.length}, expected ${count}`); + }, + error: (error) => reject(error), + }); + }); +} +exports.toListPromise = toListPromise; +/** + * Listens to stream, collects one event and revolves. + * + * Rejects if stream completes before one event was fired. + */ +async function firstEvent(stream) { + return (await toListPromise(stream, 1))[0]; +} +exports.firstEvent = firstEvent; +//# sourceMappingURL=promise.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/reducer.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/reducer.js ***! + \************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.lastValue = exports.asArray = exports.countStream = exports.Reducer = void 0; +// Reducer takes a stream of events T and a ReducerFunc, that +// materializes a state of type U. +class Reducer { + constructor(stream, reducer, initState) { + this.stream = stream; + this.reducer = reducer; + this.state = initState; + this.completed = new Promise((resolve, reject) => { + const subscription = this.stream.subscribe({ + next: (evt) => { + this.state = this.reducer(this.state, evt); + }, + complete: () => { + resolve(); + // this must happen after resolve, to ensure stream.subscribe() has finished + subscription.unsubscribe(); + }, + error: (err) => { + reject(err); + // the stream already closed on error, but unsubscribe to be safe + subscription.unsubscribe(); + }, + }); + }); + } + // value returns current materialized state + value() { + return this.state; + } + // finished resolves on completed stream, rejects on stream error + async finished() { + return this.completed; + } +} +exports.Reducer = Reducer; +function increment(sum, _) { + return sum + 1; +} +// countStream returns a reducer that contains current count +// of events on the stream +function countStream(stream) { + return new Reducer(stream, increment, 0); +} +exports.countStream = countStream; +function append(list, evt) { + return [...list, evt]; +} +// asArray maintains an array containing all events that have +// occurred on the stream +function asArray(stream) { + return new Reducer(stream, append, []); +} +exports.asArray = asArray; +function last(_, event) { + return event; +} +// lastValue returns the last value read from the stream, or undefined if no values sent +function lastValue(stream) { + return new Reducer(stream, last, undefined); +} +exports.lastValue = lastValue; +//# sourceMappingURL=reducer.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/valueandupdates.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/json-rpc/node_modules/@cosmjs/stream/build/valueandupdates.js ***! + \********************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ValueAndUpdates = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +/** + * A read only wrapper around DefaultValueProducer that allows + * to synchronously get the current value using the .value property + * and listen to to updates by suscribing to the .updates stream + */ +class ValueAndUpdates { + constructor(producer) { + this.producer = producer; + this.updates = xstream_1.MemoryStream.createWithMemory(this.producer); + } + get value() { + return this.producer.value; + } + /** + * Resolves as soon as search value is found. + * + * @param search either a value or a function that must return true when found + * @returns the value of the update that caused the search match + */ + async waitFor(search) { + const searchImplementation = typeof search === "function" ? search : (value) => value === search; + return new Promise((resolve, reject) => { + const subscription = this.updates.subscribe({ + next: (newValue) => { + if (searchImplementation(newValue)) { + resolve(newValue); + // MemoryStream.subscribe() calls next with the last value. + // Make async to ensure the subscription exists + setTimeout(() => subscription.unsubscribe(), 0); + } + }, + complete: () => { + subscription.unsubscribe(); + reject("Update stream completed without expected value"); + }, + error: (error) => { + reject(error); + }, + }); + }); + } +} +exports.ValueAndUpdates = ValueAndUpdates; +//# sourceMappingURL=valueandupdates.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/math/build/decimal.js": +/*!****************************************************!*\ + !*** ./node_modules/@cosmjs/math/build/decimal.js ***! + \****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Decimal = void 0; +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +// Too large values lead to massive memory usage. Limit to something sensible. +// The largest value we need is 18 (Ether). +const maxFractionalDigits = 100; +/** + * A type for arbitrary precision, non-negative decimals. + * + * Instances of this class are immutable. + */ +class Decimal { + constructor(atomics, fractionalDigits) { + if (!atomics.match(/^[0-9]+$/)) { + throw new Error("Invalid string format. Only non-negative integers in decimal representation supported."); + } + this.data = { + atomics: new bn_js_1.default(atomics), + fractionalDigits: fractionalDigits, + }; + } + static fromUserInput(input, fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + const badCharacter = input.match(/[^0-9.]/); + if (badCharacter) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + throw new Error(`Invalid character at position ${badCharacter.index + 1}`); + } + let whole; + let fractional; + if (input === "") { + whole = "0"; + fractional = ""; + } + else if (input.search(/\./) === -1) { + // integer format, no separator + whole = input; + fractional = ""; + } + else { + const parts = input.split("."); + switch (parts.length) { + case 0: + case 1: + throw new Error("Fewer than two elements in split result. This must not happen here."); + case 2: + if (!parts[1]) + throw new Error("Fractional part missing"); + whole = parts[0]; + fractional = parts[1].replace(/0+$/, ""); + break; + default: + throw new Error("More than one separator found"); + } + } + if (fractional.length > fractionalDigits) { + throw new Error("Got more fractional digits than supported"); + } + const quantity = `${whole}${fractional.padEnd(fractionalDigits, "0")}`; + return new Decimal(quantity, fractionalDigits); + } + static fromAtomics(atomics, fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal(atomics, fractionalDigits); + } + /** + * Creates a Decimal with value 0.0 and the given number of fractial digits. + * + * Fractional digits are not relevant for the value but needed to be able + * to perform arithmetic operations with other decimals. + */ + static zero(fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal("0", fractionalDigits); + } + /** + * Creates a Decimal with value 1.0 and the given number of fractial digits. + * + * Fractional digits are not relevant for the value but needed to be able + * to perform arithmetic operations with other decimals. + */ + static one(fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal("1" + "0".repeat(fractionalDigits), fractionalDigits); + } + static verifyFractionalDigits(fractionalDigits) { + if (!Number.isInteger(fractionalDigits)) + throw new Error("Fractional digits is not an integer"); + if (fractionalDigits < 0) + throw new Error("Fractional digits must not be negative"); + if (fractionalDigits > maxFractionalDigits) { + throw new Error(`Fractional digits must not exceed ${maxFractionalDigits}`); + } + } + static compare(a, b) { + if (a.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + return a.data.atomics.cmp(new bn_js_1.default(b.atomics)); + } + get atomics() { + return this.data.atomics.toString(); + } + get fractionalDigits() { + return this.data.fractionalDigits; + } + /** Creates a new instance with the same value */ + clone() { + return new Decimal(this.atomics, this.fractionalDigits); + } + /** Returns the greatest decimal <= this which has no fractional part (rounding down) */ + floor() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return this.clone(); + } + else { + return Decimal.fromAtomics(whole.mul(factor).toString(), this.fractionalDigits); + } + } + /** Returns the smallest decimal >= this which has no fractional part (rounding up) */ + ceil() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return this.clone(); + } + else { + return Decimal.fromAtomics(whole.addn(1).mul(factor).toString(), this.fractionalDigits); + } + } + toString() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return whole.toString(); + } + else { + const fullFractionalPart = fractional.toString().padStart(this.data.fractionalDigits, "0"); + const trimmedFractionalPart = fullFractionalPart.replace(/0+$/, ""); + return `${whole.toString()}.${trimmedFractionalPart}`; + } + } + /** + * Returns an approximation as a float type. Only use this if no + * exact calculation is required. + */ + toFloatApproximation() { + const out = Number(this.toString()); + if (Number.isNaN(out)) + throw new Error("Conversion to number failed"); + return out; + } + /** + * a.plus(b) returns a+b. + * + * Both values need to have the same fractional digits. + */ + plus(b) { + if (this.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + const sum = this.data.atomics.add(new bn_js_1.default(b.atomics)); + return new Decimal(sum.toString(), this.fractionalDigits); + } + /** + * a.minus(b) returns a-b. + * + * Both values need to have the same fractional digits. + * The resulting difference needs to be non-negative. + */ + minus(b) { + if (this.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + const difference = this.data.atomics.sub(new bn_js_1.default(b.atomics)); + if (difference.ltn(0)) + throw new Error("Difference must not be negative"); + return new Decimal(difference.toString(), this.fractionalDigits); + } + /** + * a.multiply(b) returns a*b. + * + * We only allow multiplication by unsigned integers to avoid rounding errors. + */ + multiply(b) { + const product = this.data.atomics.mul(new bn_js_1.default(b.toString())); + return new Decimal(product.toString(), this.fractionalDigits); + } + equals(b) { + return Decimal.compare(this, b) === 0; + } + isLessThan(b) { + return Decimal.compare(this, b) < 0; + } + isLessThanOrEqual(b) { + return Decimal.compare(this, b) <= 0; + } + isGreaterThan(b) { + return Decimal.compare(this, b) > 0; + } + isGreaterThanOrEqual(b) { + return Decimal.compare(this, b) >= 0; + } +} +exports.Decimal = Decimal; +//# sourceMappingURL=decimal.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/math/build/index.js": +/*!**************************************************!*\ + !*** ./node_modules/@cosmjs/math/build/index.js ***! + \**************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Uint64 = exports.Uint53 = exports.Uint32 = exports.Int53 = exports.Decimal = void 0; +var decimal_1 = __webpack_require__(/*! ./decimal */ "./node_modules/@cosmjs/math/build/decimal.js"); +Object.defineProperty(exports, "Decimal", ({ enumerable: true, get: function () { return decimal_1.Decimal; } })); +var integers_1 = __webpack_require__(/*! ./integers */ "./node_modules/@cosmjs/math/build/integers.js"); +Object.defineProperty(exports, "Int53", ({ enumerable: true, get: function () { return integers_1.Int53; } })); +Object.defineProperty(exports, "Uint32", ({ enumerable: true, get: function () { return integers_1.Uint32; } })); +Object.defineProperty(exports, "Uint53", ({ enumerable: true, get: function () { return integers_1.Uint53; } })); +Object.defineProperty(exports, "Uint64", ({ enumerable: true, get: function () { return integers_1.Uint64; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/math/build/integers.js": +/*!*****************************************************!*\ + !*** ./node_modules/@cosmjs/math/build/integers.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Uint64 = exports.Uint53 = exports.Int53 = exports.Uint32 = void 0; +/* eslint-disable no-bitwise */ +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +const uint64MaxValue = new bn_js_1.default("18446744073709551615", 10, "be"); +class Uint32 { + constructor(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + if (input < 0 || input > 4294967295) { + throw new Error("Input not in uint32 range: " + input.toString()); + } + this.data = input; + } + /** @deprecated use Uint32.fromBytes */ + static fromBigEndianBytes(bytes) { + return Uint32.fromBytes(bytes); + } + /** + * Creates a Uint32 from a fixed length byte array. + * + * @param bytes a list of exactly 4 bytes + * @param endianess defaults to big endian + */ + static fromBytes(bytes, endianess = "be") { + if (bytes.length !== 4) { + throw new Error("Invalid input length. Expected 4 bytes."); + } + for (let i = 0; i < bytes.length; ++i) { + if (!Number.isInteger(bytes[i]) || bytes[i] > 255 || bytes[i] < 0) { + throw new Error("Invalid value in byte. Found: " + bytes[i]); + } + } + const beBytes = endianess === "be" ? bytes : Array.from(bytes).reverse(); + // Use mulitiplication instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint32(beBytes[0] * 2 ** 24 + beBytes[1] * 2 ** 16 + beBytes[2] * 2 ** 8 + beBytes[3]); + } + static fromString(str) { + if (!str.match(/^[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Uint32(Number.parseInt(str, 10)); + } + toBytesBigEndian() { + // Use division instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint8Array([ + Math.floor(this.data / 2 ** 24) & 0xff, + Math.floor(this.data / 2 ** 16) & 0xff, + Math.floor(this.data / 2 ** 8) & 0xff, + Math.floor(this.data / 2 ** 0) & 0xff, + ]); + } + toBytesLittleEndian() { + // Use division instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint8Array([ + Math.floor(this.data / 2 ** 0) & 0xff, + Math.floor(this.data / 2 ** 8) & 0xff, + Math.floor(this.data / 2 ** 16) & 0xff, + Math.floor(this.data / 2 ** 24) & 0xff, + ]); + } + toNumber() { + return this.data; + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Uint32 = Uint32; +class Int53 { + constructor(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + if (input < Number.MIN_SAFE_INTEGER || input > Number.MAX_SAFE_INTEGER) { + throw new Error("Input not in int53 range: " + input.toString()); + } + this.data = input; + } + static fromString(str) { + if (!str.match(/^-?[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Int53(Number.parseInt(str, 10)); + } + toNumber() { + return this.data; + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Int53 = Int53; +class Uint53 { + constructor(input) { + const signed = new Int53(input); + if (signed.toNumber() < 0) { + throw new Error("Input is negative"); + } + this.data = signed; + } + static fromString(str) { + const signed = Int53.fromString(str); + return new Uint53(signed.toNumber()); + } + toNumber() { + return this.data.toNumber(); + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Uint53 = Uint53; +class Uint64 { + constructor(data) { + if (data.isNeg()) { + throw new Error("Input is negative"); + } + if (data.gt(uint64MaxValue)) { + throw new Error("Input exceeds uint64 range"); + } + this.data = data; + } + /** @deprecated use Uint64.fromBytes */ + static fromBytesBigEndian(bytes) { + return Uint64.fromBytes(bytes); + } + /** + * Creates a Uint64 from a fixed length byte array. + * + * @param bytes a list of exactly 8 bytes + * @param endianess defaults to big endian + */ + static fromBytes(bytes, endianess = "be") { + if (bytes.length !== 8) { + throw new Error("Invalid input length. Expected 8 bytes."); + } + for (let i = 0; i < bytes.length; ++i) { + if (!Number.isInteger(bytes[i]) || bytes[i] > 255 || bytes[i] < 0) { + throw new Error("Invalid value in byte. Found: " + bytes[i]); + } + } + const beBytes = endianess === "be" ? Array.from(bytes) : Array.from(bytes).reverse(); + return new Uint64(new bn_js_1.default(beBytes)); + } + static fromString(str) { + if (!str.match(/^[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Uint64(new bn_js_1.default(str, 10, "be")); + } + static fromNumber(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + let bigint; + try { + bigint = new bn_js_1.default(input); + } + catch (_a) { + throw new Error("Input is not a safe integer"); + } + return new Uint64(bigint); + } + toBytesBigEndian() { + return Uint8Array.from(this.data.toArray("be", 8)); + } + toBytesLittleEndian() { + return Uint8Array.from(this.data.toArray("le", 8)); + } + toString() { + return this.data.toString(10); + } + toBigInt() { + return BigInt(this.toString()); + } + toNumber() { + return this.data.toNumber(); + } +} +exports.Uint64 = Uint64; +// Assign classes to unused variables in order to verify static interface conformance at compile time. +// Workaround for https://github.com/microsoft/TypeScript/issues/33892 +const _int53Class = Int53; +const _uint53Class = Uint53; +const _uint32Class = Uint32; +const _uint64Class = Uint64; +//# sourceMappingURL=integers.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/build/coins.js": +/*!***********************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/build/coins.js ***! + \***********************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.parseCoins = void 0; +/** + * Takes a coins list like "819966000ucosm,700000000ustake" and parses it. + * + * This is a Stargate ready version of parseCoins from @cosmjs/amino. + * It supports more denoms. + */ +function parseCoins(input) { + return input + .replace(/\s/g, "") + .split(",") + .filter(Boolean) + .map((part) => { + // Denom regex from Stargate (https://github.com/cosmos/cosmos-sdk/blob/v0.42.7/types/coin.go#L599-L601) + const match = part.match(/^([0-9]+)([a-zA-Z][a-zA-Z0-9/]{2,127})$/); + if (!match) + throw new Error("Got an invalid coin string"); + return { + amount: match[1].replace(/^0+/, "") || "0", + denom: match[2], + }; + }); +} +exports.parseCoins = parseCoins; +//# sourceMappingURL=coins.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/build/decode.js": +/*!************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/build/decode.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.decodeTxRaw = void 0; +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/tx/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/tx/v1beta1/tx.js"); +/** + * Takes a serialized TxRaw (the bytes stored in Tendermint) and decodes it into something usable. + */ +function decodeTxRaw(tx) { + const txRaw = tx_1.TxRaw.decode(tx); + return { + authInfo: tx_1.AuthInfo.decode(txRaw.authInfoBytes), + body: tx_1.TxBody.decode(txRaw.bodyBytes), + signatures: txRaw.signatures, + }; +} +exports.decodeTxRaw = decodeTxRaw; +//# sourceMappingURL=decode.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/build/directsecp256k1hdwallet.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/build/directsecp256k1hdwallet.js ***! + \*****************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DirectSecp256k1HdWallet = exports.extractKdfConfiguration = void 0; +const amino_1 = __webpack_require__(/*! @cosmjs/amino */ "./node_modules/@cosmjs/amino/build/index.js"); +const crypto_1 = __webpack_require__(/*! @cosmjs/crypto */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/index.js"); +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/index.js"); +const signing_1 = __webpack_require__(/*! ./signing */ "./node_modules/@cosmjs/proto-signing/build/signing.js"); +const wallet_1 = __webpack_require__(/*! ./wallet */ "./node_modules/@cosmjs/proto-signing/build/wallet.js"); +const serializationTypeV1 = "directsecp256k1hdwallet-v1"; +/** + * A KDF configuration that is not very strong but can be used on the main thread. + * It takes about 1 second in Node.js 16.0.0 and should have similar runtimes in other modern Wasm hosts. + */ +const basicPasswordHashingOptions = { + algorithm: "argon2id", + params: { + outputLength: 32, + opsLimit: 24, + memLimitKib: 12 * 1024, + }, +}; +function isDerivationJson(thing) { + if (!(0, utils_1.isNonNullObject)(thing)) + return false; + if (typeof thing.hdPath !== "string") + return false; + if (typeof thing.prefix !== "string") + return false; + return true; +} +function extractKdfConfigurationV1(doc) { + return doc.kdf; +} +function extractKdfConfiguration(serialization) { + const root = JSON.parse(serialization); + if (!(0, utils_1.isNonNullObject)(root)) + throw new Error("Root document is not an object."); + switch (root.type) { + case serializationTypeV1: + return extractKdfConfigurationV1(root); + default: + throw new Error("Unsupported serialization type"); + } +} +exports.extractKdfConfiguration = extractKdfConfiguration; +const defaultOptions = { + bip39Password: "", + hdPaths: [(0, amino_1.makeCosmoshubPath)(0)], + prefix: "cosmos", +}; +/** A wallet for protobuf based signing using SIGN_MODE_DIRECT */ +class DirectSecp256k1HdWallet { + constructor(mnemonic, options) { + const prefix = options.prefix ?? defaultOptions.prefix; + const hdPaths = options.hdPaths ?? defaultOptions.hdPaths; + this.secret = mnemonic; + this.seed = options.seed; + this.accounts = hdPaths.map((hdPath) => ({ + hdPath: hdPath, + prefix: prefix, + })); + } + /** + * Restores a wallet from the given BIP39 mnemonic. + * + * @param mnemonic Any valid English mnemonic. + * @param options An optional `DirectSecp256k1HdWalletOptions` object optionally containing a bip39Password, hdPaths, and prefix. + */ + static async fromMnemonic(mnemonic, options = {}) { + const mnemonicChecked = new crypto_1.EnglishMnemonic(mnemonic); + const seed = await crypto_1.Bip39.mnemonicToSeed(mnemonicChecked, options.bip39Password); + return new DirectSecp256k1HdWallet(mnemonicChecked, { + ...options, + seed: seed, + }); + } + /** + * Generates a new wallet with a BIP39 mnemonic of the given length. + * + * @param length The number of words in the mnemonic (12, 15, 18, 21 or 24). + * @param options An optional `DirectSecp256k1HdWalletOptions` object optionally containing a bip39Password, hdPaths, and prefix. + */ + static async generate(length = 12, options = {}) { + const entropyLength = 4 * Math.floor((11 * length) / 33); + const entropy = crypto_1.Random.getBytes(entropyLength); + const mnemonic = crypto_1.Bip39.encode(entropy); + return DirectSecp256k1HdWallet.fromMnemonic(mnemonic.toString(), options); + } + /** + * Restores a wallet from an encrypted serialization. + * + * @param password The user provided password used to generate an encryption key via a KDF. + * This is not normalized internally (see "Unicode normalization" to learn more). + */ + static async deserialize(serialization, password) { + const root = JSON.parse(serialization); + if (!(0, utils_1.isNonNullObject)(root)) + throw new Error("Root document is not an object."); + switch (root.type) { + case serializationTypeV1: + return DirectSecp256k1HdWallet.deserializeTypeV1(serialization, password); + default: + throw new Error("Unsupported serialization type"); + } + } + /** + * Restores a wallet from an encrypted serialization. + * + * This is an advanced alternative to calling `deserialize(serialization, password)` directly, which allows + * you to offload the KDF execution to a non-UI thread (e.g. in a WebWorker). + * + * The caller is responsible for ensuring the key was derived with the given KDF configuration. This can be + * done using `extractKdfConfiguration(serialization)` and `executeKdf(password, kdfConfiguration)` from this package. + */ + static async deserializeWithEncryptionKey(serialization, encryptionKey) { + const root = JSON.parse(serialization); + if (!(0, utils_1.isNonNullObject)(root)) + throw new Error("Root document is not an object."); + const untypedRoot = root; + switch (untypedRoot.type) { + case serializationTypeV1: { + const decryptedBytes = await (0, wallet_1.decrypt)((0, encoding_1.fromBase64)(untypedRoot.data), encryptionKey, untypedRoot.encryption); + const decryptedDocument = JSON.parse((0, encoding_1.fromUtf8)(decryptedBytes)); + const { mnemonic, accounts } = decryptedDocument; + (0, utils_1.assert)(typeof mnemonic === "string"); + if (!Array.isArray(accounts)) + throw new Error("Property 'accounts' is not an array"); + if (!accounts.every((account) => isDerivationJson(account))) { + throw new Error("Account is not in the correct format."); + } + const firstPrefix = accounts[0].prefix; + if (!accounts.every(({ prefix }) => prefix === firstPrefix)) { + throw new Error("Accounts do not all have the same prefix"); + } + const hdPaths = accounts.map(({ hdPath }) => (0, crypto_1.stringToPath)(hdPath)); + return DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { + hdPaths: hdPaths, + prefix: firstPrefix, + }); + } + default: + throw new Error("Unsupported serialization type"); + } + } + static async deserializeTypeV1(serialization, password) { + const root = JSON.parse(serialization); + if (!(0, utils_1.isNonNullObject)(root)) + throw new Error("Root document is not an object."); + const encryptionKey = await (0, wallet_1.executeKdf)(password, root.kdf); + return DirectSecp256k1HdWallet.deserializeWithEncryptionKey(serialization, encryptionKey); + } + get mnemonic() { + return this.secret.toString(); + } + async getAccounts() { + const accountsWithPrivkeys = await this.getAccountsWithPrivkeys(); + return accountsWithPrivkeys.map(({ algo, pubkey, address }) => ({ + algo: algo, + pubkey: pubkey, + address: address, + })); + } + async signDirect(signerAddress, signDoc) { + const accounts = await this.getAccountsWithPrivkeys(); + const account = accounts.find(({ address }) => address === signerAddress); + if (account === undefined) { + throw new Error(`Address ${signerAddress} not found in wallet`); + } + const { privkey, pubkey } = account; + const signBytes = (0, signing_1.makeSignBytes)(signDoc); + const hashedMessage = (0, crypto_1.sha256)(signBytes); + const signature = await crypto_1.Secp256k1.createSignature(hashedMessage, privkey); + const signatureBytes = new Uint8Array([...signature.r(32), ...signature.s(32)]); + const stdSignature = (0, amino_1.encodeSecp256k1Signature)(pubkey, signatureBytes); + return { + signed: signDoc, + signature: stdSignature, + }; + } + /** + * Generates an encrypted serialization of this wallet. + * + * @param password The user provided password used to generate an encryption key via a KDF. + * This is not normalized internally (see "Unicode normalization" to learn more). + */ + async serialize(password) { + const kdfConfiguration = basicPasswordHashingOptions; + const encryptionKey = await (0, wallet_1.executeKdf)(password, kdfConfiguration); + return this.serializeWithEncryptionKey(encryptionKey, kdfConfiguration); + } + /** + * Generates an encrypted serialization of this wallet. + * + * This is an advanced alternative to calling `serialize(password)` directly, which allows you to + * offload the KDF execution to a non-UI thread (e.g. in a WebWorker). + * + * The caller is responsible for ensuring the key was derived with the given KDF options. If this + * is not the case, the wallet cannot be restored with the original password. + */ + async serializeWithEncryptionKey(encryptionKey, kdfConfiguration) { + const dataToEncrypt = { + mnemonic: this.mnemonic, + accounts: this.accounts.map(({ hdPath, prefix }) => ({ + hdPath: (0, crypto_1.pathToString)(hdPath), + prefix: prefix, + })), + }; + const dataToEncryptRaw = (0, encoding_1.toUtf8)(JSON.stringify(dataToEncrypt)); + const encryptionConfiguration = { + algorithm: wallet_1.supportedAlgorithms.xchacha20poly1305Ietf, + }; + const encryptedData = await (0, wallet_1.encrypt)(dataToEncryptRaw, encryptionKey, encryptionConfiguration); + const out = { + type: serializationTypeV1, + kdf: kdfConfiguration, + encryption: encryptionConfiguration, + data: (0, encoding_1.toBase64)(encryptedData), + }; + return JSON.stringify(out); + } + async getKeyPair(hdPath) { + const { privkey } = crypto_1.Slip10.derivePath(crypto_1.Slip10Curve.Secp256k1, this.seed, hdPath); + const { pubkey } = await crypto_1.Secp256k1.makeKeypair(privkey); + return { + privkey: privkey, + pubkey: crypto_1.Secp256k1.compressPubkey(pubkey), + }; + } + async getAccountsWithPrivkeys() { + return Promise.all(this.accounts.map(async ({ hdPath, prefix }) => { + const { privkey, pubkey } = await this.getKeyPair(hdPath); + const address = (0, encoding_1.toBech32)(prefix, (0, amino_1.rawSecp256k1PubkeyToRawAddress)(pubkey)); + return { + algo: "secp256k1", + privkey: privkey, + pubkey: pubkey, + address: address, + }; + })); + } +} +exports.DirectSecp256k1HdWallet = DirectSecp256k1HdWallet; +//# sourceMappingURL=directsecp256k1hdwallet.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/build/directsecp256k1wallet.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/build/directsecp256k1wallet.js ***! + \***************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DirectSecp256k1Wallet = void 0; +const amino_1 = __webpack_require__(/*! @cosmjs/amino */ "./node_modules/@cosmjs/amino/build/index.js"); +const crypto_1 = __webpack_require__(/*! @cosmjs/crypto */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/index.js"); +const signing_1 = __webpack_require__(/*! ./signing */ "./node_modules/@cosmjs/proto-signing/build/signing.js"); +/** + * A wallet that holds a single secp256k1 keypair. + * + * If you want to work with BIP39 mnemonics and multiple accounts, use DirectSecp256k1HdWallet. + */ +class DirectSecp256k1Wallet { + constructor(privkey, pubkey, prefix) { + this.privkey = privkey; + this.pubkey = pubkey; + this.prefix = prefix; + } + /** + * Creates a DirectSecp256k1Wallet from the given private key + * + * @param privkey The private key. + * @param prefix The bech32 address prefix (human readable part). Defaults to "cosmos". + */ + static async fromKey(privkey, prefix = "cosmos") { + const uncompressed = (await crypto_1.Secp256k1.makeKeypair(privkey)).pubkey; + return new DirectSecp256k1Wallet(privkey, crypto_1.Secp256k1.compressPubkey(uncompressed), prefix); + } + get address() { + return (0, encoding_1.toBech32)(this.prefix, (0, amino_1.rawSecp256k1PubkeyToRawAddress)(this.pubkey)); + } + async getAccounts() { + return [ + { + algo: "secp256k1", + address: this.address, + pubkey: this.pubkey, + }, + ]; + } + async signDirect(address, signDoc) { + const signBytes = (0, signing_1.makeSignBytes)(signDoc); + if (address !== this.address) { + throw new Error(`Address ${address} not found in wallet`); + } + const hashedMessage = (0, crypto_1.sha256)(signBytes); + const signature = await crypto_1.Secp256k1.createSignature(hashedMessage, this.privkey); + const signatureBytes = new Uint8Array([...signature.r(32), ...signature.s(32)]); + const stdSignature = (0, amino_1.encodeSecp256k1Signature)(this.pubkey, signatureBytes); + return { + signed: signDoc, + signature: stdSignature, + }; + } +} +exports.DirectSecp256k1Wallet = DirectSecp256k1Wallet; +//# sourceMappingURL=directsecp256k1wallet.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/build/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/build/index.js ***! + \***********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.coins = exports.coin = exports.executeKdf = exports.makeSignDoc = exports.makeSignBytes = exports.makeAuthInfoBytes = exports.isOfflineDirectSigner = exports.Registry = exports.isTxBodyEncodeObject = exports.isTsProtoGeneratedType = exports.isPbjsGeneratedType = exports.encodePubkey = exports.decodePubkey = exports.anyToSinglePubkey = exports.makeCosmoshubPath = exports.DirectSecp256k1Wallet = exports.extractKdfConfiguration = exports.DirectSecp256k1HdWallet = exports.decodeTxRaw = exports.parseCoins = void 0; +// This type happens to be shared between Amino and Direct sign modes +var coins_1 = __webpack_require__(/*! ./coins */ "./node_modules/@cosmjs/proto-signing/build/coins.js"); +Object.defineProperty(exports, "parseCoins", ({ enumerable: true, get: function () { return coins_1.parseCoins; } })); +var decode_1 = __webpack_require__(/*! ./decode */ "./node_modules/@cosmjs/proto-signing/build/decode.js"); +Object.defineProperty(exports, "decodeTxRaw", ({ enumerable: true, get: function () { return decode_1.decodeTxRaw; } })); +var directsecp256k1hdwallet_1 = __webpack_require__(/*! ./directsecp256k1hdwallet */ "./node_modules/@cosmjs/proto-signing/build/directsecp256k1hdwallet.js"); +Object.defineProperty(exports, "DirectSecp256k1HdWallet", ({ enumerable: true, get: function () { return directsecp256k1hdwallet_1.DirectSecp256k1HdWallet; } })); +Object.defineProperty(exports, "extractKdfConfiguration", ({ enumerable: true, get: function () { return directsecp256k1hdwallet_1.extractKdfConfiguration; } })); +var directsecp256k1wallet_1 = __webpack_require__(/*! ./directsecp256k1wallet */ "./node_modules/@cosmjs/proto-signing/build/directsecp256k1wallet.js"); +Object.defineProperty(exports, "DirectSecp256k1Wallet", ({ enumerable: true, get: function () { return directsecp256k1wallet_1.DirectSecp256k1Wallet; } })); +var paths_1 = __webpack_require__(/*! ./paths */ "./node_modules/@cosmjs/proto-signing/build/paths.js"); +Object.defineProperty(exports, "makeCosmoshubPath", ({ enumerable: true, get: function () { return paths_1.makeCosmoshubPath; } })); +var pubkey_1 = __webpack_require__(/*! ./pubkey */ "./node_modules/@cosmjs/proto-signing/build/pubkey.js"); +Object.defineProperty(exports, "anyToSinglePubkey", ({ enumerable: true, get: function () { return pubkey_1.anyToSinglePubkey; } })); +Object.defineProperty(exports, "decodePubkey", ({ enumerable: true, get: function () { return pubkey_1.decodePubkey; } })); +Object.defineProperty(exports, "encodePubkey", ({ enumerable: true, get: function () { return pubkey_1.encodePubkey; } })); +var registry_1 = __webpack_require__(/*! ./registry */ "./node_modules/@cosmjs/proto-signing/build/registry.js"); +Object.defineProperty(exports, "isPbjsGeneratedType", ({ enumerable: true, get: function () { return registry_1.isPbjsGeneratedType; } })); +Object.defineProperty(exports, "isTsProtoGeneratedType", ({ enumerable: true, get: function () { return registry_1.isTsProtoGeneratedType; } })); +Object.defineProperty(exports, "isTxBodyEncodeObject", ({ enumerable: true, get: function () { return registry_1.isTxBodyEncodeObject; } })); +Object.defineProperty(exports, "Registry", ({ enumerable: true, get: function () { return registry_1.Registry; } })); +var signer_1 = __webpack_require__(/*! ./signer */ "./node_modules/@cosmjs/proto-signing/build/signer.js"); +Object.defineProperty(exports, "isOfflineDirectSigner", ({ enumerable: true, get: function () { return signer_1.isOfflineDirectSigner; } })); +var signing_1 = __webpack_require__(/*! ./signing */ "./node_modules/@cosmjs/proto-signing/build/signing.js"); +Object.defineProperty(exports, "makeAuthInfoBytes", ({ enumerable: true, get: function () { return signing_1.makeAuthInfoBytes; } })); +Object.defineProperty(exports, "makeSignBytes", ({ enumerable: true, get: function () { return signing_1.makeSignBytes; } })); +Object.defineProperty(exports, "makeSignDoc", ({ enumerable: true, get: function () { return signing_1.makeSignDoc; } })); +var wallet_1 = __webpack_require__(/*! ./wallet */ "./node_modules/@cosmjs/proto-signing/build/wallet.js"); +Object.defineProperty(exports, "executeKdf", ({ enumerable: true, get: function () { return wallet_1.executeKdf; } })); +var amino_1 = __webpack_require__(/*! @cosmjs/amino */ "./node_modules/@cosmjs/amino/build/index.js"); +Object.defineProperty(exports, "coin", ({ enumerable: true, get: function () { return amino_1.coin; } })); +Object.defineProperty(exports, "coins", ({ enumerable: true, get: function () { return amino_1.coins; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/build/paths.js": +/*!***********************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/build/paths.js ***! + \***********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.makeCosmoshubPath = void 0; +const crypto_1 = __webpack_require__(/*! @cosmjs/crypto */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/index.js"); +/** + * The Cosmos Hub derivation path in the form `m/44'/118'/0'/0/a` + * with 0-based account index `a`. + */ +function makeCosmoshubPath(a) { + return [ + crypto_1.Slip10RawIndex.hardened(44), + crypto_1.Slip10RawIndex.hardened(118), + crypto_1.Slip10RawIndex.hardened(0), + crypto_1.Slip10RawIndex.normal(0), + crypto_1.Slip10RawIndex.normal(a), + ]; +} +exports.makeCosmoshubPath = makeCosmoshubPath; +//# sourceMappingURL=paths.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/build/pubkey.js": +/*!************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/build/pubkey.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.decodePubkey = exports.anyToSinglePubkey = exports.encodePubkey = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const amino_1 = __webpack_require__(/*! @cosmjs/amino */ "./node_modules/@cosmjs/amino/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/index.js"); +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/math/build/index.js"); +const keys_1 = __webpack_require__(/*! cosmjs-types/cosmos/crypto/ed25519/keys */ "./node_modules/cosmjs-types/cosmos/crypto/ed25519/keys.js"); +const keys_2 = __webpack_require__(/*! cosmjs-types/cosmos/crypto/multisig/keys */ "./node_modules/cosmjs-types/cosmos/crypto/multisig/keys.js"); +const keys_3 = __webpack_require__(/*! cosmjs-types/cosmos/crypto/secp256k1/keys */ "./node_modules/cosmjs-types/cosmos/crypto/secp256k1/keys.js"); +const any_1 = __webpack_require__(/*! cosmjs-types/google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +/** + * Takes a pubkey in the Amino JSON object style (type/value wrapper) + * and convertes it into a protobuf `Any`. + * + * This is the reverse operation to `decodePubkey`. + */ +function encodePubkey(pubkey) { + if ((0, amino_1.isSecp256k1Pubkey)(pubkey)) { + const pubkeyProto = keys_3.PubKey.fromPartial({ + key: (0, encoding_1.fromBase64)(pubkey.value), + }); + return any_1.Any.fromPartial({ + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + value: Uint8Array.from(keys_3.PubKey.encode(pubkeyProto).finish()), + }); + } + else if ((0, amino_1.isEd25519Pubkey)(pubkey)) { + const pubkeyProto = keys_1.PubKey.fromPartial({ + key: (0, encoding_1.fromBase64)(pubkey.value), + }); + return any_1.Any.fromPartial({ + typeUrl: "/cosmos.crypto.ed25519.PubKey", + value: Uint8Array.from(keys_1.PubKey.encode(pubkeyProto).finish()), + }); + } + else if ((0, amino_1.isMultisigThresholdPubkey)(pubkey)) { + const pubkeyProto = keys_2.LegacyAminoPubKey.fromPartial({ + threshold: math_1.Uint53.fromString(pubkey.value.threshold).toNumber(), + publicKeys: pubkey.value.pubkeys.map(encodePubkey), + }); + return any_1.Any.fromPartial({ + typeUrl: "/cosmos.crypto.multisig.LegacyAminoPubKey", + value: Uint8Array.from(keys_2.LegacyAminoPubKey.encode(pubkeyProto).finish()), + }); + } + else { + throw new Error(`Pubkey type ${pubkey.type} not recognized`); + } +} +exports.encodePubkey = encodePubkey; +/** + * Decodes a single pubkey (i.e. not a multisig pubkey) from `Any` into + * `SinglePubkey`. + * + * In most cases you probably want to use `decodePubkey`. + */ +function anyToSinglePubkey(pubkey) { + switch (pubkey.typeUrl) { + case "/cosmos.crypto.secp256k1.PubKey": { + const { key } = keys_3.PubKey.decode(pubkey.value); + return (0, amino_1.encodeSecp256k1Pubkey)(key); + } + case "/cosmos.crypto.ed25519.PubKey": { + const { key } = keys_1.PubKey.decode(pubkey.value); + return (0, amino_1.encodeEd25519Pubkey)(key); + } + default: + throw new Error(`Pubkey type_url ${pubkey.typeUrl} not recognized as single public key type`); + } +} +exports.anyToSinglePubkey = anyToSinglePubkey; +/** + * Decodes a pubkey from a protobuf `Any` into `Pubkey`. + * This supports single pubkeys such as Cosmos ed25519 and secp256k1 keys + * as well as multisig threshold pubkeys. + */ +function decodePubkey(pubkey) { + switch (pubkey.typeUrl) { + case "/cosmos.crypto.secp256k1.PubKey": + case "/cosmos.crypto.ed25519.PubKey": { + return anyToSinglePubkey(pubkey); + } + case "/cosmos.crypto.multisig.LegacyAminoPubKey": { + const { threshold, publicKeys } = keys_2.LegacyAminoPubKey.decode(pubkey.value); + const out = { + type: "tendermint/PubKeyMultisigThreshold", + value: { + threshold: threshold.toString(), + pubkeys: publicKeys.map(anyToSinglePubkey), + }, + }; + return out; + } + default: + throw new Error(`Pubkey type_url ${pubkey.typeUrl} not recognized`); + } +} +exports.decodePubkey = decodePubkey; +//# sourceMappingURL=pubkey.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/build/registry.js": +/*!**************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/build/registry.js ***! + \**************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Registry = exports.isTxBodyEncodeObject = exports.isPbjsGeneratedType = exports.isTsProtoGeneratedType = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/bank/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/bank/v1beta1/tx.js"); +const coin_1 = __webpack_require__(/*! cosmjs-types/cosmos/base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const tx_2 = __webpack_require__(/*! cosmjs-types/cosmos/tx/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/tx/v1beta1/tx.js"); +const any_1 = __webpack_require__(/*! cosmjs-types/google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +function isTsProtoGeneratedType(type) { + return typeof type.fromPartial === "function"; +} +exports.isTsProtoGeneratedType = isTsProtoGeneratedType; +function isPbjsGeneratedType(type) { + return !isTsProtoGeneratedType(type); +} +exports.isPbjsGeneratedType = isPbjsGeneratedType; +const defaultTypeUrls = { + cosmosCoin: "/cosmos.base.v1beta1.Coin", + cosmosMsgSend: "/cosmos.bank.v1beta1.MsgSend", + cosmosTxBody: "/cosmos.tx.v1beta1.TxBody", + googleAny: "/google.protobuf.Any", +}; +function isTxBodyEncodeObject(encodeObject) { + return encodeObject.typeUrl === "/cosmos.tx.v1beta1.TxBody"; +} +exports.isTxBodyEncodeObject = isTxBodyEncodeObject; +class Registry { + /** + * Creates a new Registry for mapping protobuf type identifiers/type URLs to + * actual implementations. Those implementations are typically generated with ts-proto + * but we also support protobuf.js as a type generator. + * + * If there is no parameter given, a `new Registry()` adds the types `Coin` and `MsgSend` + * for historic reasons. Those can be overriden by customTypes. + * + * There are currently two methods for adding new types: + * 1. Passing types to the constructor. + * 2. Using the `register()` method + */ + constructor(customTypes) { + const { cosmosCoin, cosmosMsgSend } = defaultTypeUrls; + this.types = customTypes + ? new Map([...customTypes]) + : new Map([ + [cosmosCoin, coin_1.Coin], + [cosmosMsgSend, tx_1.MsgSend], + ]); + } + register(typeUrl, type) { + this.types.set(typeUrl, type); + } + /** + * Looks up a type that was previously added to the registry. + * + * The generator information (ts-proto or pbjs) gets lost along the way. + * If you need to work with the result type in TypeScript, you can use: + * + * ``` + * import { assert } from "@cosmjs/utils"; + * + * const Coin = registry.lookupType("/cosmos.base.v1beta1.Coin"); + * assert(Coin); // Ensures not unset + * assert(isTsProtoGeneratedType(Coin)); // Ensures this is the type we expect + * + * // Coin is typed TsProtoGeneratedType now. + * ``` + */ + lookupType(typeUrl) { + return this.types.get(typeUrl); + } + lookupTypeWithError(typeUrl) { + const type = this.lookupType(typeUrl); + if (!type) { + throw new Error(`Unregistered type url: ${typeUrl}`); + } + return type; + } + /** + * Takes a typeUrl/value pair and encodes the value to protobuf if + * the given type was previously registered. + * + * If the value has to be wrapped in an Any, this needs to be done + * manually after this call. Or use `encodeAsAny` instead. + */ + encode(encodeObject) { + const { value, typeUrl } = encodeObject; + if (isTxBodyEncodeObject(encodeObject)) { + return this.encodeTxBody(value); + } + const type = this.lookupTypeWithError(typeUrl); + const instance = isTsProtoGeneratedType(type) ? type.fromPartial(value) : type.create(value); + return type.encode(instance).finish(); + } + /** + * Takes a typeUrl/value pair and encodes the value to an Any if + * the given type was previously registered. + */ + encodeAsAny(encodeObject) { + const binaryValue = this.encode(encodeObject); + return any_1.Any.fromPartial({ + typeUrl: encodeObject.typeUrl, + value: binaryValue, + }); + } + encodeTxBody(txBodyFields) { + const wrappedMessages = txBodyFields.messages.map((message) => this.encodeAsAny(message)); + const txBody = tx_2.TxBody.fromPartial({ + ...txBodyFields, + messages: wrappedMessages, + }); + return tx_2.TxBody.encode(txBody).finish(); + } + decode({ typeUrl, value }) { + if (typeUrl === defaultTypeUrls.cosmosTxBody) { + return this.decodeTxBody(value); + } + const type = this.lookupTypeWithError(typeUrl); + const decoded = type.decode(value); + Object.entries(decoded).forEach(([key, val]) => { + if (typeof Buffer !== "undefined" && typeof Buffer.isBuffer !== "undefined" && Buffer.isBuffer(val)) { + decoded[key] = Uint8Array.from(val); + } + }); + return decoded; + } + decodeTxBody(txBody) { + const decodedTxBody = tx_2.TxBody.decode(txBody); + return { + ...decodedTxBody, + messages: decodedTxBody.messages.map(({ typeUrl: typeUrl, value }) => { + if (!typeUrl) { + throw new Error("Missing type_url in Any"); + } + if (!value) { + throw new Error("Missing value in Any"); + } + return this.decode({ typeUrl, value }); + }), + }; + } +} +exports.Registry = Registry; +//# sourceMappingURL=registry.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/build/signer.js": +/*!************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/build/signer.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isOfflineDirectSigner = void 0; +function isOfflineDirectSigner(signer) { + return signer.signDirect !== undefined; +} +exports.isOfflineDirectSigner = isOfflineDirectSigner; +//# sourceMappingURL=signer.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/build/signing.js": +/*!*************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/build/signing.js ***! + \*************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.makeSignBytes = exports.makeSignDoc = exports.makeAuthInfoBytes = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/index.js"); +const signing_1 = __webpack_require__(/*! cosmjs-types/cosmos/tx/signing/v1beta1/signing */ "./node_modules/cosmjs-types/cosmos/tx/signing/v1beta1/signing.js"); +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/tx/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/tx/v1beta1/tx.js"); +const long_1 = __importDefault(__webpack_require__(/*! long */ "./node_modules/long/src/long.js")); +/** + * Create signer infos from the provided signers. + * + * This implementation does not support different signing modes for the different signers. + */ +function makeSignerInfos(signers, signMode) { + return signers.map(({ pubkey, sequence }) => ({ + publicKey: pubkey, + modeInfo: { + single: { mode: signMode }, + }, + sequence: long_1.default.fromNumber(sequence), + })); +} +/** + * Creates and serializes an AuthInfo document. + * + * This implementation does not support different signing modes for the different signers. + */ +function makeAuthInfoBytes(signers, feeAmount, gasLimit, feeGranter, feePayer, signMode = signing_1.SignMode.SIGN_MODE_DIRECT) { + // Required arguments 4 and 5 were added in CosmJS 0.29. Use runtime checks to help our non-TS users. + (0, utils_1.assert)(feeGranter === undefined || typeof feeGranter === "string", "feeGranter must be undefined or string"); + (0, utils_1.assert)(feePayer === undefined || typeof feePayer === "string", "feePayer must be undefined or string"); + const authInfo = tx_1.AuthInfo.fromPartial({ + signerInfos: makeSignerInfos(signers, signMode), + fee: { + amount: [...feeAmount], + gasLimit: long_1.default.fromNumber(gasLimit), + granter: feeGranter, + payer: feePayer, + }, + }); + return tx_1.AuthInfo.encode(authInfo).finish(); +} +exports.makeAuthInfoBytes = makeAuthInfoBytes; +function makeSignDoc(bodyBytes, authInfoBytes, chainId, accountNumber) { + return { + bodyBytes: bodyBytes, + authInfoBytes: authInfoBytes, + chainId: chainId, + accountNumber: long_1.default.fromNumber(accountNumber), + }; +} +exports.makeSignDoc = makeSignDoc; +function makeSignBytes({ accountNumber, authInfoBytes, bodyBytes, chainId }) { + const signDoc = tx_1.SignDoc.fromPartial({ + accountNumber: accountNumber, + authInfoBytes: authInfoBytes, + bodyBytes: bodyBytes, + chainId: chainId, + }); + return tx_1.SignDoc.encode(signDoc).finish(); +} +exports.makeSignBytes = makeSignBytes; +//# sourceMappingURL=signing.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/build/wallet.js": +/*!************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/build/wallet.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.decrypt = exports.encrypt = exports.supportedAlgorithms = exports.executeKdf = exports.cosmjsSalt = void 0; +const crypto_1 = __webpack_require__(/*! @cosmjs/crypto */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/index.js"); +/** + * A fixed salt is chosen to archive a deterministic password to key derivation. + * This reduces the scope of a potential rainbow attack to all CosmJS users. + * Must be 16 bytes due to implementation limitations. + */ +exports.cosmjsSalt = (0, encoding_1.toAscii)("The CosmJS salt."); +async function executeKdf(password, configuration) { + switch (configuration.algorithm) { + case "argon2id": { + const options = configuration.params; + if (!(0, crypto_1.isArgon2idOptions)(options)) + throw new Error("Invalid format of argon2id params"); + return crypto_1.Argon2id.execute(password, exports.cosmjsSalt, options); + } + default: + throw new Error("Unsupported KDF algorithm"); + } +} +exports.executeKdf = executeKdf; +exports.supportedAlgorithms = { + xchacha20poly1305Ietf: "xchacha20poly1305-ietf", +}; +async function encrypt(plaintext, encryptionKey, config) { + switch (config.algorithm) { + case exports.supportedAlgorithms.xchacha20poly1305Ietf: { + const nonce = crypto_1.Random.getBytes(crypto_1.xchacha20NonceLength); + // Prepend fixed-length nonce to ciphertext as suggested in the example from https://github.com/jedisct1/libsodium.js#api + return new Uint8Array([ + ...nonce, + ...(await crypto_1.Xchacha20poly1305Ietf.encrypt(plaintext, encryptionKey, nonce)), + ]); + } + default: + throw new Error(`Unsupported encryption algorithm: '${config.algorithm}'`); + } +} +exports.encrypt = encrypt; +async function decrypt(ciphertext, encryptionKey, config) { + switch (config.algorithm) { + case exports.supportedAlgorithms.xchacha20poly1305Ietf: { + const nonce = ciphertext.slice(0, crypto_1.xchacha20NonceLength); + return crypto_1.Xchacha20poly1305Ietf.decrypt(ciphertext.slice(crypto_1.xchacha20NonceLength), encryptionKey, nonce); + } + default: + throw new Error(`Unsupported encryption algorithm: '${config.algorithm}'`); + } +} +exports.decrypt = decrypt; +//# sourceMappingURL=wallet.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/bip39.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/bip39.js ***! + \***************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Bip39 = exports.EnglishMnemonic = exports.mnemonicToEntropy = exports.entropyToMnemonic = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/index.js"); +const pbkdf2_1 = __webpack_require__(/*! ./pbkdf2 */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/pbkdf2.js"); +const sha_1 = __webpack_require__(/*! ./sha */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/sha.js"); +const wordlist = [ + "abandon", + "ability", + "able", + "about", + "above", + "absent", + "absorb", + "abstract", + "absurd", + "abuse", + "access", + "accident", + "account", + "accuse", + "achieve", + "acid", + "acoustic", + "acquire", + "across", + "act", + "action", + "actor", + "actress", + "actual", + "adapt", + "add", + "addict", + "address", + "adjust", + "admit", + "adult", + "advance", + "advice", + "aerobic", + "affair", + "afford", + "afraid", + "again", + "age", + "agent", + "agree", + "ahead", + "aim", + "air", + "airport", + "aisle", + "alarm", + "album", + "alcohol", + "alert", + "alien", + "all", + "alley", + "allow", + "almost", + "alone", + "alpha", + "already", + "also", + "alter", + "always", + "amateur", + "amazing", + "among", + "amount", + "amused", + "analyst", + "anchor", + "ancient", + "anger", + "angle", + "angry", + "animal", + "ankle", + "announce", + "annual", + "another", + "answer", + "antenna", + "antique", + "anxiety", + "any", + "apart", + "apology", + "appear", + "apple", + "approve", + "april", + "arch", + "arctic", + "area", + "arena", + "argue", + "arm", + "armed", + "armor", + "army", + "around", + "arrange", + "arrest", + "arrive", + "arrow", + "art", + "artefact", + "artist", + "artwork", + "ask", + "aspect", + "assault", + "asset", + "assist", + "assume", + "asthma", + "athlete", + "atom", + "attack", + "attend", + "attitude", + "attract", + "auction", + "audit", + "august", + "aunt", + "author", + "auto", + "autumn", + "average", + "avocado", + "avoid", + "awake", + "aware", + "away", + "awesome", + "awful", + "awkward", + "axis", + "baby", + "bachelor", + "bacon", + "badge", + "bag", + "balance", + "balcony", + "ball", + "bamboo", + "banana", + "banner", + "bar", + "barely", + "bargain", + "barrel", + "base", + "basic", + "basket", + "battle", + "beach", + "bean", + "beauty", + "because", + "become", + "beef", + "before", + "begin", + "behave", + "behind", + "believe", + "below", + "belt", + "bench", + "benefit", + "best", + "betray", + "better", + "between", + "beyond", + "bicycle", + "bid", + "bike", + "bind", + "biology", + "bird", + "birth", + "bitter", + "black", + "blade", + "blame", + "blanket", + "blast", + "bleak", + "bless", + "blind", + "blood", + "blossom", + "blouse", + "blue", + "blur", + "blush", + "board", + "boat", + "body", + "boil", + "bomb", + "bone", + "bonus", + "book", + "boost", + "border", + "boring", + "borrow", + "boss", + "bottom", + "bounce", + "box", + "boy", + "bracket", + "brain", + "brand", + "brass", + "brave", + "bread", + "breeze", + "brick", + "bridge", + "brief", + "bright", + "bring", + "brisk", + "broccoli", + "broken", + "bronze", + "broom", + "brother", + "brown", + "brush", + "bubble", + "buddy", + "budget", + "buffalo", + "build", + "bulb", + "bulk", + "bullet", + "bundle", + "bunker", + "burden", + "burger", + "burst", + "bus", + "business", + "busy", + "butter", + "buyer", + "buzz", + "cabbage", + "cabin", + "cable", + "cactus", + "cage", + "cake", + "call", + "calm", + "camera", + "camp", + "can", + "canal", + "cancel", + "candy", + "cannon", + "canoe", + "canvas", + "canyon", + "capable", + "capital", + "captain", + "car", + "carbon", + "card", + "cargo", + "carpet", + "carry", + "cart", + "case", + "cash", + "casino", + "castle", + "casual", + "cat", + "catalog", + "catch", + "category", + "cattle", + "caught", + "cause", + "caution", + "cave", + "ceiling", + "celery", + "cement", + "census", + "century", + "cereal", + "certain", + "chair", + "chalk", + "champion", + "change", + "chaos", + "chapter", + "charge", + "chase", + "chat", + "cheap", + "check", + "cheese", + "chef", + "cherry", + "chest", + "chicken", + "chief", + "child", + "chimney", + "choice", + "choose", + "chronic", + "chuckle", + "chunk", + "churn", + "cigar", + "cinnamon", + "circle", + "citizen", + "city", + "civil", + "claim", + "clap", + "clarify", + "claw", + "clay", + "clean", + "clerk", + "clever", + "click", + "client", + "cliff", + "climb", + "clinic", + "clip", + "clock", + "clog", + "close", + "cloth", + "cloud", + "clown", + "club", + "clump", + "cluster", + "clutch", + "coach", + "coast", + "coconut", + "code", + "coffee", + "coil", + "coin", + "collect", + "color", + "column", + "combine", + "come", + "comfort", + "comic", + "common", + "company", + "concert", + "conduct", + "confirm", + "congress", + "connect", + "consider", + "control", + "convince", + "cook", + "cool", + "copper", + "copy", + "coral", + "core", + "corn", + "correct", + "cost", + "cotton", + "couch", + "country", + "couple", + "course", + "cousin", + "cover", + "coyote", + "crack", + "cradle", + "craft", + "cram", + "crane", + "crash", + "crater", + "crawl", + "crazy", + "cream", + "credit", + "creek", + "crew", + "cricket", + "crime", + "crisp", + "critic", + "crop", + "cross", + "crouch", + "crowd", + "crucial", + "cruel", + "cruise", + "crumble", + "crunch", + "crush", + "cry", + "crystal", + "cube", + "culture", + "cup", + "cupboard", + "curious", + "current", + "curtain", + "curve", + "cushion", + "custom", + "cute", + "cycle", + "dad", + "damage", + "damp", + "dance", + "danger", + "daring", + "dash", + "daughter", + "dawn", + "day", + "deal", + "debate", + "debris", + "decade", + "december", + "decide", + "decline", + "decorate", + "decrease", + "deer", + "defense", + "define", + "defy", + "degree", + "delay", + "deliver", + "demand", + "demise", + "denial", + "dentist", + "deny", + "depart", + "depend", + "deposit", + "depth", + "deputy", + "derive", + "describe", + "desert", + "design", + "desk", + "despair", + "destroy", + "detail", + "detect", + "develop", + "device", + "devote", + "diagram", + "dial", + "diamond", + "diary", + "dice", + "diesel", + "diet", + "differ", + "digital", + "dignity", + "dilemma", + "dinner", + "dinosaur", + "direct", + "dirt", + "disagree", + "discover", + "disease", + "dish", + "dismiss", + "disorder", + "display", + "distance", + "divert", + "divide", + "divorce", + "dizzy", + "doctor", + "document", + "dog", + "doll", + "dolphin", + "domain", + "donate", + "donkey", + "donor", + "door", + "dose", + "double", + "dove", + "draft", + "dragon", + "drama", + "drastic", + "draw", + "dream", + "dress", + "drift", + "drill", + "drink", + "drip", + "drive", + "drop", + "drum", + "dry", + "duck", + "dumb", + "dune", + "during", + "dust", + "dutch", + "duty", + "dwarf", + "dynamic", + "eager", + "eagle", + "early", + "earn", + "earth", + "easily", + "east", + "easy", + "echo", + "ecology", + "economy", + "edge", + "edit", + "educate", + "effort", + "egg", + "eight", + "either", + "elbow", + "elder", + "electric", + "elegant", + "element", + "elephant", + "elevator", + "elite", + "else", + "embark", + "embody", + "embrace", + "emerge", + "emotion", + "employ", + "empower", + "empty", + "enable", + "enact", + "end", + "endless", + "endorse", + "enemy", + "energy", + "enforce", + "engage", + "engine", + "enhance", + "enjoy", + "enlist", + "enough", + "enrich", + "enroll", + "ensure", + "enter", + "entire", + "entry", + "envelope", + "episode", + "equal", + "equip", + "era", + "erase", + "erode", + "erosion", + "error", + "erupt", + "escape", + "essay", + "essence", + "estate", + "eternal", + "ethics", + "evidence", + "evil", + "evoke", + "evolve", + "exact", + "example", + "excess", + "exchange", + "excite", + "exclude", + "excuse", + "execute", + "exercise", + "exhaust", + "exhibit", + "exile", + "exist", + "exit", + "exotic", + "expand", + "expect", + "expire", + "explain", + "expose", + "express", + "extend", + "extra", + "eye", + "eyebrow", + "fabric", + "face", + "faculty", + "fade", + "faint", + "faith", + "fall", + "false", + "fame", + "family", + "famous", + "fan", + "fancy", + "fantasy", + "farm", + "fashion", + "fat", + "fatal", + "father", + "fatigue", + "fault", + "favorite", + "feature", + "february", + "federal", + "fee", + "feed", + "feel", + "female", + "fence", + "festival", + "fetch", + "fever", + "few", + "fiber", + "fiction", + "field", + "figure", + "file", + "film", + "filter", + "final", + "find", + "fine", + "finger", + "finish", + "fire", + "firm", + "first", + "fiscal", + "fish", + "fit", + "fitness", + "fix", + "flag", + "flame", + "flash", + "flat", + "flavor", + "flee", + "flight", + "flip", + "float", + "flock", + "floor", + "flower", + "fluid", + "flush", + "fly", + "foam", + "focus", + "fog", + "foil", + "fold", + "follow", + "food", + "foot", + "force", + "forest", + "forget", + "fork", + "fortune", + "forum", + "forward", + "fossil", + "foster", + "found", + "fox", + "fragile", + "frame", + "frequent", + "fresh", + "friend", + "fringe", + "frog", + "front", + "frost", + "frown", + "frozen", + "fruit", + "fuel", + "fun", + "funny", + "furnace", + "fury", + "future", + "gadget", + "gain", + "galaxy", + "gallery", + "game", + "gap", + "garage", + "garbage", + "garden", + "garlic", + "garment", + "gas", + "gasp", + "gate", + "gather", + "gauge", + "gaze", + "general", + "genius", + "genre", + "gentle", + "genuine", + "gesture", + "ghost", + "giant", + "gift", + "giggle", + "ginger", + "giraffe", + "girl", + "give", + "glad", + "glance", + "glare", + "glass", + "glide", + "glimpse", + "globe", + "gloom", + "glory", + "glove", + "glow", + "glue", + "goat", + "goddess", + "gold", + "good", + "goose", + "gorilla", + "gospel", + "gossip", + "govern", + "gown", + "grab", + "grace", + "grain", + "grant", + "grape", + "grass", + "gravity", + "great", + "green", + "grid", + "grief", + "grit", + "grocery", + "group", + "grow", + "grunt", + "guard", + "guess", + "guide", + "guilt", + "guitar", + "gun", + "gym", + "habit", + "hair", + "half", + "hammer", + "hamster", + "hand", + "happy", + "harbor", + "hard", + "harsh", + "harvest", + "hat", + "have", + "hawk", + "hazard", + "head", + "health", + "heart", + "heavy", + "hedgehog", + "height", + "hello", + "helmet", + "help", + "hen", + "hero", + "hidden", + "high", + "hill", + "hint", + "hip", + "hire", + "history", + "hobby", + "hockey", + "hold", + "hole", + "holiday", + "hollow", + "home", + "honey", + "hood", + "hope", + "horn", + "horror", + "horse", + "hospital", + "host", + "hotel", + "hour", + "hover", + "hub", + "huge", + "human", + "humble", + "humor", + "hundred", + "hungry", + "hunt", + "hurdle", + "hurry", + "hurt", + "husband", + "hybrid", + "ice", + "icon", + "idea", + "identify", + "idle", + "ignore", + "ill", + "illegal", + "illness", + "image", + "imitate", + "immense", + "immune", + "impact", + "impose", + "improve", + "impulse", + "inch", + "include", + "income", + "increase", + "index", + "indicate", + "indoor", + "industry", + "infant", + "inflict", + "inform", + "inhale", + "inherit", + "initial", + "inject", + "injury", + "inmate", + "inner", + "innocent", + "input", + "inquiry", + "insane", + "insect", + "inside", + "inspire", + "install", + "intact", + "interest", + "into", + "invest", + "invite", + "involve", + "iron", + "island", + "isolate", + "issue", + "item", + "ivory", + "jacket", + "jaguar", + "jar", + "jazz", + "jealous", + "jeans", + "jelly", + "jewel", + "job", + "join", + "joke", + "journey", + "joy", + "judge", + "juice", + "jump", + "jungle", + "junior", + "junk", + "just", + "kangaroo", + "keen", + "keep", + "ketchup", + "key", + "kick", + "kid", + "kidney", + "kind", + "kingdom", + "kiss", + "kit", + "kitchen", + "kite", + "kitten", + "kiwi", + "knee", + "knife", + "knock", + "know", + "lab", + "label", + "labor", + "ladder", + "lady", + "lake", + "lamp", + "language", + "laptop", + "large", + "later", + "latin", + "laugh", + "laundry", + "lava", + "law", + "lawn", + "lawsuit", + "layer", + "lazy", + "leader", + "leaf", + "learn", + "leave", + "lecture", + "left", + "leg", + "legal", + "legend", + "leisure", + "lemon", + "lend", + "length", + "lens", + "leopard", + "lesson", + "letter", + "level", + "liar", + "liberty", + "library", + "license", + "life", + "lift", + "light", + "like", + "limb", + "limit", + "link", + "lion", + "liquid", + "list", + "little", + "live", + "lizard", + "load", + "loan", + "lobster", + "local", + "lock", + "logic", + "lonely", + "long", + "loop", + "lottery", + "loud", + "lounge", + "love", + "loyal", + "lucky", + "luggage", + "lumber", + "lunar", + "lunch", + "luxury", + "lyrics", + "machine", + "mad", + "magic", + "magnet", + "maid", + "mail", + "main", + "major", + "make", + "mammal", + "man", + "manage", + "mandate", + "mango", + "mansion", + "manual", + "maple", + "marble", + "march", + "margin", + "marine", + "market", + "marriage", + "mask", + "mass", + "master", + "match", + "material", + "math", + "matrix", + "matter", + "maximum", + "maze", + "meadow", + "mean", + "measure", + "meat", + "mechanic", + "medal", + "media", + "melody", + "melt", + "member", + "memory", + "mention", + "menu", + "mercy", + "merge", + "merit", + "merry", + "mesh", + "message", + "metal", + "method", + "middle", + "midnight", + "milk", + "million", + "mimic", + "mind", + "minimum", + "minor", + "minute", + "miracle", + "mirror", + "misery", + "miss", + "mistake", + "mix", + "mixed", + "mixture", + "mobile", + "model", + "modify", + "mom", + "moment", + "monitor", + "monkey", + "monster", + "month", + "moon", + "moral", + "more", + "morning", + "mosquito", + "mother", + "motion", + "motor", + "mountain", + "mouse", + "move", + "movie", + "much", + "muffin", + "mule", + "multiply", + "muscle", + "museum", + "mushroom", + "music", + "must", + "mutual", + "myself", + "mystery", + "myth", + "naive", + "name", + "napkin", + "narrow", + "nasty", + "nation", + "nature", + "near", + "neck", + "need", + "negative", + "neglect", + "neither", + "nephew", + "nerve", + "nest", + "net", + "network", + "neutral", + "never", + "news", + "next", + "nice", + "night", + "noble", + "noise", + "nominee", + "noodle", + "normal", + "north", + "nose", + "notable", + "note", + "nothing", + "notice", + "novel", + "now", + "nuclear", + "number", + "nurse", + "nut", + "oak", + "obey", + "object", + "oblige", + "obscure", + "observe", + "obtain", + "obvious", + "occur", + "ocean", + "october", + "odor", + "off", + "offer", + "office", + "often", + "oil", + "okay", + "old", + "olive", + "olympic", + "omit", + "once", + "one", + "onion", + "online", + "only", + "open", + "opera", + "opinion", + "oppose", + "option", + "orange", + "orbit", + "orchard", + "order", + "ordinary", + "organ", + "orient", + "original", + "orphan", + "ostrich", + "other", + "outdoor", + "outer", + "output", + "outside", + "oval", + "oven", + "over", + "own", + "owner", + "oxygen", + "oyster", + "ozone", + "pact", + "paddle", + "page", + "pair", + "palace", + "palm", + "panda", + "panel", + "panic", + "panther", + "paper", + "parade", + "parent", + "park", + "parrot", + "party", + "pass", + "patch", + "path", + "patient", + "patrol", + "pattern", + "pause", + "pave", + "payment", + "peace", + "peanut", + "pear", + "peasant", + "pelican", + "pen", + "penalty", + "pencil", + "people", + "pepper", + "perfect", + "permit", + "person", + "pet", + "phone", + "photo", + "phrase", + "physical", + "piano", + "picnic", + "picture", + "piece", + "pig", + "pigeon", + "pill", + "pilot", + "pink", + "pioneer", + "pipe", + "pistol", + "pitch", + "pizza", + "place", + "planet", + "plastic", + "plate", + "play", + "please", + "pledge", + "pluck", + "plug", + "plunge", + "poem", + "poet", + "point", + "polar", + "pole", + "police", + "pond", + "pony", + "pool", + "popular", + "portion", + "position", + "possible", + "post", + "potato", + "pottery", + "poverty", + "powder", + "power", + "practice", + "praise", + "predict", + "prefer", + "prepare", + "present", + "pretty", + "prevent", + "price", + "pride", + "primary", + "print", + "priority", + "prison", + "private", + "prize", + "problem", + "process", + "produce", + "profit", + "program", + "project", + "promote", + "proof", + "property", + "prosper", + "protect", + "proud", + "provide", + "public", + "pudding", + "pull", + "pulp", + "pulse", + "pumpkin", + "punch", + "pupil", + "puppy", + "purchase", + "purity", + "purpose", + "purse", + "push", + "put", + "puzzle", + "pyramid", + "quality", + "quantum", + "quarter", + "question", + "quick", + "quit", + "quiz", + "quote", + "rabbit", + "raccoon", + "race", + "rack", + "radar", + "radio", + "rail", + "rain", + "raise", + "rally", + "ramp", + "ranch", + "random", + "range", + "rapid", + "rare", + "rate", + "rather", + "raven", + "raw", + "razor", + "ready", + "real", + "reason", + "rebel", + "rebuild", + "recall", + "receive", + "recipe", + "record", + "recycle", + "reduce", + "reflect", + "reform", + "refuse", + "region", + "regret", + "regular", + "reject", + "relax", + "release", + "relief", + "rely", + "remain", + "remember", + "remind", + "remove", + "render", + "renew", + "rent", + "reopen", + "repair", + "repeat", + "replace", + "report", + "require", + "rescue", + "resemble", + "resist", + "resource", + "response", + "result", + "retire", + "retreat", + "return", + "reunion", + "reveal", + "review", + "reward", + "rhythm", + "rib", + "ribbon", + "rice", + "rich", + "ride", + "ridge", + "rifle", + "right", + "rigid", + "ring", + "riot", + "ripple", + "risk", + "ritual", + "rival", + "river", + "road", + "roast", + "robot", + "robust", + "rocket", + "romance", + "roof", + "rookie", + "room", + "rose", + "rotate", + "rough", + "round", + "route", + "royal", + "rubber", + "rude", + "rug", + "rule", + "run", + "runway", + "rural", + "sad", + "saddle", + "sadness", + "safe", + "sail", + "salad", + "salmon", + "salon", + "salt", + "salute", + "same", + "sample", + "sand", + "satisfy", + "satoshi", + "sauce", + "sausage", + "save", + "say", + "scale", + "scan", + "scare", + "scatter", + "scene", + "scheme", + "school", + "science", + "scissors", + "scorpion", + "scout", + "scrap", + "screen", + "script", + "scrub", + "sea", + "search", + "season", + "seat", + "second", + "secret", + "section", + "security", + "seed", + "seek", + "segment", + "select", + "sell", + "seminar", + "senior", + "sense", + "sentence", + "series", + "service", + "session", + "settle", + "setup", + "seven", + "shadow", + "shaft", + "shallow", + "share", + "shed", + "shell", + "sheriff", + "shield", + "shift", + "shine", + "ship", + "shiver", + "shock", + "shoe", + "shoot", + "shop", + "short", + "shoulder", + "shove", + "shrimp", + "shrug", + "shuffle", + "shy", + "sibling", + "sick", + "side", + "siege", + "sight", + "sign", + "silent", + "silk", + "silly", + "silver", + "similar", + "simple", + "since", + "sing", + "siren", + "sister", + "situate", + "six", + "size", + "skate", + "sketch", + "ski", + "skill", + "skin", + "skirt", + "skull", + "slab", + "slam", + "sleep", + "slender", + "slice", + "slide", + "slight", + "slim", + "slogan", + "slot", + "slow", + "slush", + "small", + "smart", + "smile", + "smoke", + "smooth", + "snack", + "snake", + "snap", + "sniff", + "snow", + "soap", + "soccer", + "social", + "sock", + "soda", + "soft", + "solar", + "soldier", + "solid", + "solution", + "solve", + "someone", + "song", + "soon", + "sorry", + "sort", + "soul", + "sound", + "soup", + "source", + "south", + "space", + "spare", + "spatial", + "spawn", + "speak", + "special", + "speed", + "spell", + "spend", + "sphere", + "spice", + "spider", + "spike", + "spin", + "spirit", + "split", + "spoil", + "sponsor", + "spoon", + "sport", + "spot", + "spray", + "spread", + "spring", + "spy", + "square", + "squeeze", + "squirrel", + "stable", + "stadium", + "staff", + "stage", + "stairs", + "stamp", + "stand", + "start", + "state", + "stay", + "steak", + "steel", + "stem", + "step", + "stereo", + "stick", + "still", + "sting", + "stock", + "stomach", + "stone", + "stool", + "story", + "stove", + "strategy", + "street", + "strike", + "strong", + "struggle", + "student", + "stuff", + "stumble", + "style", + "subject", + "submit", + "subway", + "success", + "such", + "sudden", + "suffer", + "sugar", + "suggest", + "suit", + "summer", + "sun", + "sunny", + "sunset", + "super", + "supply", + "supreme", + "sure", + "surface", + "surge", + "surprise", + "surround", + "survey", + "suspect", + "sustain", + "swallow", + "swamp", + "swap", + "swarm", + "swear", + "sweet", + "swift", + "swim", + "swing", + "switch", + "sword", + "symbol", + "symptom", + "syrup", + "system", + "table", + "tackle", + "tag", + "tail", + "talent", + "talk", + "tank", + "tape", + "target", + "task", + "taste", + "tattoo", + "taxi", + "teach", + "team", + "tell", + "ten", + "tenant", + "tennis", + "tent", + "term", + "test", + "text", + "thank", + "that", + "theme", + "then", + "theory", + "there", + "they", + "thing", + "this", + "thought", + "three", + "thrive", + "throw", + "thumb", + "thunder", + "ticket", + "tide", + "tiger", + "tilt", + "timber", + "time", + "tiny", + "tip", + "tired", + "tissue", + "title", + "toast", + "tobacco", + "today", + "toddler", + "toe", + "together", + "toilet", + "token", + "tomato", + "tomorrow", + "tone", + "tongue", + "tonight", + "tool", + "tooth", + "top", + "topic", + "topple", + "torch", + "tornado", + "tortoise", + "toss", + "total", + "tourist", + "toward", + "tower", + "town", + "toy", + "track", + "trade", + "traffic", + "tragic", + "train", + "transfer", + "trap", + "trash", + "travel", + "tray", + "treat", + "tree", + "trend", + "trial", + "tribe", + "trick", + "trigger", + "trim", + "trip", + "trophy", + "trouble", + "truck", + "true", + "truly", + "trumpet", + "trust", + "truth", + "try", + "tube", + "tuition", + "tumble", + "tuna", + "tunnel", + "turkey", + "turn", + "turtle", + "twelve", + "twenty", + "twice", + "twin", + "twist", + "two", + "type", + "typical", + "ugly", + "umbrella", + "unable", + "unaware", + "uncle", + "uncover", + "under", + "undo", + "unfair", + "unfold", + "unhappy", + "uniform", + "unique", + "unit", + "universe", + "unknown", + "unlock", + "until", + "unusual", + "unveil", + "update", + "upgrade", + "uphold", + "upon", + "upper", + "upset", + "urban", + "urge", + "usage", + "use", + "used", + "useful", + "useless", + "usual", + "utility", + "vacant", + "vacuum", + "vague", + "valid", + "valley", + "valve", + "van", + "vanish", + "vapor", + "various", + "vast", + "vault", + "vehicle", + "velvet", + "vendor", + "venture", + "venue", + "verb", + "verify", + "version", + "very", + "vessel", + "veteran", + "viable", + "vibrant", + "vicious", + "victory", + "video", + "view", + "village", + "vintage", + "violin", + "virtual", + "virus", + "visa", + "visit", + "visual", + "vital", + "vivid", + "vocal", + "voice", + "void", + "volcano", + "volume", + "vote", + "voyage", + "wage", + "wagon", + "wait", + "walk", + "wall", + "walnut", + "want", + "warfare", + "warm", + "warrior", + "wash", + "wasp", + "waste", + "water", + "wave", + "way", + "wealth", + "weapon", + "wear", + "weasel", + "weather", + "web", + "wedding", + "weekend", + "weird", + "welcome", + "west", + "wet", + "whale", + "what", + "wheat", + "wheel", + "when", + "where", + "whip", + "whisper", + "wide", + "width", + "wife", + "wild", + "will", + "win", + "window", + "wine", + "wing", + "wink", + "winner", + "winter", + "wire", + "wisdom", + "wise", + "wish", + "witness", + "wolf", + "woman", + "wonder", + "wood", + "wool", + "word", + "work", + "world", + "worry", + "worth", + "wrap", + "wreck", + "wrestle", + "wrist", + "write", + "wrong", + "yard", + "year", + "yellow", + "you", + "young", + "youth", + "zebra", + "zero", + "zone", + "zoo", +]; +function bytesToBitstring(bytes) { + return Array.from(bytes) + .map((byte) => byte.toString(2).padStart(8, "0")) + .join(""); +} +function deriveChecksumBits(entropy) { + const entropyLengthBits = entropy.length * 8; // "ENT" (in bits) + const checksumLengthBits = entropyLengthBits / 32; // "CS" (in bits) + const hash = (0, sha_1.sha256)(entropy); + return bytesToBitstring(hash).slice(0, checksumLengthBits); +} +function bitstringToByte(bin) { + return parseInt(bin, 2); +} +const allowedEntropyLengths = [16, 20, 24, 28, 32]; +const allowedWordLengths = [12, 15, 18, 21, 24]; +function entropyToMnemonic(entropy) { + if (allowedEntropyLengths.indexOf(entropy.length) === -1) { + throw new Error("invalid input length"); + } + const entropyBits = bytesToBitstring(entropy); + const checksumBits = deriveChecksumBits(entropy); + const bits = entropyBits + checksumBits; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const chunks = bits.match(/(.{11})/g); + const words = chunks.map((binary) => { + const index = bitstringToByte(binary); + return wordlist[index]; + }); + return words.join(" "); +} +exports.entropyToMnemonic = entropyToMnemonic; +const invalidNumberOfWorks = "Invalid number of words"; +const wordNotInWordlist = "Found word that is not in the wordlist"; +const invalidEntropy = "Invalid entropy"; +const invalidChecksum = "Invalid mnemonic checksum"; +function normalize(str) { + return str.normalize("NFKD"); +} +function mnemonicToEntropy(mnemonic) { + const words = normalize(mnemonic).split(" "); + if (!allowedWordLengths.includes(words.length)) { + throw new Error(invalidNumberOfWorks); + } + // convert word indices to 11 bit binary strings + const bits = words + .map((word) => { + const index = wordlist.indexOf(word); + if (index === -1) { + throw new Error(wordNotInWordlist); + } + return index.toString(2).padStart(11, "0"); + }) + .join(""); + // split the binary string into ENT/CS + const dividerIndex = Math.floor(bits.length / 33) * 32; + const entropyBits = bits.slice(0, dividerIndex); + const checksumBits = bits.slice(dividerIndex); + // calculate the checksum and compare + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const entropyBytes = entropyBits.match(/(.{1,8})/g).map(bitstringToByte); + if (entropyBytes.length < 16 || entropyBytes.length > 32 || entropyBytes.length % 4 !== 0) { + throw new Error(invalidEntropy); + } + const entropy = Uint8Array.from(entropyBytes); + const newChecksum = deriveChecksumBits(entropy); + if (newChecksum !== checksumBits) { + throw new Error(invalidChecksum); + } + return entropy; +} +exports.mnemonicToEntropy = mnemonicToEntropy; +class EnglishMnemonic { + constructor(mnemonic) { + if (!EnglishMnemonic.mnemonicMatcher.test(mnemonic)) { + throw new Error("Invalid mnemonic format"); + } + const words = mnemonic.split(" "); + const allowedWordsLengths = [12, 15, 18, 21, 24]; + if (allowedWordsLengths.indexOf(words.length) === -1) { + throw new Error(`Invalid word count in mnemonic (allowed: ${allowedWordsLengths} got: ${words.length})`); + } + for (const word of words) { + if (EnglishMnemonic.wordlist.indexOf(word) === -1) { + throw new Error("Mnemonic contains invalid word"); + } + } + // Throws with informative error message if mnemonic is not valid + mnemonicToEntropy(mnemonic); + this.data = mnemonic; + } + toString() { + return this.data; + } +} +exports.EnglishMnemonic = EnglishMnemonic; +EnglishMnemonic.wordlist = wordlist; +// list of space separated lower case words (1 or more) +EnglishMnemonic.mnemonicMatcher = /^[a-z]+( [a-z]+)*$/; +class Bip39 { + /** + * Encodes raw entropy of length 16, 20, 24, 28 or 32 bytes as an English mnemonic between 12 and 24 words. + * + * | Entropy | Words | + * |--------------------|-------| + * | 128 bit (16 bytes) | 12 | + * | 160 bit (20 bytes) | 15 | + * | 192 bit (24 bytes) | 18 | + * | 224 bit (28 bytes) | 21 | + * | 256 bit (32 bytes) | 24 | + * + * + * @see https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#generating-the-mnemonic + * @param entropy The entropy to be encoded. This must be cryptographically secure. + */ + static encode(entropy) { + return new EnglishMnemonic(entropyToMnemonic(entropy)); + } + static decode(mnemonic) { + return mnemonicToEntropy(mnemonic.toString()); + } + static async mnemonicToSeed(mnemonic, password) { + const mnemonicBytes = (0, encoding_1.toUtf8)(normalize(mnemonic.toString())); + const salt = "mnemonic" + (password ? normalize(password) : ""); + const saltBytes = (0, encoding_1.toUtf8)(salt); + return (0, pbkdf2_1.pbkdf2Sha512)(mnemonicBytes, saltBytes, 2048, 64); + } +} +exports.Bip39 = Bip39; +//# sourceMappingURL=bip39.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/hmac.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/hmac.js ***! + \**************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Hmac = void 0; +class Hmac { + constructor(hashFunctionConstructor, originalKey) { + // This implementation is based on https://en.wikipedia.org/wiki/HMAC#Implementation + // with the addition of incremental hashing support. Thus part of the algorithm + // is in the constructor and the rest in digest(). + const blockSize = new hashFunctionConstructor().blockSize; + this.hash = (data) => new hashFunctionConstructor().update(data).digest(); + let key = originalKey; + if (key.length > blockSize) { + key = this.hash(key); + } + if (key.length < blockSize) { + const zeroPadding = new Uint8Array(blockSize - key.length); + key = new Uint8Array([...key, ...zeroPadding]); + } + // eslint-disable-next-line no-bitwise + this.oKeyPad = key.map((keyByte) => keyByte ^ 0x5c); + // eslint-disable-next-line no-bitwise + this.iKeyPad = key.map((keyByte) => keyByte ^ 0x36); + this.messageHasher = new hashFunctionConstructor(); + this.blockSize = blockSize; + this.update(this.iKeyPad); + } + update(data) { + this.messageHasher.update(data); + return this; + } + digest() { + const innerHash = this.messageHasher.digest(); + return this.hash(new Uint8Array([...this.oKeyPad, ...innerHash])); + } +} +exports.Hmac = Hmac; +//# sourceMappingURL=hmac.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/index.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/index.js ***! + \***************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.stringToPath = exports.Slip10RawIndex = exports.slip10CurveFromString = exports.Slip10Curve = exports.Slip10 = exports.pathToString = exports.sha512 = exports.Sha512 = exports.sha256 = exports.Sha256 = exports.Secp256k1Signature = exports.ExtendedSecp256k1Signature = exports.Secp256k1 = exports.ripemd160 = exports.Ripemd160 = exports.Random = exports.Xchacha20poly1305Ietf = exports.xchacha20NonceLength = exports.isArgon2idOptions = exports.Ed25519Keypair = exports.Ed25519 = exports.Argon2id = exports.keccak256 = exports.Keccak256 = exports.Hmac = exports.EnglishMnemonic = exports.Bip39 = void 0; +var bip39_1 = __webpack_require__(/*! ./bip39 */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/bip39.js"); +Object.defineProperty(exports, "Bip39", ({ enumerable: true, get: function () { return bip39_1.Bip39; } })); +Object.defineProperty(exports, "EnglishMnemonic", ({ enumerable: true, get: function () { return bip39_1.EnglishMnemonic; } })); +var hmac_1 = __webpack_require__(/*! ./hmac */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/hmac.js"); +Object.defineProperty(exports, "Hmac", ({ enumerable: true, get: function () { return hmac_1.Hmac; } })); +var keccak_1 = __webpack_require__(/*! ./keccak */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/keccak.js"); +Object.defineProperty(exports, "Keccak256", ({ enumerable: true, get: function () { return keccak_1.Keccak256; } })); +Object.defineProperty(exports, "keccak256", ({ enumerable: true, get: function () { return keccak_1.keccak256; } })); +var libsodium_1 = __webpack_require__(/*! ./libsodium */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/libsodium.js"); +Object.defineProperty(exports, "Argon2id", ({ enumerable: true, get: function () { return libsodium_1.Argon2id; } })); +Object.defineProperty(exports, "Ed25519", ({ enumerable: true, get: function () { return libsodium_1.Ed25519; } })); +Object.defineProperty(exports, "Ed25519Keypair", ({ enumerable: true, get: function () { return libsodium_1.Ed25519Keypair; } })); +Object.defineProperty(exports, "isArgon2idOptions", ({ enumerable: true, get: function () { return libsodium_1.isArgon2idOptions; } })); +Object.defineProperty(exports, "xchacha20NonceLength", ({ enumerable: true, get: function () { return libsodium_1.xchacha20NonceLength; } })); +Object.defineProperty(exports, "Xchacha20poly1305Ietf", ({ enumerable: true, get: function () { return libsodium_1.Xchacha20poly1305Ietf; } })); +var random_1 = __webpack_require__(/*! ./random */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/random.js"); +Object.defineProperty(exports, "Random", ({ enumerable: true, get: function () { return random_1.Random; } })); +var ripemd_1 = __webpack_require__(/*! ./ripemd */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/ripemd.js"); +Object.defineProperty(exports, "Ripemd160", ({ enumerable: true, get: function () { return ripemd_1.Ripemd160; } })); +Object.defineProperty(exports, "ripemd160", ({ enumerable: true, get: function () { return ripemd_1.ripemd160; } })); +var secp256k1_1 = __webpack_require__(/*! ./secp256k1 */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/secp256k1.js"); +Object.defineProperty(exports, "Secp256k1", ({ enumerable: true, get: function () { return secp256k1_1.Secp256k1; } })); +var secp256k1signature_1 = __webpack_require__(/*! ./secp256k1signature */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/secp256k1signature.js"); +Object.defineProperty(exports, "ExtendedSecp256k1Signature", ({ enumerable: true, get: function () { return secp256k1signature_1.ExtendedSecp256k1Signature; } })); +Object.defineProperty(exports, "Secp256k1Signature", ({ enumerable: true, get: function () { return secp256k1signature_1.Secp256k1Signature; } })); +var sha_1 = __webpack_require__(/*! ./sha */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/sha.js"); +Object.defineProperty(exports, "Sha256", ({ enumerable: true, get: function () { return sha_1.Sha256; } })); +Object.defineProperty(exports, "sha256", ({ enumerable: true, get: function () { return sha_1.sha256; } })); +Object.defineProperty(exports, "Sha512", ({ enumerable: true, get: function () { return sha_1.Sha512; } })); +Object.defineProperty(exports, "sha512", ({ enumerable: true, get: function () { return sha_1.sha512; } })); +var slip10_1 = __webpack_require__(/*! ./slip10 */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/slip10.js"); +Object.defineProperty(exports, "pathToString", ({ enumerable: true, get: function () { return slip10_1.pathToString; } })); +Object.defineProperty(exports, "Slip10", ({ enumerable: true, get: function () { return slip10_1.Slip10; } })); +Object.defineProperty(exports, "Slip10Curve", ({ enumerable: true, get: function () { return slip10_1.Slip10Curve; } })); +Object.defineProperty(exports, "slip10CurveFromString", ({ enumerable: true, get: function () { return slip10_1.slip10CurveFromString; } })); +Object.defineProperty(exports, "Slip10RawIndex", ({ enumerable: true, get: function () { return slip10_1.Slip10RawIndex; } })); +Object.defineProperty(exports, "stringToPath", ({ enumerable: true, get: function () { return slip10_1.stringToPath; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/keccak.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/keccak.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.keccak256 = exports.Keccak256 = void 0; +const sha3_1 = __webpack_require__(/*! @noble/hashes/sha3 */ "./node_modules/@noble/hashes/sha3.js"); +const utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/utils.js"); +class Keccak256 { + constructor(firstData) { + this.blockSize = 512 / 8; + this.impl = sha3_1.keccak_256.create(); + if (firstData) { + this.update(firstData); + } + } + update(data) { + this.impl.update((0, utils_1.toRealUint8Array)(data)); + return this; + } + digest() { + return this.impl.digest(); + } +} +exports.Keccak256 = Keccak256; +/** Convenience function equivalent to `new Keccak256(data).digest()` */ +function keccak256(data) { + return new Keccak256(data).digest(); +} +exports.keccak256 = keccak256; +//# sourceMappingURL=keccak.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/libsodium.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/libsodium.js ***! + \*******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +// Keep all classes requiring libsodium-js in one file as having multiple +// requiring of the libsodium-wrappers module currently crashes browsers +// +// libsodium.js API: https://gist.github.com/webmaster128/b2dbe6d54d36dd168c9fabf441b9b09c +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Xchacha20poly1305Ietf = exports.xchacha20NonceLength = exports.Ed25519 = exports.Ed25519Keypair = exports.Argon2id = exports.isArgon2idOptions = void 0; +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/index.js"); +const libsodium_wrappers_1 = __importDefault(__webpack_require__(/*! libsodium-wrappers */ "./node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js")); +function isArgon2idOptions(thing) { + if (!(0, utils_1.isNonNullObject)(thing)) + return false; + if (typeof thing.outputLength !== "number") + return false; + if (typeof thing.opsLimit !== "number") + return false; + if (typeof thing.memLimitKib !== "number") + return false; + return true; +} +exports.isArgon2idOptions = isArgon2idOptions; +class Argon2id { + static async execute(password, salt, options) { + await libsodium_wrappers_1.default.ready; + return libsodium_wrappers_1.default.crypto_pwhash(options.outputLength, password, salt, // libsodium only supports 16 byte salts and will throw when you don't respect that + options.opsLimit, options.memLimitKib * 1024, libsodium_wrappers_1.default.crypto_pwhash_ALG_ARGON2ID13); + } +} +exports.Argon2id = Argon2id; +class Ed25519Keypair { + constructor(privkey, pubkey) { + this.privkey = privkey; + this.pubkey = pubkey; + } + // a libsodium privkey has the format ` + ` + static fromLibsodiumPrivkey(libsodiumPrivkey) { + if (libsodiumPrivkey.length !== 64) { + throw new Error(`Unexpected key length ${libsodiumPrivkey.length}. Must be 64.`); + } + return new Ed25519Keypair(libsodiumPrivkey.slice(0, 32), libsodiumPrivkey.slice(32, 64)); + } + toLibsodiumPrivkey() { + return new Uint8Array([...this.privkey, ...this.pubkey]); + } +} +exports.Ed25519Keypair = Ed25519Keypair; +class Ed25519 { + /** + * Generates a keypair deterministically from a given 32 bytes seed. + * + * This seed equals the Ed25519 private key. + * For implementation details see crypto_sign_seed_keypair in + * https://download.libsodium.org/doc/public-key_cryptography/public-key_signatures.html + * and diagram on https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/ + */ + static async makeKeypair(seed) { + await libsodium_wrappers_1.default.ready; + const keypair = libsodium_wrappers_1.default.crypto_sign_seed_keypair(seed); + return Ed25519Keypair.fromLibsodiumPrivkey(keypair.privateKey); + } + static async createSignature(message, keyPair) { + await libsodium_wrappers_1.default.ready; + return libsodium_wrappers_1.default.crypto_sign_detached(message, keyPair.toLibsodiumPrivkey()); + } + static async verifySignature(signature, message, pubkey) { + await libsodium_wrappers_1.default.ready; + return libsodium_wrappers_1.default.crypto_sign_verify_detached(signature, message, pubkey); + } +} +exports.Ed25519 = Ed25519; +/** + * Nonce length in bytes for all flavours of XChaCha20. + * + * @see https://libsodium.gitbook.io/doc/advanced/stream_ciphers/xchacha20#notes + */ +exports.xchacha20NonceLength = 24; +class Xchacha20poly1305Ietf { + static async encrypt(message, key, nonce) { + await libsodium_wrappers_1.default.ready; + const additionalData = null; + return libsodium_wrappers_1.default.crypto_aead_xchacha20poly1305_ietf_encrypt(message, additionalData, null, // secret nonce: unused and should be null (https://download.libsodium.org/doc/secret-key_cryptography/aead/chacha20-poly1305/xchacha20-poly1305_construction) + nonce, key); + } + static async decrypt(ciphertext, key, nonce) { + await libsodium_wrappers_1.default.ready; + const additionalData = null; + return libsodium_wrappers_1.default.crypto_aead_xchacha20poly1305_ietf_decrypt(null, // secret nonce: unused and should be null (https://download.libsodium.org/doc/secret-key_cryptography/aead/chacha20-poly1305/xchacha20-poly1305_construction) + ciphertext, additionalData, nonce, key); + } +} +exports.Xchacha20poly1305Ietf = Xchacha20poly1305Ietf; +//# sourceMappingURL=libsodium.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/pbkdf2.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/pbkdf2.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pbkdf2Sha512 = exports.pbkdf2Sha512Noble = exports.pbkdf2Sha512NodeCrypto = exports.pbkdf2Sha512Subtle = exports.getSubtle = exports.getNodeCrypto = void 0; +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/index.js"); +const pbkdf2_1 = __webpack_require__(/*! @noble/hashes/pbkdf2 */ "./node_modules/@noble/hashes/pbkdf2.js"); +const sha512_1 = __webpack_require__(/*! @noble/hashes/sha512 */ "./node_modules/@noble/hashes/sha512.js"); +/** + * Returns the Node.js crypto module when available and `undefined` + * otherwise. + * + * Detects an unimplemented fallback module from Webpack 5 and returns + * `undefined` in that case. + */ +async function getNodeCrypto() { + try { + const nodeCrypto = await Promise.resolve().then(() => __importStar(__webpack_require__(/*! crypto */ "./node_modules/crypto-browserify/index.js"))); + // We get `Object{default: Object{}}` as a fallback when using + // `crypto: false` in Webpack 5, which we interprete as unavailable. + if (typeof nodeCrypto === "object" && Object.keys(nodeCrypto).length <= 1) { + return undefined; + } + return nodeCrypto; + } + catch { + return undefined; + } +} +exports.getNodeCrypto = getNodeCrypto; +async function getSubtle() { + // From Node.js 15 onwards, webcrypto is available in globalThis. + // In version 15 and 16 this was stored under the webcrypto key. + // With Node.js 17 it was moved to the same locations where browsers + // make it available. + // Loading `require("crypto")` here seems unnecessary since it only + // causes issues with bundlers and does not increase compatibility. + // Browsers and Node.js 17+ + let subtle = globalThis?.crypto?.subtle; + // Node.js 15+ + if (!subtle) + subtle = globalThis?.crypto?.webcrypto?.subtle; + return subtle; +} +exports.getSubtle = getSubtle; +async function pbkdf2Sha512Subtle( +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +subtle, secret, salt, iterations, keylen) { + (0, utils_1.assert)(subtle, "Argument subtle is falsy"); + (0, utils_1.assert)(typeof subtle === "object", "Argument subtle is not of type object"); + (0, utils_1.assert)(typeof subtle.importKey === "function", "subtle.importKey is not a function"); + (0, utils_1.assert)(typeof subtle.deriveBits === "function", "subtle.deriveBits is not a function"); + return subtle.importKey("raw", secret, { name: "PBKDF2" }, false, ["deriveBits"]).then((key) => subtle + .deriveBits({ + name: "PBKDF2", + salt: salt, + iterations: iterations, + hash: { name: "SHA-512" }, + }, key, keylen * 8) + .then((buffer) => new Uint8Array(buffer))); +} +exports.pbkdf2Sha512Subtle = pbkdf2Sha512Subtle; +/** + * Implements pbkdf2-sha512 using the Node.js crypro module (`import "crypto"`). + * This does not use subtle from [Crypto](https://developer.mozilla.org/en-US/docs/Web/API/Crypto). + */ +async function pbkdf2Sha512NodeCrypto( +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +nodeCrypto, secret, salt, iterations, keylen) { + (0, utils_1.assert)(nodeCrypto, "Argument nodeCrypto is falsy"); + (0, utils_1.assert)(typeof nodeCrypto === "object", "Argument nodeCrypto is not of type object"); + (0, utils_1.assert)(typeof nodeCrypto.pbkdf2 === "function", "nodeCrypto.pbkdf2 is not a function"); + return new Promise((resolve, reject) => { + nodeCrypto.pbkdf2(secret, salt, iterations, keylen, "sha512", (error, result) => { + if (error) { + reject(error); + } + else { + resolve(Uint8Array.from(result)); + } + }); + }); +} +exports.pbkdf2Sha512NodeCrypto = pbkdf2Sha512NodeCrypto; +async function pbkdf2Sha512Noble(secret, salt, iterations, keylen) { + return (0, pbkdf2_1.pbkdf2Async)(sha512_1.sha512, secret, salt, { c: iterations, dkLen: keylen }); +} +exports.pbkdf2Sha512Noble = pbkdf2Sha512Noble; +/** + * A pbkdf2 implementation for BIP39. This is not exported at package level and thus a private API. + */ +async function pbkdf2Sha512(secret, salt, iterations, keylen) { + const subtle = await getSubtle(); + if (subtle) { + return pbkdf2Sha512Subtle(subtle, secret, salt, iterations, keylen); + } + else { + const nodeCrypto = await getNodeCrypto(); + if (nodeCrypto) { + return pbkdf2Sha512NodeCrypto(nodeCrypto, secret, salt, iterations, keylen); + } + else { + return pbkdf2Sha512Noble(secret, salt, iterations, keylen); + } + } +} +exports.pbkdf2Sha512 = pbkdf2Sha512; +//# sourceMappingURL=pbkdf2.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/random.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/random.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Random = void 0; +class Random { + /** + * Returns `count` cryptographically secure random bytes + */ + static getBytes(count) { + try { + const globalObject = typeof window === "object" ? window : self; + const cryptoApi = typeof globalObject.crypto !== "undefined" ? globalObject.crypto : globalObject.msCrypto; + const out = new Uint8Array(count); + cryptoApi.getRandomValues(out); + return out; + } + catch { + try { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const crypto = __webpack_require__(/*! crypto */ "./node_modules/crypto-browserify/index.js"); + return new Uint8Array([...crypto.randomBytes(count)]); + } + catch { + throw new Error("No secure random number generator found"); + } + } + } +} +exports.Random = Random; +//# sourceMappingURL=random.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/ripemd.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/ripemd.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ripemd160 = exports.Ripemd160 = void 0; +const ripemd160_1 = __webpack_require__(/*! @noble/hashes/ripemd160 */ "./node_modules/@noble/hashes/ripemd160.js"); +const utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/utils.js"); +class Ripemd160 { + constructor(firstData) { + this.blockSize = 512 / 8; + this.impl = ripemd160_1.ripemd160.create(); + if (firstData) { + this.update(firstData); + } + } + update(data) { + this.impl.update((0, utils_1.toRealUint8Array)(data)); + return this; + } + digest() { + return this.impl.digest(); + } +} +exports.Ripemd160 = Ripemd160; +/** Convenience function equivalent to `new Ripemd160(data).digest()` */ +function ripemd160(data) { + return new Ripemd160(data).digest(); +} +exports.ripemd160 = ripemd160; +//# sourceMappingURL=ripemd.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/secp256k1.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/secp256k1.js ***! + \*******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Secp256k1 = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/index.js"); +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +const elliptic_1 = __importDefault(__webpack_require__(/*! elliptic */ "./node_modules/elliptic/lib/elliptic.js")); +const secp256k1signature_1 = __webpack_require__(/*! ./secp256k1signature */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/secp256k1signature.js"); +const secp256k1 = new elliptic_1.default.ec("secp256k1"); +const secp256k1N = new bn_js_1.default("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", "hex"); +class Secp256k1 { + /** + * Takes a 32 byte private key and returns a privkey/pubkey pair. + * + * The resulting pubkey is uncompressed. For the use in Cosmos it should + * be compressed first using `Secp256k1.compressPubkey`. + */ + static async makeKeypair(privkey) { + if (privkey.length !== 32) { + // is this check missing in secp256k1.validatePrivateKey? + // https://github.com/bitjson/bitcoin-ts/issues/4 + throw new Error("input data is not a valid secp256k1 private key"); + } + const keypair = secp256k1.keyFromPrivate(privkey); + if (keypair.validate().result !== true) { + throw new Error("input data is not a valid secp256k1 private key"); + } + // range test that is not part of the elliptic implementation + const privkeyAsBigInteger = new bn_js_1.default(privkey); + if (privkeyAsBigInteger.gte(secp256k1N)) { + // not strictly smaller than N + throw new Error("input data is not a valid secp256k1 private key"); + } + const out = { + privkey: (0, encoding_1.fromHex)(keypair.getPrivate("hex")), + // encodes uncompressed as + // - 1-byte prefix "04" + // - 32-byte x coordinate + // - 32-byte y coordinate + pubkey: Uint8Array.from(keypair.getPublic("array")), + }; + return out; + } + /** + * Creates a signature that is + * - deterministic (RFC 6979) + * - lowS signature + * - DER encoded + */ + static async createSignature(messageHash, privkey) { + if (messageHash.length === 0) { + throw new Error("Message hash must not be empty"); + } + if (messageHash.length > 32) { + throw new Error("Message hash length must not exceed 32 bytes"); + } + const keypair = secp256k1.keyFromPrivate(privkey); + // the `canonical` option ensures creation of lowS signature representations + const { r, s, recoveryParam } = keypair.sign(messageHash, { canonical: true }); + if (typeof recoveryParam !== "number") + throw new Error("Recovery param missing"); + return new secp256k1signature_1.ExtendedSecp256k1Signature(Uint8Array.from(r.toArray()), Uint8Array.from(s.toArray()), recoveryParam); + } + static async verifySignature(signature, messageHash, pubkey) { + if (messageHash.length === 0) { + throw new Error("Message hash must not be empty"); + } + if (messageHash.length > 32) { + throw new Error("Message hash length must not exceed 32 bytes"); + } + const keypair = secp256k1.keyFromPublic(pubkey); + // From https://github.com/indutny/elliptic: + // + // Sign the message's hash (input must be an array, or a hex-string) + // + // Signature MUST be either: + // 1) DER-encoded signature as hex-string; or + // 2) DER-encoded signature as buffer; or + // 3) object with two hex-string properties (r and s); or + // 4) object with two buffer properties (r and s) + // + // Uint8Array is not a Buffer, but elliptic seems to be happy with the interface + // common to both types. Uint8Array is not an array of ints but the interface is + // similar + try { + return keypair.verify(messageHash, signature.toDer()); + } + catch (error) { + return false; + } + } + static recoverPubkey(signature, messageHash) { + const signatureForElliptic = { r: (0, encoding_1.toHex)(signature.r()), s: (0, encoding_1.toHex)(signature.s()) }; + const point = secp256k1.recoverPubKey(messageHash, signatureForElliptic, signature.recovery); + const keypair = secp256k1.keyFromPublic(point); + return (0, encoding_1.fromHex)(keypair.getPublic(false, "hex")); + } + /** + * Takes a compressed or uncompressed pubkey and return a compressed one. + * + * This function is idempotent. + */ + static compressPubkey(pubkey) { + switch (pubkey.length) { + case 33: + return pubkey; + case 65: + return Uint8Array.from(secp256k1.keyFromPublic(pubkey).getPublic(true, "array")); + default: + throw new Error("Invalid pubkey length"); + } + } + /** + * Takes a compressed or uncompressed pubkey and returns an uncompressed one. + * + * This function is idempotent. + */ + static uncompressPubkey(pubkey) { + switch (pubkey.length) { + case 33: + return Uint8Array.from(secp256k1.keyFromPublic(pubkey).getPublic(false, "array")); + case 65: + return pubkey; + default: + throw new Error("Invalid pubkey length"); + } + } + static trimRecoveryByte(signature) { + switch (signature.length) { + case 64: + return signature; + case 65: + return signature.slice(0, 64); + default: + throw new Error("Invalid signature length"); + } + } +} +exports.Secp256k1 = Secp256k1; +//# sourceMappingURL=secp256k1.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/secp256k1signature.js": +/*!****************************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/secp256k1signature.js ***! + \****************************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ExtendedSecp256k1Signature = exports.Secp256k1Signature = void 0; +function trimLeadingNullBytes(inData) { + let numberOfLeadingNullBytes = 0; + for (const byte of inData) { + if (byte === 0x00) { + numberOfLeadingNullBytes++; + } + else { + break; + } + } + return inData.slice(numberOfLeadingNullBytes); +} +const derTagInteger = 0x02; +class Secp256k1Signature { + constructor(r, s) { + if (r.length > 32 || r.length === 0 || r[0] === 0x00) { + throw new Error("Unsigned integer r must be encoded as unpadded big endian."); + } + if (s.length > 32 || s.length === 0 || s[0] === 0x00) { + throw new Error("Unsigned integer s must be encoded as unpadded big endian."); + } + this.data = { + r: r, + s: s, + }; + } + /** + * Takes the pair of integers (r, s) as 2x32 byte of binary data. + * + * Note: This is the format Cosmos SDK uses natively. + * + * @param data a 64 byte value containing integers r and s. + */ + static fromFixedLength(data) { + if (data.length !== 64) { + throw new Error(`Got invalid data length: ${data.length}. Expected 2x 32 bytes for the pair (r, s)`); + } + return new Secp256k1Signature(trimLeadingNullBytes(data.slice(0, 32)), trimLeadingNullBytes(data.slice(32, 64))); + } + static fromDer(data) { + let pos = 0; + if (data[pos++] !== 0x30) { + throw new Error("Prefix 0x30 expected"); + } + const bodyLength = data[pos++]; + if (data.length - pos !== bodyLength) { + throw new Error("Data length mismatch detected"); + } + // r + const rTag = data[pos++]; + if (rTag !== derTagInteger) { + throw new Error("INTEGER tag expected"); + } + const rLength = data[pos++]; + if (rLength >= 0x80) { + throw new Error("Decoding length values above 127 not supported"); + } + const rData = data.slice(pos, pos + rLength); + pos += rLength; + // s + const sTag = data[pos++]; + if (sTag !== derTagInteger) { + throw new Error("INTEGER tag expected"); + } + const sLength = data[pos++]; + if (sLength >= 0x80) { + throw new Error("Decoding length values above 127 not supported"); + } + const sData = data.slice(pos, pos + sLength); + pos += sLength; + return new Secp256k1Signature( + // r/s data can contain leading 0 bytes to express integers being non-negative in DER + trimLeadingNullBytes(rData), trimLeadingNullBytes(sData)); + } + r(length) { + if (length === undefined) { + return this.data.r; + } + else { + const paddingLength = length - this.data.r.length; + if (paddingLength < 0) { + throw new Error("Length too small to hold parameter r"); + } + const padding = new Uint8Array(paddingLength); + return new Uint8Array([...padding, ...this.data.r]); + } + } + s(length) { + if (length === undefined) { + return this.data.s; + } + else { + const paddingLength = length - this.data.s.length; + if (paddingLength < 0) { + throw new Error("Length too small to hold parameter s"); + } + const padding = new Uint8Array(paddingLength); + return new Uint8Array([...padding, ...this.data.s]); + } + } + toFixedLength() { + return new Uint8Array([...this.r(32), ...this.s(32)]); + } + toDer() { + // DER supports negative integers but our data is unsigned. Thus we need to prepend + // a leading 0 byte when the higest bit is set to differentiate nagative values + const rEncoded = this.data.r[0] >= 0x80 ? new Uint8Array([0, ...this.data.r]) : this.data.r; + const sEncoded = this.data.s[0] >= 0x80 ? new Uint8Array([0, ...this.data.s]) : this.data.s; + const rLength = rEncoded.length; + const sLength = sEncoded.length; + const data = new Uint8Array([derTagInteger, rLength, ...rEncoded, derTagInteger, sLength, ...sEncoded]); + return new Uint8Array([0x30, data.length, ...data]); + } +} +exports.Secp256k1Signature = Secp256k1Signature; +/** + * A Secp256k1Signature plus the recovery parameter + */ +class ExtendedSecp256k1Signature extends Secp256k1Signature { + constructor(r, s, recovery) { + super(r, s); + if (!Number.isInteger(recovery)) { + throw new Error("The recovery parameter must be an integer."); + } + if (recovery < 0 || recovery > 4) { + throw new Error("The recovery parameter must be one of 0, 1, 2, 3."); + } + this.recovery = recovery; + } + /** + * Decode extended signature from the simple fixed length encoding + * described in toFixedLength(). + */ + static fromFixedLength(data) { + if (data.length !== 65) { + throw new Error(`Got invalid data length ${data.length}. Expected 32 + 32 + 1`); + } + return new ExtendedSecp256k1Signature(trimLeadingNullBytes(data.slice(0, 32)), trimLeadingNullBytes(data.slice(32, 64)), data[64]); + } + /** + * A simple custom encoding that encodes the extended signature as + * r (32 bytes) | s (32 bytes) | recovery param (1 byte) + * where | denotes concatenation of bonary data. + */ + toFixedLength() { + return new Uint8Array([...this.r(32), ...this.s(32), this.recovery]); + } +} +exports.ExtendedSecp256k1Signature = ExtendedSecp256k1Signature; +//# sourceMappingURL=secp256k1signature.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/sha.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/sha.js ***! + \*************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.sha512 = exports.Sha512 = exports.sha256 = exports.Sha256 = void 0; +const sha256_1 = __webpack_require__(/*! @noble/hashes/sha256 */ "./node_modules/@noble/hashes/sha256.js"); +const sha512_1 = __webpack_require__(/*! @noble/hashes/sha512 */ "./node_modules/@noble/hashes/sha512.js"); +const utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/utils.js"); +class Sha256 { + constructor(firstData) { + this.blockSize = 512 / 8; + this.impl = sha256_1.sha256.create(); + if (firstData) { + this.update(firstData); + } + } + update(data) { + this.impl.update((0, utils_1.toRealUint8Array)(data)); + return this; + } + digest() { + return this.impl.digest(); + } +} +exports.Sha256 = Sha256; +/** Convenience function equivalent to `new Sha256(data).digest()` */ +function sha256(data) { + return new Sha256(data).digest(); +} +exports.sha256 = sha256; +class Sha512 { + constructor(firstData) { + this.blockSize = 1024 / 8; + this.impl = sha512_1.sha512.create(); + if (firstData) { + this.update(firstData); + } + } + update(data) { + this.impl.update((0, utils_1.toRealUint8Array)(data)); + return this; + } + digest() { + return this.impl.digest(); + } +} +exports.Sha512 = Sha512; +/** Convenience function equivalent to `new Sha512(data).digest()` */ +function sha512(data) { + return new Sha512(data).digest(); +} +exports.sha512 = sha512; +//# sourceMappingURL=sha.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/slip10.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/slip10.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.stringToPath = exports.pathToString = exports.Slip10 = exports.Slip10RawIndex = exports.slip10CurveFromString = exports.Slip10Curve = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/index.js"); +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/math/build/index.js"); +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +const elliptic_1 = __importDefault(__webpack_require__(/*! elliptic */ "./node_modules/elliptic/lib/elliptic.js")); +const hmac_1 = __webpack_require__(/*! ./hmac */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/hmac.js"); +const sha_1 = __webpack_require__(/*! ./sha */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/sha.js"); +/** + * Raw values must match the curve string in SLIP-0010 master key generation + * + * @see https://github.com/satoshilabs/slips/blob/master/slip-0010.md#master-key-generation + */ +var Slip10Curve; +(function (Slip10Curve) { + Slip10Curve["Secp256k1"] = "Bitcoin seed"; + Slip10Curve["Ed25519"] = "ed25519 seed"; +})(Slip10Curve = exports.Slip10Curve || (exports.Slip10Curve = {})); +/** + * Reverse mapping of Slip10Curve + */ +function slip10CurveFromString(curveString) { + switch (curveString) { + case Slip10Curve.Ed25519: + return Slip10Curve.Ed25519; + case Slip10Curve.Secp256k1: + return Slip10Curve.Secp256k1; + default: + throw new Error(`Unknown curve string: '${curveString}'`); + } +} +exports.slip10CurveFromString = slip10CurveFromString; +class Slip10RawIndex extends math_1.Uint32 { + static hardened(hardenedIndex) { + return new Slip10RawIndex(hardenedIndex + 2 ** 31); + } + static normal(normalIndex) { + return new Slip10RawIndex(normalIndex); + } + isHardened() { + return this.data >= 2 ** 31; + } +} +exports.Slip10RawIndex = Slip10RawIndex; +const secp256k1 = new elliptic_1.default.ec("secp256k1"); +// Universal private key derivation accoring to +// https://github.com/satoshilabs/slips/blob/master/slip-0010.md +class Slip10 { + static derivePath(curve, seed, path) { + let result = this.master(curve, seed); + for (const rawIndex of path) { + result = this.child(curve, result.privkey, result.chainCode, rawIndex); + } + return result; + } + static master(curve, seed) { + const i = new hmac_1.Hmac(sha_1.Sha512, (0, encoding_1.toAscii)(curve)).update(seed).digest(); + const il = i.slice(0, 32); + const ir = i.slice(32, 64); + if (curve !== Slip10Curve.Ed25519 && (this.isZero(il) || this.isGteN(curve, il))) { + return this.master(curve, i); + } + return { + chainCode: ir, + privkey: il, + }; + } + static child(curve, parentPrivkey, parentChainCode, rawIndex) { + let i; + if (rawIndex.isHardened()) { + const payload = new Uint8Array([0x00, ...parentPrivkey, ...rawIndex.toBytesBigEndian()]); + i = new hmac_1.Hmac(sha_1.Sha512, parentChainCode).update(payload).digest(); + } + else { + if (curve === Slip10Curve.Ed25519) { + throw new Error("Normal keys are not allowed with ed25519"); + } + else { + // Step 1 of https://github.com/satoshilabs/slips/blob/master/slip-0010.md#private-parent-key--private-child-key + // Calculate I = HMAC-SHA512(Key = c_par, Data = ser_P(point(k_par)) || ser_32(i)). + // where the functions point() and ser_p() are defined in BIP-0032 + const data = new Uint8Array([ + ...Slip10.serializedPoint(curve, new bn_js_1.default(parentPrivkey)), + ...rawIndex.toBytesBigEndian(), + ]); + i = new hmac_1.Hmac(sha_1.Sha512, parentChainCode).update(data).digest(); + } + } + return this.childImpl(curve, parentPrivkey, parentChainCode, rawIndex, i); + } + /** + * Implementation of ser_P(point(k_par)) from BIP-0032 + * + * @see https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki + */ + static serializedPoint(curve, p) { + switch (curve) { + case Slip10Curve.Secp256k1: + return (0, encoding_1.fromHex)(secp256k1.g.mul(p).encodeCompressed("hex")); + default: + throw new Error("curve not supported"); + } + } + static childImpl(curve, parentPrivkey, parentChainCode, rawIndex, i) { + // step 2 (of the Private parent key → private child key algorithm) + const il = i.slice(0, 32); + const ir = i.slice(32, 64); + // step 3 + const returnChainCode = ir; + // step 4 + if (curve === Slip10Curve.Ed25519) { + return { + chainCode: returnChainCode, + privkey: il, + }; + } + // step 5 + const n = this.n(curve); + const returnChildKeyAsNumber = new bn_js_1.default(il).add(new bn_js_1.default(parentPrivkey)).mod(n); + const returnChildKey = Uint8Array.from(returnChildKeyAsNumber.toArray("be", 32)); + // step 6 + if (this.isGteN(curve, il) || this.isZero(returnChildKey)) { + const newI = new hmac_1.Hmac(sha_1.Sha512, parentChainCode) + .update(new Uint8Array([0x01, ...ir, ...rawIndex.toBytesBigEndian()])) + .digest(); + return this.childImpl(curve, parentPrivkey, parentChainCode, rawIndex, newI); + } + // step 7 + return { + chainCode: returnChainCode, + privkey: returnChildKey, + }; + } + static isZero(privkey) { + return privkey.every((byte) => byte === 0); + } + static isGteN(curve, privkey) { + const keyAsNumber = new bn_js_1.default(privkey); + return keyAsNumber.gte(this.n(curve)); + } + static n(curve) { + switch (curve) { + case Slip10Curve.Secp256k1: + return new bn_js_1.default("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", 16); + default: + throw new Error("curve not supported"); + } + } +} +exports.Slip10 = Slip10; +function pathToString(path) { + return path.reduce((current, component) => { + const componentString = component.isHardened() + ? `${component.toNumber() - 2 ** 31}'` + : component.toString(); + return current + "/" + componentString; + }, "m"); +} +exports.pathToString = pathToString; +function stringToPath(input) { + if (!input.startsWith("m")) + throw new Error("Path string must start with 'm'"); + let rest = input.slice(1); + const out = new Array(); + while (rest) { + const match = rest.match(/^\/([0-9]+)('?)/); + if (!match) + throw new Error("Syntax error while reading path component"); + const [fullMatch, numberString, apostrophe] = match; + const value = math_1.Uint53.fromString(numberString).toNumber(); + if (value >= 2 ** 31) + throw new Error("Component value too high. Must not exceed 2**31-1."); + if (apostrophe) + out.push(Slip10RawIndex.hardened(value)); + else + out.push(Slip10RawIndex.normal(value)); + rest = rest.slice(fullMatch.length); + } + return out; +} +exports.stringToPath = stringToPath; +//# sourceMappingURL=slip10.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/utils.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/crypto/build/utils.js ***! + \***************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toRealUint8Array = void 0; +// See https://github.com/paulmillr/noble-hashes/issues/25 for why this is needed +function toRealUint8Array(data) { + if (data instanceof Uint8Array) + return data; + else + return Uint8Array.from(data); +} +exports.toRealUint8Array = toRealUint8Array; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/ascii.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/ascii.js ***! + \*****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromAscii = exports.toAscii = void 0; +function toAscii(input) { + const toNums = (str) => str.split("").map((x) => { + const charCode = x.charCodeAt(0); + // 0x00–0x1F control characters + // 0x20–0x7E printable characters + // 0x7F delete character + // 0x80–0xFF out of 7 bit ascii range + if (charCode < 0x20 || charCode > 0x7e) { + throw new Error("Cannot encode character that is out of printable ASCII range: " + charCode); + } + return charCode; + }); + return Uint8Array.from(toNums(input)); +} +exports.toAscii = toAscii; +function fromAscii(data) { + const fromNums = (listOfNumbers) => listOfNumbers.map((x) => { + // 0x00–0x1F control characters + // 0x20–0x7E printable characters + // 0x7F delete character + // 0x80–0xFF out of 7 bit ascii range + if (x < 0x20 || x > 0x7e) { + throw new Error("Cannot decode character that is out of printable ASCII range: " + x); + } + return String.fromCharCode(x); + }); + return fromNums(Array.from(data)).join(""); +} +exports.fromAscii = fromAscii; +//# sourceMappingURL=ascii.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/base64.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/base64.js ***! + \******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromBase64 = exports.toBase64 = void 0; +const base64js = __importStar(__webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")); +function toBase64(data) { + return base64js.fromByteArray(data); +} +exports.toBase64 = toBase64; +function fromBase64(base64String) { + if (!base64String.match(/^[a-zA-Z0-9+/]*={0,2}$/)) { + throw new Error("Invalid base64 string format"); + } + return base64js.toByteArray(base64String); +} +exports.fromBase64 = fromBase64; +//# sourceMappingURL=base64.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/bech32.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/bech32.js ***! + \******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.normalizeBech32 = exports.fromBech32 = exports.toBech32 = void 0; +const bech32 = __importStar(__webpack_require__(/*! bech32 */ "./node_modules/bech32/index.js")); +function toBech32(prefix, data, limit) { + const address = bech32.encode(prefix, bech32.toWords(data), limit); + return address; +} +exports.toBech32 = toBech32; +function fromBech32(address, limit = Infinity) { + const decodedAddress = bech32.decode(address, limit); + return { + prefix: decodedAddress.prefix, + data: new Uint8Array(bech32.fromWords(decodedAddress.words)), + }; +} +exports.fromBech32 = fromBech32; +/** + * Takes a bech32 address and returns a normalized (i.e. lower case) representation of it. + * + * The input is validated along the way, which makes this significantly safer than + * using `address.toLowerCase()`. + */ +function normalizeBech32(address) { + const { prefix, data } = fromBech32(address); + return toBech32(prefix, data); +} +exports.normalizeBech32 = normalizeBech32; +//# sourceMappingURL=bech32.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/hex.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/hex.js ***! + \***************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromHex = exports.toHex = void 0; +function toHex(data) { + let out = ""; + for (const byte of data) { + out += ("0" + byte.toString(16)).slice(-2); + } + return out; +} +exports.toHex = toHex; +function fromHex(hexstring) { + if (hexstring.length % 2 !== 0) { + throw new Error("hex string length must be a multiple of 2"); + } + const out = new Uint8Array(hexstring.length / 2); + for (let i = 0; i < out.length; i++) { + const j = 2 * i; + const hexByteAsString = hexstring.slice(j, j + 2); + if (!hexByteAsString.match(/[0-9a-f]{2}/i)) { + throw new Error("hex string contains invalid characters"); + } + out[i] = parseInt(hexByteAsString, 16); + } + return out; +} +exports.fromHex = fromHex; +//# sourceMappingURL=hex.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/index.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/index.js ***! + \*****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toUtf8 = exports.fromUtf8 = exports.toRfc3339 = exports.fromRfc3339 = exports.toHex = exports.fromHex = exports.toBech32 = exports.normalizeBech32 = exports.fromBech32 = exports.toBase64 = exports.fromBase64 = exports.toAscii = exports.fromAscii = void 0; +var ascii_1 = __webpack_require__(/*! ./ascii */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/ascii.js"); +Object.defineProperty(exports, "fromAscii", ({ enumerable: true, get: function () { return ascii_1.fromAscii; } })); +Object.defineProperty(exports, "toAscii", ({ enumerable: true, get: function () { return ascii_1.toAscii; } })); +var base64_1 = __webpack_require__(/*! ./base64 */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/base64.js"); +Object.defineProperty(exports, "fromBase64", ({ enumerable: true, get: function () { return base64_1.fromBase64; } })); +Object.defineProperty(exports, "toBase64", ({ enumerable: true, get: function () { return base64_1.toBase64; } })); +var bech32_1 = __webpack_require__(/*! ./bech32 */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/bech32.js"); +Object.defineProperty(exports, "fromBech32", ({ enumerable: true, get: function () { return bech32_1.fromBech32; } })); +Object.defineProperty(exports, "normalizeBech32", ({ enumerable: true, get: function () { return bech32_1.normalizeBech32; } })); +Object.defineProperty(exports, "toBech32", ({ enumerable: true, get: function () { return bech32_1.toBech32; } })); +var hex_1 = __webpack_require__(/*! ./hex */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/hex.js"); +Object.defineProperty(exports, "fromHex", ({ enumerable: true, get: function () { return hex_1.fromHex; } })); +Object.defineProperty(exports, "toHex", ({ enumerable: true, get: function () { return hex_1.toHex; } })); +var rfc3339_1 = __webpack_require__(/*! ./rfc3339 */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/rfc3339.js"); +Object.defineProperty(exports, "fromRfc3339", ({ enumerable: true, get: function () { return rfc3339_1.fromRfc3339; } })); +Object.defineProperty(exports, "toRfc3339", ({ enumerable: true, get: function () { return rfc3339_1.toRfc3339; } })); +var utf8_1 = __webpack_require__(/*! ./utf8 */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/utf8.js"); +Object.defineProperty(exports, "fromUtf8", ({ enumerable: true, get: function () { return utf8_1.fromUtf8; } })); +Object.defineProperty(exports, "toUtf8", ({ enumerable: true, get: function () { return utf8_1.toUtf8; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/rfc3339.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/rfc3339.js ***! + \*******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toRfc3339 = exports.fromRfc3339 = void 0; +const rfc3339Matcher = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?((?:[+-]\d{2}:\d{2})|Z)$/; +function padded(integer, length = 2) { + return integer.toString().padStart(length, "0"); +} +function fromRfc3339(str) { + const matches = rfc3339Matcher.exec(str); + if (!matches) { + throw new Error("Date string is not in RFC3339 format"); + } + const year = +matches[1]; + const month = +matches[2]; + const day = +matches[3]; + const hour = +matches[4]; + const minute = +matches[5]; + const second = +matches[6]; + // fractional seconds match either undefined or a string like ".1", ".123456789" + const milliSeconds = matches[7] ? Math.floor(+matches[7] * 1000) : 0; + let tzOffsetSign; + let tzOffsetHours; + let tzOffsetMinutes; + // if timezone is undefined, it must be Z or nothing (otherwise the group would have captured). + if (matches[8] === "Z") { + tzOffsetSign = 1; + tzOffsetHours = 0; + tzOffsetMinutes = 0; + } + else { + tzOffsetSign = matches[8].substring(0, 1) === "-" ? -1 : 1; + tzOffsetHours = +matches[8].substring(1, 3); + tzOffsetMinutes = +matches[8].substring(4, 6); + } + const tzOffset = tzOffsetSign * (tzOffsetHours * 60 + tzOffsetMinutes) * 60; // seconds + const timestamp = Date.UTC(year, month - 1, day, hour, minute, second, milliSeconds) - tzOffset * 1000; + return new Date(timestamp); +} +exports.fromRfc3339 = fromRfc3339; +function toRfc3339(date) { + const year = date.getUTCFullYear(); + const month = padded(date.getUTCMonth() + 1); + const day = padded(date.getUTCDate()); + const hour = padded(date.getUTCHours()); + const minute = padded(date.getUTCMinutes()); + const second = padded(date.getUTCSeconds()); + const ms = padded(date.getUTCMilliseconds(), 3); + return `${year}-${month}-${day}T${hour}:${minute}:${second}.${ms}Z`; +} +exports.toRfc3339 = toRfc3339; +//# sourceMappingURL=rfc3339.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/utf8.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/encoding/build/utf8.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromUtf8 = exports.toUtf8 = void 0; +function toUtf8(str) { + return new TextEncoder().encode(str); +} +exports.toUtf8 = toUtf8; +/** + * Takes UTF-8 data and decodes it to a string. + * + * In lossy mode, the replacement character � is used to substitude invalid + * encodings. By default lossy mode is off and invalid data will lead to exceptions. + */ +function fromUtf8(data, lossy = false) { + const fatal = !lossy; + return new TextDecoder("utf-8", { fatal }).decode(data); +} +exports.fromUtf8 = fromUtf8; +//# sourceMappingURL=utf8.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/math/build/decimal.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/math/build/decimal.js ***! + \***************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Decimal = void 0; +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +// Too large values lead to massive memory usage. Limit to something sensible. +// The largest value we need is 18 (Ether). +const maxFractionalDigits = 100; +/** + * A type for arbitrary precision, non-negative decimals. + * + * Instances of this class are immutable. + */ +class Decimal { + constructor(atomics, fractionalDigits) { + if (!atomics.match(/^[0-9]+$/)) { + throw new Error("Invalid string format. Only non-negative integers in decimal representation supported."); + } + this.data = { + atomics: new bn_js_1.default(atomics), + fractionalDigits: fractionalDigits, + }; + } + static fromUserInput(input, fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + const badCharacter = input.match(/[^0-9.]/); + if (badCharacter) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + throw new Error(`Invalid character at position ${badCharacter.index + 1}`); + } + let whole; + let fractional; + if (input === "") { + whole = "0"; + fractional = ""; + } + else if (input.search(/\./) === -1) { + // integer format, no separator + whole = input; + fractional = ""; + } + else { + const parts = input.split("."); + switch (parts.length) { + case 0: + case 1: + throw new Error("Fewer than two elements in split result. This must not happen here."); + case 2: + if (!parts[1]) + throw new Error("Fractional part missing"); + whole = parts[0]; + fractional = parts[1].replace(/0+$/, ""); + break; + default: + throw new Error("More than one separator found"); + } + } + if (fractional.length > fractionalDigits) { + throw new Error("Got more fractional digits than supported"); + } + const quantity = `${whole}${fractional.padEnd(fractionalDigits, "0")}`; + return new Decimal(quantity, fractionalDigits); + } + static fromAtomics(atomics, fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal(atomics, fractionalDigits); + } + /** + * Creates a Decimal with value 0.0 and the given number of fractial digits. + * + * Fractional digits are not relevant for the value but needed to be able + * to perform arithmetic operations with other decimals. + */ + static zero(fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal("0", fractionalDigits); + } + /** + * Creates a Decimal with value 1.0 and the given number of fractial digits. + * + * Fractional digits are not relevant for the value but needed to be able + * to perform arithmetic operations with other decimals. + */ + static one(fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal("1" + "0".repeat(fractionalDigits), fractionalDigits); + } + static verifyFractionalDigits(fractionalDigits) { + if (!Number.isInteger(fractionalDigits)) + throw new Error("Fractional digits is not an integer"); + if (fractionalDigits < 0) + throw new Error("Fractional digits must not be negative"); + if (fractionalDigits > maxFractionalDigits) { + throw new Error(`Fractional digits must not exceed ${maxFractionalDigits}`); + } + } + static compare(a, b) { + if (a.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + return a.data.atomics.cmp(new bn_js_1.default(b.atomics)); + } + get atomics() { + return this.data.atomics.toString(); + } + get fractionalDigits() { + return this.data.fractionalDigits; + } + /** Creates a new instance with the same value */ + clone() { + return new Decimal(this.atomics, this.fractionalDigits); + } + /** Returns the greatest decimal <= this which has no fractional part (rounding down) */ + floor() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return this.clone(); + } + else { + return Decimal.fromAtomics(whole.mul(factor).toString(), this.fractionalDigits); + } + } + /** Returns the smallest decimal >= this which has no fractional part (rounding up) */ + ceil() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return this.clone(); + } + else { + return Decimal.fromAtomics(whole.addn(1).mul(factor).toString(), this.fractionalDigits); + } + } + toString() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return whole.toString(); + } + else { + const fullFractionalPart = fractional.toString().padStart(this.data.fractionalDigits, "0"); + const trimmedFractionalPart = fullFractionalPart.replace(/0+$/, ""); + return `${whole.toString()}.${trimmedFractionalPart}`; + } + } + /** + * Returns an approximation as a float type. Only use this if no + * exact calculation is required. + */ + toFloatApproximation() { + const out = Number(this.toString()); + if (Number.isNaN(out)) + throw new Error("Conversion to number failed"); + return out; + } + /** + * a.plus(b) returns a+b. + * + * Both values need to have the same fractional digits. + */ + plus(b) { + if (this.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + const sum = this.data.atomics.add(new bn_js_1.default(b.atomics)); + return new Decimal(sum.toString(), this.fractionalDigits); + } + /** + * a.minus(b) returns a-b. + * + * Both values need to have the same fractional digits. + * The resulting difference needs to be non-negative. + */ + minus(b) { + if (this.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + const difference = this.data.atomics.sub(new bn_js_1.default(b.atomics)); + if (difference.ltn(0)) + throw new Error("Difference must not be negative"); + return new Decimal(difference.toString(), this.fractionalDigits); + } + /** + * a.multiply(b) returns a*b. + * + * We only allow multiplication by unsigned integers to avoid rounding errors. + */ + multiply(b) { + const product = this.data.atomics.mul(new bn_js_1.default(b.toString())); + return new Decimal(product.toString(), this.fractionalDigits); + } + equals(b) { + return Decimal.compare(this, b) === 0; + } + isLessThan(b) { + return Decimal.compare(this, b) < 0; + } + isLessThanOrEqual(b) { + return Decimal.compare(this, b) <= 0; + } + isGreaterThan(b) { + return Decimal.compare(this, b) > 0; + } + isGreaterThanOrEqual(b) { + return Decimal.compare(this, b) >= 0; + } +} +exports.Decimal = Decimal; +//# sourceMappingURL=decimal.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/math/build/index.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/math/build/index.js ***! + \*************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Uint64 = exports.Uint53 = exports.Uint32 = exports.Int53 = exports.Decimal = void 0; +var decimal_1 = __webpack_require__(/*! ./decimal */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/math/build/decimal.js"); +Object.defineProperty(exports, "Decimal", ({ enumerable: true, get: function () { return decimal_1.Decimal; } })); +var integers_1 = __webpack_require__(/*! ./integers */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/math/build/integers.js"); +Object.defineProperty(exports, "Int53", ({ enumerable: true, get: function () { return integers_1.Int53; } })); +Object.defineProperty(exports, "Uint32", ({ enumerable: true, get: function () { return integers_1.Uint32; } })); +Object.defineProperty(exports, "Uint53", ({ enumerable: true, get: function () { return integers_1.Uint53; } })); +Object.defineProperty(exports, "Uint64", ({ enumerable: true, get: function () { return integers_1.Uint64; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/math/build/integers.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/math/build/integers.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Uint64 = exports.Uint53 = exports.Int53 = exports.Uint32 = void 0; +/* eslint-disable no-bitwise */ +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +const uint64MaxValue = new bn_js_1.default("18446744073709551615", 10, "be"); +class Uint32 { + constructor(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + if (input < 0 || input > 4294967295) { + throw new Error("Input not in uint32 range: " + input.toString()); + } + this.data = input; + } + /** @deprecated use Uint32.fromBytes */ + static fromBigEndianBytes(bytes) { + return Uint32.fromBytes(bytes); + } + /** + * Creates a Uint32 from a fixed length byte array. + * + * @param bytes a list of exactly 4 bytes + * @param endianess defaults to big endian + */ + static fromBytes(bytes, endianess = "be") { + if (bytes.length !== 4) { + throw new Error("Invalid input length. Expected 4 bytes."); + } + for (let i = 0; i < bytes.length; ++i) { + if (!Number.isInteger(bytes[i]) || bytes[i] > 255 || bytes[i] < 0) { + throw new Error("Invalid value in byte. Found: " + bytes[i]); + } + } + const beBytes = endianess === "be" ? bytes : Array.from(bytes).reverse(); + // Use mulitiplication instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint32(beBytes[0] * 2 ** 24 + beBytes[1] * 2 ** 16 + beBytes[2] * 2 ** 8 + beBytes[3]); + } + static fromString(str) { + if (!str.match(/^[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Uint32(Number.parseInt(str, 10)); + } + toBytesBigEndian() { + // Use division instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint8Array([ + Math.floor(this.data / 2 ** 24) & 0xff, + Math.floor(this.data / 2 ** 16) & 0xff, + Math.floor(this.data / 2 ** 8) & 0xff, + Math.floor(this.data / 2 ** 0) & 0xff, + ]); + } + toBytesLittleEndian() { + // Use division instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint8Array([ + Math.floor(this.data / 2 ** 0) & 0xff, + Math.floor(this.data / 2 ** 8) & 0xff, + Math.floor(this.data / 2 ** 16) & 0xff, + Math.floor(this.data / 2 ** 24) & 0xff, + ]); + } + toNumber() { + return this.data; + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Uint32 = Uint32; +class Int53 { + constructor(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + if (input < Number.MIN_SAFE_INTEGER || input > Number.MAX_SAFE_INTEGER) { + throw new Error("Input not in int53 range: " + input.toString()); + } + this.data = input; + } + static fromString(str) { + if (!str.match(/^-?[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Int53(Number.parseInt(str, 10)); + } + toNumber() { + return this.data; + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Int53 = Int53; +class Uint53 { + constructor(input) { + const signed = new Int53(input); + if (signed.toNumber() < 0) { + throw new Error("Input is negative"); + } + this.data = signed; + } + static fromString(str) { + const signed = Int53.fromString(str); + return new Uint53(signed.toNumber()); + } + toNumber() { + return this.data.toNumber(); + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Uint53 = Uint53; +class Uint64 { + constructor(data) { + if (data.isNeg()) { + throw new Error("Input is negative"); + } + if (data.gt(uint64MaxValue)) { + throw new Error("Input exceeds uint64 range"); + } + this.data = data; + } + /** @deprecated use Uint64.fromBytes */ + static fromBytesBigEndian(bytes) { + return Uint64.fromBytes(bytes); + } + /** + * Creates a Uint64 from a fixed length byte array. + * + * @param bytes a list of exactly 8 bytes + * @param endianess defaults to big endian + */ + static fromBytes(bytes, endianess = "be") { + if (bytes.length !== 8) { + throw new Error("Invalid input length. Expected 8 bytes."); + } + for (let i = 0; i < bytes.length; ++i) { + if (!Number.isInteger(bytes[i]) || bytes[i] > 255 || bytes[i] < 0) { + throw new Error("Invalid value in byte. Found: " + bytes[i]); + } + } + const beBytes = endianess === "be" ? Array.from(bytes) : Array.from(bytes).reverse(); + return new Uint64(new bn_js_1.default(beBytes)); + } + static fromString(str) { + if (!str.match(/^[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Uint64(new bn_js_1.default(str, 10, "be")); + } + static fromNumber(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + let bigint; + try { + bigint = new bn_js_1.default(input); + } + catch { + throw new Error("Input is not a safe integer"); + } + return new Uint64(bigint); + } + toBytesBigEndian() { + return Uint8Array.from(this.data.toArray("be", 8)); + } + toBytesLittleEndian() { + return Uint8Array.from(this.data.toArray("le", 8)); + } + toString() { + return this.data.toString(10); + } + toBigInt() { + return BigInt(this.toString()); + } + toNumber() { + return this.data.toNumber(); + } +} +exports.Uint64 = Uint64; +// Assign classes to unused variables in order to verify static interface conformance at compile time. +// Workaround for https://github.com/microsoft/TypeScript/issues/33892 +const _int53Class = Int53; +const _uint53Class = Uint53; +const _uint32Class = Uint32; +const _uint64Class = Uint64; +//# sourceMappingURL=integers.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/arrays.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/arrays.js ***! + \***************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.arrayContentStartsWith = exports.arrayContentEquals = void 0; +/** + * Compares the content of two arrays-like objects for equality. + * + * Equality is defined as having equal length and element values, where element equality means `===` returning `true`. + * + * This allows you to compare the content of a Buffer, Uint8Array or number[], ignoring the specific type. + * As a consequence, this returns different results than Jasmine's `toEqual`, which ensures elements have the same type. + */ +function arrayContentEquals(a, b) { + if (a.length !== b.length) + return false; + for (let i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; +} +exports.arrayContentEquals = arrayContentEquals; +/** + * Checks if `a` starts with the contents of `b`. + * + * This requires equality of the element values, where element equality means `===` returning `true`. + * + * This allows you to compare the content of a Buffer, Uint8Array or number[], ignoring the specific type. + * As a consequence, this returns different results than Jasmine's `toEqual`, which ensures elements have the same type. + */ +function arrayContentStartsWith(a, b) { + if (a.length < b.length) + return false; + for (let i = 0; i < b.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; +} +exports.arrayContentStartsWith = arrayContentStartsWith; +//# sourceMappingURL=arrays.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/assert.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/assert.js ***! + \***************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.assertDefinedAndNotNull = exports.assertDefined = exports.assert = void 0; +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function assert(condition, msg) { + if (!condition) { + throw new Error(msg || "condition is not truthy"); + } +} +exports.assert = assert; +function assertDefined(value, msg) { + if (value === undefined) { + throw new Error(msg ?? "value is undefined"); + } +} +exports.assertDefined = assertDefined; +function assertDefinedAndNotNull(value, msg) { + if (value === undefined || value === null) { + throw new Error(msg ?? "value is undefined or null"); + } +} +exports.assertDefinedAndNotNull = assertDefinedAndNotNull; +//# sourceMappingURL=assert.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/index.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/index.js ***! + \**************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isUint8Array = exports.isNonNullObject = exports.isDefined = exports.sleep = exports.assertDefinedAndNotNull = exports.assertDefined = exports.assert = exports.arrayContentStartsWith = exports.arrayContentEquals = void 0; +var arrays_1 = __webpack_require__(/*! ./arrays */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/arrays.js"); +Object.defineProperty(exports, "arrayContentEquals", ({ enumerable: true, get: function () { return arrays_1.arrayContentEquals; } })); +Object.defineProperty(exports, "arrayContentStartsWith", ({ enumerable: true, get: function () { return arrays_1.arrayContentStartsWith; } })); +var assert_1 = __webpack_require__(/*! ./assert */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/assert.js"); +Object.defineProperty(exports, "assert", ({ enumerable: true, get: function () { return assert_1.assert; } })); +Object.defineProperty(exports, "assertDefined", ({ enumerable: true, get: function () { return assert_1.assertDefined; } })); +Object.defineProperty(exports, "assertDefinedAndNotNull", ({ enumerable: true, get: function () { return assert_1.assertDefinedAndNotNull; } })); +var sleep_1 = __webpack_require__(/*! ./sleep */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/sleep.js"); +Object.defineProperty(exports, "sleep", ({ enumerable: true, get: function () { return sleep_1.sleep; } })); +var typechecks_1 = __webpack_require__(/*! ./typechecks */ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/typechecks.js"); +Object.defineProperty(exports, "isDefined", ({ enumerable: true, get: function () { return typechecks_1.isDefined; } })); +Object.defineProperty(exports, "isNonNullObject", ({ enumerable: true, get: function () { return typechecks_1.isNonNullObject; } })); +Object.defineProperty(exports, "isUint8Array", ({ enumerable: true, get: function () { return typechecks_1.isUint8Array; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/sleep.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/sleep.js ***! + \**************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.sleep = void 0; +async function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} +exports.sleep = sleep; +//# sourceMappingURL=sleep.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/typechecks.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/proto-signing/node_modules/@cosmjs/utils/build/typechecks.js ***! + \*******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isDefined = exports.isUint8Array = exports.isNonNullObject = void 0; +/** + * Checks if data is a non-null object (i.e. matches the TypeScript object type). + * + * Note: this returns true for arrays, which are objects in JavaScript + * even though array and object are different types in JSON. + * + * @see https://www.typescriptlang.org/docs/handbook/basic-types.html#object + */ +// eslint-disable-next-line @typescript-eslint/ban-types +function isNonNullObject(data) { + return typeof data === "object" && data !== null; +} +exports.isNonNullObject = isNonNullObject; +/** + * Checks if data is an Uint8Array. Note: Buffer is treated as not a Uint8Array + */ +function isUint8Array(data) { + if (!isNonNullObject(data)) + return false; + // Avoid instanceof check which is unreliable in some JS environments + // https://medium.com/@simonwarta/limitations-of-the-instanceof-operator-f4bcdbe7a400 + // Use check that was discussed in https://github.com/crypto-browserify/pbkdf2/pull/81 + if (Object.prototype.toString.call(data) !== "[object Uint8Array]") + return false; + if (typeof Buffer !== "undefined" && typeof Buffer.isBuffer !== "undefined") { + // Buffer.isBuffer is available at runtime + if (Buffer.isBuffer(data)) + return false; + } + return true; +} +exports.isUint8Array = isUint8Array; +/** + * Checks if input is not undefined in a TypeScript-friendly way. + * + * This is convenient to use in e.g. `Array.filter` as it will convert + * the type of a `Array` to `Array`. + */ +function isDefined(value) { + return value !== undefined; +} +exports.isDefined = isDefined; +//# sourceMappingURL=typechecks.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/socket/build/index.js": +/*!****************************************************!*\ + !*** ./node_modules/@cosmjs/socket/build/index.js ***! + \****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StreamingSocket = exports.SocketWrapper = exports.ReconnectingSocket = exports.QueueingStreamingSocket = exports.ConnectionStatus = void 0; +var queueingstreamingsocket_1 = __webpack_require__(/*! ./queueingstreamingsocket */ "./node_modules/@cosmjs/socket/build/queueingstreamingsocket.js"); +Object.defineProperty(exports, "ConnectionStatus", ({ enumerable: true, get: function () { return queueingstreamingsocket_1.ConnectionStatus; } })); +Object.defineProperty(exports, "QueueingStreamingSocket", ({ enumerable: true, get: function () { return queueingstreamingsocket_1.QueueingStreamingSocket; } })); +var reconnectingsocket_1 = __webpack_require__(/*! ./reconnectingsocket */ "./node_modules/@cosmjs/socket/build/reconnectingsocket.js"); +Object.defineProperty(exports, "ReconnectingSocket", ({ enumerable: true, get: function () { return reconnectingsocket_1.ReconnectingSocket; } })); +var socketwrapper_1 = __webpack_require__(/*! ./socketwrapper */ "./node_modules/@cosmjs/socket/build/socketwrapper.js"); +Object.defineProperty(exports, "SocketWrapper", ({ enumerable: true, get: function () { return socketwrapper_1.SocketWrapper; } })); +var streamingsocket_1 = __webpack_require__(/*! ./streamingsocket */ "./node_modules/@cosmjs/socket/build/streamingsocket.js"); +Object.defineProperty(exports, "StreamingSocket", ({ enumerable: true, get: function () { return streamingsocket_1.StreamingSocket; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/socket/build/queueingstreamingsocket.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@cosmjs/socket/build/queueingstreamingsocket.js ***! + \**********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueueingStreamingSocket = exports.ConnectionStatus = void 0; +const stream_1 = __webpack_require__(/*! @cosmjs/stream */ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/index.js"); +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +const streamingsocket_1 = __webpack_require__(/*! ./streamingsocket */ "./node_modules/@cosmjs/socket/build/streamingsocket.js"); +var ConnectionStatus; +(function (ConnectionStatus) { + ConnectionStatus[ConnectionStatus["Unconnected"] = 0] = "Unconnected"; + ConnectionStatus[ConnectionStatus["Connecting"] = 1] = "Connecting"; + ConnectionStatus[ConnectionStatus["Connected"] = 2] = "Connected"; + ConnectionStatus[ConnectionStatus["Disconnected"] = 3] = "Disconnected"; +})(ConnectionStatus = exports.ConnectionStatus || (exports.ConnectionStatus = {})); +/** + * A wrapper around StreamingSocket that can queue requests. + */ +class QueueingStreamingSocket { + constructor(url, timeout = 10000, reconnectedHandler) { + this.queue = []; + this.isProcessingQueue = false; + this.url = url; + this.timeout = timeout; + this.reconnectedHandler = reconnectedHandler; + const eventProducer = { + start: (listener) => (this.eventProducerListener = listener), + stop: () => (this.eventProducerListener = undefined), + }; + this.events = xstream_1.Stream.create(eventProducer); + this.connectionStatusProducer = new stream_1.DefaultValueProducer(ConnectionStatus.Unconnected); + this.connectionStatus = new stream_1.ValueAndUpdates(this.connectionStatusProducer); + this.socket = new streamingsocket_1.StreamingSocket(this.url, this.timeout); + this.socket.events.subscribe({ + next: (event) => { + if (!this.eventProducerListener) + throw new Error("No event producer listener set"); + this.eventProducerListener.next(event); + }, + error: () => this.connectionStatusProducer.update(ConnectionStatus.Disconnected), + }); + } + connect() { + this.connectionStatusProducer.update(ConnectionStatus.Connecting); + this.socket.connected.then(async () => { + this.connectionStatusProducer.update(ConnectionStatus.Connected); + return this.processQueue(); + }, () => this.connectionStatusProducer.update(ConnectionStatus.Disconnected)); + this.socket.connect(); + } + disconnect() { + this.connectionStatusProducer.update(ConnectionStatus.Disconnected); + this.socket.disconnect(); + } + reconnect() { + this.socket = new streamingsocket_1.StreamingSocket(this.url, this.timeout); + this.socket.events.subscribe({ + next: (event) => { + if (!this.eventProducerListener) + throw new Error("No event producer listener set"); + this.eventProducerListener.next(event); + }, + error: () => this.connectionStatusProducer.update(ConnectionStatus.Disconnected), + }); + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this.socket.connected.then(() => { + if (this.reconnectedHandler) { + this.reconnectedHandler(); + } + }); + this.connect(); + } + getQueueLength() { + return this.queue.length; + } + queueRequest(request) { + this.queue.push(request); + // We don’t need to wait for the queue to be processed. + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this.processQueue(); + } + async processQueue() { + if (this.isProcessingQueue || this.connectionStatus.value !== ConnectionStatus.Connected) { + return; + } + this.isProcessingQueue = true; + let request; + while ((request = this.queue.shift())) { + try { + await this.socket.send(request); + this.isProcessingQueue = false; + } + catch (error) { + // Probably the connection is down; will try again automatically when reconnected. + this.queue.unshift(request); + this.isProcessingQueue = false; + return; + } + } + } +} +exports.QueueingStreamingSocket = QueueingStreamingSocket; +//# sourceMappingURL=queueingstreamingsocket.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/socket/build/reconnectingsocket.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@cosmjs/socket/build/reconnectingsocket.js ***! + \*****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ReconnectingSocket = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +const queueingstreamingsocket_1 = __webpack_require__(/*! ./queueingstreamingsocket */ "./node_modules/@cosmjs/socket/build/queueingstreamingsocket.js"); +/** + * A wrapper around QueueingStreamingSocket that reconnects automatically. + */ +class ReconnectingSocket { + constructor(url, timeout = 10000, reconnectedHandler) { + this.unconnected = true; + this.disconnected = false; + this.timeoutIndex = 0; + this.reconnectTimeout = null; + const eventProducer = { + start: (listener) => (this.eventProducerListener = listener), + stop: () => (this.eventProducerListener = undefined), + }; + this.events = xstream_1.Stream.create(eventProducer); + this.socket = new queueingstreamingsocket_1.QueueingStreamingSocket(url, timeout, reconnectedHandler); + this.socket.events.subscribe({ + next: (event) => { + if (this.eventProducerListener) { + this.eventProducerListener.next(event); + } + }, + error: (error) => { + if (this.eventProducerListener) { + this.eventProducerListener.error(error); + } + }, + }); + this.connectionStatus = this.socket.connectionStatus; + this.connectionStatus.updates.subscribe({ + next: (status) => { + if (status === queueingstreamingsocket_1.ConnectionStatus.Connected) { + this.timeoutIndex = 0; + } + if (status === queueingstreamingsocket_1.ConnectionStatus.Disconnected) { + if (this.reconnectTimeout) { + clearTimeout(this.reconnectTimeout); + this.reconnectTimeout = null; + } + this.reconnectTimeout = setTimeout(() => this.socket.reconnect(), ReconnectingSocket.calculateTimeout(this.timeoutIndex++)); + } + }, + }); + } + /** Starts with a 0.1 second timeout, then doubles every attempt with a maximum timeout of 5 seconds. */ + static calculateTimeout(index) { + return Math.min(2 ** index * 100, 5000); + } + connect() { + if (!this.unconnected) { + throw new Error("Cannot connect: socket has already connected"); + } + this.socket.connect(); + this.unconnected = false; + } + disconnect() { + if (this.unconnected) { + throw new Error("Cannot disconnect: socket has not yet connected"); + } + this.socket.disconnect(); + if (this.eventProducerListener) { + this.eventProducerListener.complete(); + } + this.disconnected = true; + } + queueRequest(request) { + if (this.disconnected) { + throw new Error("Cannot queue request: socket has disconnected"); + } + this.socket.queueRequest(request); + } +} +exports.ReconnectingSocket = ReconnectingSocket; +//# sourceMappingURL=reconnectingsocket.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/socket/build/socketwrapper.js": +/*!************************************************************!*\ + !*** ./node_modules/@cosmjs/socket/build/socketwrapper.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SocketWrapper = void 0; +const isomorphic_ws_1 = __importDefault(__webpack_require__(/*! isomorphic-ws */ "./node_modules/isomorphic-ws/browser.js")); +function environmentIsNodeJs() { + return ( true && + typeof ({"env":{"NODE_ENV":"production"}}).versions !== "undefined" && + typeof ({"env":{"NODE_ENV":"production"}}).versions.node !== "undefined"); +} +/** + * A thin wrapper around isomorphic-ws' WebSocket class that adds + * - constant message/error/open/close handlers + * - explict connection via a connect() method + * - type support for events + * - handling of corner cases in the open and close behaviour + */ +class SocketWrapper { + constructor(url, messageHandler, errorHandler, openHandler, closeHandler, timeout = 10000) { + this.closed = false; + this.connected = new Promise((resolve, reject) => { + this.connectedResolver = resolve; + this.connectedRejecter = reject; + }); + this.url = url; + this.messageHandler = messageHandler; + this.errorHandler = errorHandler; + this.openHandler = openHandler; + this.closeHandler = closeHandler; + this.timeout = timeout; + } + /** + * returns a promise that resolves when connection is open + */ + connect() { + const socket = new isomorphic_ws_1.default(this.url); + socket.onerror = (error) => { + this.clearTimeout(); + if (this.errorHandler) { + this.errorHandler(error); + } + }; + socket.onmessage = (messageEvent) => { + this.messageHandler({ + type: messageEvent.type, + data: messageEvent.data, + }); + }; + socket.onopen = (_) => { + this.clearTimeout(); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + this.connectedResolver(); + if (this.openHandler) { + this.openHandler(); + } + }; + socket.onclose = (closeEvent) => { + this.closed = true; + if (this.closeHandler) { + this.closeHandler(closeEvent); + } + }; + const started = Date.now(); + this.timeoutId = setTimeout(() => { + socket.onmessage = () => 0; + socket.onerror = () => 0; + socket.onopen = () => 0; + socket.onclose = () => 0; + socket.close(); + this.socket = undefined; + const elapsed = Math.floor(Date.now() - started); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + this.connectedRejecter(`Connection attempt timed out after ${elapsed} ms`); + }, this.timeout); + this.socket = socket; + } + /** + * Closes an established connection and aborts other connection states + */ + disconnect() { + if (!this.socket) { + throw new Error("Socket undefined. This must be called after connecting."); + } + this.clearTimeout(); + switch (this.socket.readyState) { + case isomorphic_ws_1.default.OPEN: + this.socket.close(1000 /* Normal Closure */); + break; + case isomorphic_ws_1.default.CLOSED: + // nothing to be done + break; + case isomorphic_ws_1.default.CONNECTING: + // imitate missing abort API + this.socket.onopen = () => 0; + this.socket.onclose = () => 0; + this.socket.onerror = () => 0; + this.socket.onmessage = () => 0; + this.socket = undefined; + if (this.closeHandler) { + this.closeHandler({ wasClean: false, code: 4001 }); + } + break; + case isomorphic_ws_1.default.CLOSING: + // already closing. Let it proceed + break; + default: + throw new Error(`Unknown readyState: ${this.socket.readyState}`); + } + } + async send(data) { + return new Promise((resolve, reject) => { + if (!this.socket) { + throw new Error("Socket undefined. This must be called after connecting."); + } + if (this.closed) { + throw new Error("Socket was closed, so no data can be sent anymore."); + } + // this exception should be thrown by send() automatically according to + // https://developer.mozilla.org/de/docs/Web/API/WebSocket#send() but it does not work in browsers + if (this.socket.readyState !== isomorphic_ws_1.default.OPEN) { + throw new Error("Websocket is not open"); + } + if (environmentIsNodeJs()) { + this.socket.send(data, (err) => (err ? reject(err) : resolve())); + } + else { + // Browser websocket send method does not accept a callback + this.socket.send(data); + resolve(); + } + }); + } + /** + * Clears the timeout function, such that no timeout error will be raised anymore. This should be + * called when the connection is established, a connection error occurred or the socket is disconnected. + * + * This method must not be called before `connect()`. + * This method is idempotent. + */ + clearTimeout() { + if (!this.timeoutId) { + throw new Error("Timeout ID not set. This should not happen and usually means connect() was not called."); + } + // Note: do not unset this.timeoutId to allow multiple calls to this function + clearTimeout(this.timeoutId); + } +} +exports.SocketWrapper = SocketWrapper; +//# sourceMappingURL=socketwrapper.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/socket/build/streamingsocket.js": +/*!**************************************************************!*\ + !*** ./node_modules/@cosmjs/socket/build/streamingsocket.js ***! + \**************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StreamingSocket = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +const socketwrapper_1 = __webpack_require__(/*! ./socketwrapper */ "./node_modules/@cosmjs/socket/build/socketwrapper.js"); +/** + * A WebSocket wrapper that exposes all events as a stream. + * + * This underlying socket will not be closed when the stream has no listeners + */ +class StreamingSocket { + constructor(url, timeout = 10000) { + this.socket = new socketwrapper_1.SocketWrapper(url, (event) => { + if (this.eventProducerListener) { + this.eventProducerListener.next(event); + } + }, (errorEvent) => { + if (this.eventProducerListener) { + this.eventProducerListener.error(errorEvent); + } + }, () => { + // socket opened + }, (closeEvent) => { + if (this.eventProducerListener) { + if (closeEvent.wasClean) { + this.eventProducerListener.complete(); + } + else { + this.eventProducerListener.error("Socket was closed unclean"); + } + } + }, timeout); + this.connected = this.socket.connected; + const eventProducer = { + start: (listener) => (this.eventProducerListener = listener), + stop: () => (this.eventProducerListener = undefined), + }; + this.events = xstream_1.Stream.create(eventProducer); + } + connect() { + this.socket.connect(); + } + disconnect() { + this.socket.disconnect(); + } + async send(data) { + return this.socket.send(data); + } +} +exports.StreamingSocket = StreamingSocket; +//# sourceMappingURL=streamingsocket.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/concat.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/concat.js ***! + \*********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.concat = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +/** + * An implementation of concat that buffers all source stream events + * + * Marble diagram: + * + * ```text + * --1--2---3---4-| + * -a--b-c--d-| + * --------X---------Y---------Z- + * concat + * --1--2---3---4-abcdXY-------Z- + * ``` + * + * This is inspired by RxJS's concat as documented at http://rxmarbles.com/#concat and behaves + * differently than xstream's concat as discussed in https://github.com/staltz/xstream/issues/170. + * + */ +function concat(...streams) { + const subscriptions = new Array(); + const queues = new Array(); // one queue per stream + const completedStreams = new Set(); + let activeStreamIndex = 0; + function reset() { + while (subscriptions.length > 0) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const subscription = subscriptions.shift(); + subscription.unsubscribe(); + } + queues.length = 0; + completedStreams.clear(); + activeStreamIndex = 0; + } + const producer = { + start: (listener) => { + streams.forEach((_) => queues.push([])); + function emitAllQueuesEvents(streamIndex) { + // eslint-disable-next-line no-constant-condition + while (true) { + const element = queues[streamIndex].shift(); + if (element === undefined) { + return; + } + listener.next(element); + } + } + function isDone() { + return activeStreamIndex >= streams.length; + } + if (isDone()) { + listener.complete(); + return; + } + streams.forEach((stream, index) => { + subscriptions.push(stream.subscribe({ + next: (value) => { + if (index === activeStreamIndex) { + listener.next(value); + } + else { + queues[index].push(value); + } + }, + complete: () => { + completedStreams.add(index); + while (completedStreams.has(activeStreamIndex)) { + // this stream completed: emit all and move on + emitAllQueuesEvents(activeStreamIndex); + activeStreamIndex++; + } + if (isDone()) { + listener.complete(); + } + else { + // now active stream can have some events queued but did not yet complete + emitAllQueuesEvents(activeStreamIndex); + } + }, + error: (error) => { + listener.error(error); + reset(); + }, + })); + }); + }, + stop: () => { + reset(); + }, + }; + return xstream_1.Stream.create(producer); +} +exports.concat = concat; +//# sourceMappingURL=concat.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/defaultvalueproducer.js": +/*!***********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/defaultvalueproducer.js ***! + \***********************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DefaultValueProducer = void 0; +// allows pre-producing values before anyone is listening +class DefaultValueProducer { + constructor(value, callbacks) { + this.callbacks = callbacks; + this.internalValue = value; + } + get value() { + return this.internalValue; + } + /** + * Update the current value. + * + * If producer is active (i.e. someone is listening), this emits an event. + * If not, just the current value is updated. + */ + update(value) { + this.internalValue = value; + if (this.listener) { + this.listener.next(value); + } + } + /** + * Produce an error + */ + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + error(error) { + if (this.listener) { + this.listener.error(error); + } + } + /** + * Called by the stream. Do not call this directly. + */ + start(listener) { + this.listener = listener; + listener.next(this.internalValue); + if (this.callbacks) { + this.callbacks.onStarted(); + } + } + /** + * Called by the stream. Do not call this directly. + */ + stop() { + if (this.callbacks) { + this.callbacks.onStop(); + } + this.listener = undefined; + } +} +exports.DefaultValueProducer = DefaultValueProducer; +//# sourceMappingURL=defaultvalueproducer.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/dropduplicates.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/dropduplicates.js ***! + \*****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.dropDuplicates = void 0; +/** + * Drops duplicate values in a stream. + * + * Marble diagram: + * + * ```text + * -1-1-1-2-4-3-3-4-- + * dropDuplicates + * -1-----2-4-3------ + * ``` + * + * Each value must be uniquely identified by a string given by + * valueToKey(value). + * + * Internally this maintains a set of keys that have been processed already, + * i.e. memory consumption and Set lookup times should be considered when + * using this function. + */ +function dropDuplicates(valueToKey) { + const operand = (instream) => { + const emittedKeys = new Set(); + const deduplicatedStream = instream + .filter((value) => !emittedKeys.has(valueToKey(value))) + .debug((value) => emittedKeys.add(valueToKey(value))); + return deduplicatedStream; + }; + return operand; +} +exports.dropDuplicates = dropDuplicates; +//# sourceMappingURL=dropduplicates.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/index.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/index.js ***! + \********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ValueAndUpdates = exports.toListPromise = exports.fromListPromise = exports.firstEvent = exports.dropDuplicates = exports.DefaultValueProducer = exports.concat = void 0; +var concat_1 = __webpack_require__(/*! ./concat */ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/concat.js"); +Object.defineProperty(exports, "concat", ({ enumerable: true, get: function () { return concat_1.concat; } })); +var defaultvalueproducer_1 = __webpack_require__(/*! ./defaultvalueproducer */ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/defaultvalueproducer.js"); +Object.defineProperty(exports, "DefaultValueProducer", ({ enumerable: true, get: function () { return defaultvalueproducer_1.DefaultValueProducer; } })); +var dropduplicates_1 = __webpack_require__(/*! ./dropduplicates */ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/dropduplicates.js"); +Object.defineProperty(exports, "dropDuplicates", ({ enumerable: true, get: function () { return dropduplicates_1.dropDuplicates; } })); +var promise_1 = __webpack_require__(/*! ./promise */ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/promise.js"); +Object.defineProperty(exports, "firstEvent", ({ enumerable: true, get: function () { return promise_1.firstEvent; } })); +Object.defineProperty(exports, "fromListPromise", ({ enumerable: true, get: function () { return promise_1.fromListPromise; } })); +Object.defineProperty(exports, "toListPromise", ({ enumerable: true, get: function () { return promise_1.toListPromise; } })); +__exportStar(__webpack_require__(/*! ./reducer */ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/reducer.js"), exports); +var valueandupdates_1 = __webpack_require__(/*! ./valueandupdates */ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/valueandupdates.js"); +Object.defineProperty(exports, "ValueAndUpdates", ({ enumerable: true, get: function () { return valueandupdates_1.ValueAndUpdates; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/promise.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/promise.js ***! + \**********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.firstEvent = exports.toListPromise = exports.fromListPromise = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +/** + * Emits one event for each list element as soon as the promise resolves + */ +function fromListPromise(promise) { + const producer = { + start: (listener) => { + // the code in `start` runs as soon as anyone listens to the stream + promise + .then((iterable) => { + for (const element of iterable) { + listener.next(element); + } + listener.complete(); + }) + .catch((error) => listener.error(error)); + }, + // eslint-disable-next-line @typescript-eslint/no-empty-function + stop: () => { }, + }; + return xstream_1.Stream.create(producer); +} +exports.fromListPromise = fromListPromise; +/** + * Listens to stream and collects events. When `count` events are collected, + * the promise resolves with an array of events. + * + * Rejects if stream completes before `count` events are collected. + */ +async function toListPromise(stream, count) { + return new Promise((resolve, reject) => { + if (count === 0) { + resolve([]); + return; + } + const events = new Array(); + // take() unsubscribes from source stream automatically + stream.take(count).subscribe({ + next: (event) => { + events.push(event); + if (events.length === count) { + resolve(events); + } + }, + complete: () => { + reject(`Stream completed before all events could be collected. ` + + `Collected ${events.length}, expected ${count}`); + }, + error: (error) => reject(error), + }); + }); +} +exports.toListPromise = toListPromise; +/** + * Listens to stream, collects one event and revolves. + * + * Rejects if stream completes before one event was fired. + */ +async function firstEvent(stream) { + return (await toListPromise(stream, 1))[0]; +} +exports.firstEvent = firstEvent; +//# sourceMappingURL=promise.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/reducer.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/reducer.js ***! + \**********************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.lastValue = exports.asArray = exports.countStream = exports.Reducer = void 0; +// Reducer takes a stream of events T and a ReducerFunc, that +// materializes a state of type U. +class Reducer { + constructor(stream, reducer, initState) { + this.stream = stream; + this.reducer = reducer; + this.state = initState; + this.completed = new Promise((resolve, reject) => { + const subscription = this.stream.subscribe({ + next: (evt) => { + this.state = this.reducer(this.state, evt); + }, + complete: () => { + resolve(); + // this must happen after resolve, to ensure stream.subscribe() has finished + subscription.unsubscribe(); + }, + error: (err) => { + reject(err); + // the stream already closed on error, but unsubscribe to be safe + subscription.unsubscribe(); + }, + }); + }); + } + // value returns current materialized state + value() { + return this.state; + } + // finished resolves on completed stream, rejects on stream error + async finished() { + return this.completed; + } +} +exports.Reducer = Reducer; +function increment(sum, _) { + return sum + 1; +} +// countStream returns a reducer that contains current count +// of events on the stream +function countStream(stream) { + return new Reducer(stream, increment, 0); +} +exports.countStream = countStream; +function append(list, evt) { + return [...list, evt]; +} +// asArray maintains an array containing all events that have +// occurred on the stream +function asArray(stream) { + return new Reducer(stream, append, []); +} +exports.asArray = asArray; +function last(_, event) { + return event; +} +// lastValue returns the last value read from the stream, or undefined if no values sent +function lastValue(stream) { + return new Reducer(stream, last, undefined); +} +exports.lastValue = lastValue; +//# sourceMappingURL=reducer.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/valueandupdates.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/socket/node_modules/@cosmjs/stream/build/valueandupdates.js ***! + \******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ValueAndUpdates = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +/** + * A read only wrapper around DefaultValueProducer that allows + * to synchronously get the current value using the .value property + * and listen to to updates by suscribing to the .updates stream + */ +class ValueAndUpdates { + constructor(producer) { + this.producer = producer; + this.updates = xstream_1.MemoryStream.createWithMemory(this.producer); + } + get value() { + return this.producer.value; + } + /** + * Resolves as soon as search value is found. + * + * @param search either a value or a function that must return true when found + * @returns the value of the update that caused the search match + */ + async waitFor(search) { + const searchImplementation = typeof search === "function" ? search : (value) => value === search; + return new Promise((resolve, reject) => { + const subscription = this.updates.subscribe({ + next: (newValue) => { + if (searchImplementation(newValue)) { + resolve(newValue); + // MemoryStream.subscribe() calls next with the last value. + // Make async to ensure the subscription exists + setTimeout(() => subscription.unsubscribe(), 0); + } + }, + complete: () => { + subscription.unsubscribe(); + reject("Update stream completed without expected value"); + }, + error: (error) => { + reject(error); + }, + }); + }); + } +} +exports.ValueAndUpdates = ValueAndUpdates; +//# sourceMappingURL=valueandupdates.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/accounts.js": +/*!*********************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/accounts.js ***! + \*********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.accountFromAny = void 0; +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/index.js"); +const proto_signing_1 = __webpack_require__(/*! @cosmjs/proto-signing */ "./node_modules/@cosmjs/proto-signing/build/index.js"); +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/index.js"); +const auth_1 = __webpack_require__(/*! cosmjs-types/cosmos/auth/v1beta1/auth */ "./node_modules/cosmjs-types/cosmos/auth/v1beta1/auth.js"); +const vesting_1 = __webpack_require__(/*! cosmjs-types/cosmos/vesting/v1beta1/vesting */ "./node_modules/cosmjs-types/cosmos/vesting/v1beta1/vesting.js"); +function uint64FromProto(input) { + return math_1.Uint64.fromString(input.toString()); +} +function accountFromBaseAccount(input) { + const { address, pubKey, accountNumber, sequence } = input; + const pubkey = pubKey ? (0, proto_signing_1.decodePubkey)(pubKey) : null; + return { + address: address, + pubkey: pubkey, + accountNumber: uint64FromProto(accountNumber).toNumber(), + sequence: uint64FromProto(sequence).toNumber(), + }; +} +/** + * Basic implementation of AccountParser. This is supposed to support the most relevant + * common Cosmos SDK account types. If you need support for exotic account types, + * you'll need to write your own account decoder. + */ +function accountFromAny(input) { + const { typeUrl, value } = input; + switch (typeUrl) { + // auth + case "/cosmos.auth.v1beta1.BaseAccount": + return accountFromBaseAccount(auth_1.BaseAccount.decode(value)); + case "/cosmos.auth.v1beta1.ModuleAccount": { + const baseAccount = auth_1.ModuleAccount.decode(value).baseAccount; + (0, utils_1.assert)(baseAccount); + return accountFromBaseAccount(baseAccount); + } + // vesting + case "/cosmos.vesting.v1beta1.BaseVestingAccount": { + const baseAccount = vesting_1.BaseVestingAccount.decode(value)?.baseAccount; + (0, utils_1.assert)(baseAccount); + return accountFromBaseAccount(baseAccount); + } + case "/cosmos.vesting.v1beta1.ContinuousVestingAccount": { + const baseAccount = vesting_1.ContinuousVestingAccount.decode(value)?.baseVestingAccount?.baseAccount; + (0, utils_1.assert)(baseAccount); + return accountFromBaseAccount(baseAccount); + } + case "/cosmos.vesting.v1beta1.DelayedVestingAccount": { + const baseAccount = vesting_1.DelayedVestingAccount.decode(value)?.baseVestingAccount?.baseAccount; + (0, utils_1.assert)(baseAccount); + return accountFromBaseAccount(baseAccount); + } + case "/cosmos.vesting.v1beta1.PeriodicVestingAccount": { + const baseAccount = vesting_1.PeriodicVestingAccount.decode(value)?.baseVestingAccount?.baseAccount; + (0, utils_1.assert)(baseAccount); + return accountFromBaseAccount(baseAccount); + } + default: + throw new Error(`Unsupported type: '${typeUrl}'`); + } +} +exports.accountFromAny = accountFromAny; +//# sourceMappingURL=accounts.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/aminotypes.js": +/*!***********************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/aminotypes.js ***! + \***********************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AminoTypes = void 0; +function isAminoConverter(converter) { + return typeof converter[1] !== "string"; +} +/** + * A map from Stargate message types as used in the messages's `Any` type + * to Amino types. + */ +class AminoTypes { + constructor(types) { + this.register = types; + } + toAmino({ typeUrl, value }) { + const converter = this.register[typeUrl]; + if (converter === "not_supported_by_chain") { + throw new Error(`The message type '${typeUrl}' cannot be signed using the Amino JSON sign mode because this is not supported by chain.`); + } + if (!converter) { + throw new Error(`Type URL '${typeUrl}' does not exist in the Amino message type register. ` + + "If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. " + + "If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues."); + } + return { + type: converter.aminoType, + value: converter.toAmino(value), + }; + } + fromAmino({ type, value }) { + const matches = Object.entries(this.register) + .filter(isAminoConverter) + .filter(([_typeUrl, { aminoType }]) => aminoType === type); + switch (matches.length) { + case 0: { + throw new Error(`Amino type identifier '${type}' does not exist in the Amino message type register. ` + + "If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. " + + "If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues."); + } + case 1: { + const [typeUrl, converter] = matches[0]; + return { + typeUrl: typeUrl, + value: converter.fromAmino(value), + }; + } + default: + throw new Error(`Multiple types are registered with Amino type identifier '${type}': '` + + matches + .map(([key, _value]) => key) + .sort() + .join("', '") + + "'. Thus fromAmino cannot be performed."); + } + } +} +exports.AminoTypes = AminoTypes; +//# sourceMappingURL=aminotypes.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/events.js": +/*!*******************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/events.js ***! + \*******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromTendermintEvent = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/index.js"); +/** + * Takes a Tendermint 0.34 or 0.37 event with binary encoded key and value + * and converts it into an `Event` with string attributes. + */ +function fromTendermintEvent(event) { + return { + type: event.type, + attributes: event.attributes.map((attr) => ({ + key: typeof attr.key == "string" ? attr.key : (0, encoding_1.fromUtf8)(attr.key, true), + value: typeof attr.value == "string" ? attr.value : (0, encoding_1.fromUtf8)(attr.value, true), + })), + }; +} +exports.fromTendermintEvent = fromTendermintEvent; +//# sourceMappingURL=events.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/fee.js": +/*!****************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/fee.js ***! + \****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.calculateFee = exports.GasPrice = void 0; +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/index.js"); +const proto_signing_1 = __webpack_require__(/*! @cosmjs/proto-signing */ "./node_modules/@cosmjs/proto-signing/build/index.js"); +/** + * Denom checker for the Cosmos SDK 0.42 denom pattern + * (https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/types/coin.go#L599-L601). + * + * This is like a regexp but with helpful error messages. + */ +function checkDenom(denom) { + if (denom.length < 3 || denom.length > 128) { + throw new Error("Denom must be between 3 and 128 characters"); + } +} +/** + * A gas price, i.e. the price of a single unit of gas. This is typically a fraction of + * the smallest fee token unit, such as 0.012utoken. + */ +class GasPrice { + constructor(amount, denom) { + this.amount = amount; + this.denom = denom; + } + /** + * Parses a gas price formatted as ``, e.g. `GasPrice.fromString("0.012utoken")`. + * + * The denom must match the Cosmos SDK 0.42 pattern (https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/types/coin.go#L599-L601). + * See `GasPrice` in @cosmjs/stargate for a more generic matcher. + * + * Separators are not yet supported. + */ + static fromString(gasPrice) { + // Use Decimal.fromUserInput and checkDenom for detailed checks and helpful error messages + const matchResult = gasPrice.match(/^([0-9.]+)([a-z][a-z0-9]*)$/i); + if (!matchResult) { + throw new Error("Invalid gas price string"); + } + const [_, amount, denom] = matchResult; + checkDenom(denom); + const fractionalDigits = 18; + const decimalAmount = math_1.Decimal.fromUserInput(amount, fractionalDigits); + return new GasPrice(decimalAmount, denom); + } + /** + * Returns a string representation of this gas price, e.g. "0.025uatom". + * This can be used as an input to `GasPrice.fromString`. + */ + toString() { + return this.amount.toString() + this.denom; + } +} +exports.GasPrice = GasPrice; +function calculateFee(gasLimit, gasPrice) { + const processedGasPrice = typeof gasPrice === "string" ? GasPrice.fromString(gasPrice) : gasPrice; + const { denom, amount: gasPriceAmount } = processedGasPrice; + // Note: Amount can exceed the safe integer range (https://github.com/cosmos/cosmjs/issues/1134), + // which we handle by converting from Decimal to string without going through number. + const amount = gasPriceAmount.multiply(new math_1.Uint53(gasLimit)).ceil().toString(); + return { + amount: (0, proto_signing_1.coins)(amount, denom), + gas: gasLimit.toString(), + }; +} +exports.calculateFee = calculateFee; +//# sourceMappingURL=fee.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/index.js": +/*!******************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/index.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupAuthExtension = exports.isMsgWithdrawDelegatorRewardEncodeObject = exports.isMsgVoteWeightedEncodeObject = exports.isMsgVoteEncodeObject = exports.isMsgUndelegateEncodeObject = exports.isMsgTransferEncodeObject = exports.isMsgSubmitProposalEncodeObject = exports.isMsgSendEncodeObject = exports.isMsgEditValidatorEncodeObject = exports.isMsgDepositEncodeObject = exports.isMsgDelegateEncodeObject = exports.isMsgCreateValidatorEncodeObject = exports.isMsgBeginRedelegateEncodeObject = exports.isAminoMsgWithdrawValidatorCommission = exports.isAminoMsgWithdrawDelegatorReward = exports.isAminoMsgVoteWeighted = exports.isAminoMsgVote = exports.isAminoMsgVerifyInvariant = exports.isAminoMsgUnjail = exports.isAminoMsgUndelegate = exports.isAminoMsgTransfer = exports.isAminoMsgSubmitProposal = exports.isAminoMsgSubmitEvidence = exports.isAminoMsgSetWithdrawAddress = exports.isAminoMsgSend = exports.isAminoMsgMultiSend = exports.isAminoMsgFundCommunityPool = exports.isAminoMsgEditValidator = exports.isAminoMsgDeposit = exports.isAminoMsgDelegate = exports.isAminoMsgCreateVestingAccount = exports.isAminoMsgCreateValidator = exports.isAminoMsgBeginRedelegate = exports.createVestingAminoConverters = exports.createStakingAminoConverters = exports.createSlashingAminoConverters = exports.createIbcAminoConverters = exports.createGovAminoConverters = exports.createFeegrantAminoConverters = exports.createEvidenceAminoConverters = exports.createDistributionAminoConverters = exports.createCrysisAminoConverters = exports.createBankAminoConverters = exports.createAuthzAminoConverters = exports.logs = exports.GasPrice = exports.calculateFee = exports.fromTendermintEvent = exports.AminoTypes = exports.accountFromAny = void 0; +exports.parseCoins = exports.makeCosmoshubPath = exports.coins = exports.coin = exports.TimeoutError = exports.StargateClient = exports.isDeliverTxSuccess = exports.isDeliverTxFailure = exports.BroadcastTxError = exports.assertIsDeliverTxSuccess = exports.assertIsDeliverTxFailure = exports.SigningStargateClient = exports.defaultRegistryTypes = exports.createDefaultAminoConverters = exports.isSearchByTagsQuery = exports.isSearchBySentFromOrToQuery = exports.isSearchByHeightQuery = exports.QueryClient = exports.decodeCosmosSdkDecFromProto = exports.createProtobufRpcClient = exports.createPagination = exports.makeMultisignedTxBytes = exports.makeMultisignedTx = exports.setupTxExtension = exports.setupStakingExtension = exports.setupSlashingExtension = exports.setupMintExtension = exports.setupIbcExtension = exports.setupGovExtension = exports.setupFeegrantExtension = exports.setupDistributionExtension = exports.setupBankExtension = exports.setupAuthzExtension = void 0; +var accounts_1 = __webpack_require__(/*! ./accounts */ "./node_modules/@cosmjs/stargate/build/accounts.js"); +Object.defineProperty(exports, "accountFromAny", ({ enumerable: true, get: function () { return accounts_1.accountFromAny; } })); +var aminotypes_1 = __webpack_require__(/*! ./aminotypes */ "./node_modules/@cosmjs/stargate/build/aminotypes.js"); +Object.defineProperty(exports, "AminoTypes", ({ enumerable: true, get: function () { return aminotypes_1.AminoTypes; } })); +var events_1 = __webpack_require__(/*! ./events */ "./node_modules/@cosmjs/stargate/build/events.js"); +Object.defineProperty(exports, "fromTendermintEvent", ({ enumerable: true, get: function () { return events_1.fromTendermintEvent; } })); +var fee_1 = __webpack_require__(/*! ./fee */ "./node_modules/@cosmjs/stargate/build/fee.js"); +Object.defineProperty(exports, "calculateFee", ({ enumerable: true, get: function () { return fee_1.calculateFee; } })); +Object.defineProperty(exports, "GasPrice", ({ enumerable: true, get: function () { return fee_1.GasPrice; } })); +exports.logs = __importStar(__webpack_require__(/*! ./logs */ "./node_modules/@cosmjs/stargate/build/logs.js")); +var modules_1 = __webpack_require__(/*! ./modules */ "./node_modules/@cosmjs/stargate/build/modules/index.js"); +Object.defineProperty(exports, "createAuthzAminoConverters", ({ enumerable: true, get: function () { return modules_1.createAuthzAminoConverters; } })); +Object.defineProperty(exports, "createBankAminoConverters", ({ enumerable: true, get: function () { return modules_1.createBankAminoConverters; } })); +Object.defineProperty(exports, "createCrysisAminoConverters", ({ enumerable: true, get: function () { return modules_1.createCrysisAminoConverters; } })); +Object.defineProperty(exports, "createDistributionAminoConverters", ({ enumerable: true, get: function () { return modules_1.createDistributionAminoConverters; } })); +Object.defineProperty(exports, "createEvidenceAminoConverters", ({ enumerable: true, get: function () { return modules_1.createEvidenceAminoConverters; } })); +Object.defineProperty(exports, "createFeegrantAminoConverters", ({ enumerable: true, get: function () { return modules_1.createFeegrantAminoConverters; } })); +Object.defineProperty(exports, "createGovAminoConverters", ({ enumerable: true, get: function () { return modules_1.createGovAminoConverters; } })); +Object.defineProperty(exports, "createIbcAminoConverters", ({ enumerable: true, get: function () { return modules_1.createIbcAminoConverters; } })); +Object.defineProperty(exports, "createSlashingAminoConverters", ({ enumerable: true, get: function () { return modules_1.createSlashingAminoConverters; } })); +Object.defineProperty(exports, "createStakingAminoConverters", ({ enumerable: true, get: function () { return modules_1.createStakingAminoConverters; } })); +Object.defineProperty(exports, "createVestingAminoConverters", ({ enumerable: true, get: function () { return modules_1.createVestingAminoConverters; } })); +Object.defineProperty(exports, "isAminoMsgBeginRedelegate", ({ enumerable: true, get: function () { return modules_1.isAminoMsgBeginRedelegate; } })); +Object.defineProperty(exports, "isAminoMsgCreateValidator", ({ enumerable: true, get: function () { return modules_1.isAminoMsgCreateValidator; } })); +Object.defineProperty(exports, "isAminoMsgCreateVestingAccount", ({ enumerable: true, get: function () { return modules_1.isAminoMsgCreateVestingAccount; } })); +Object.defineProperty(exports, "isAminoMsgDelegate", ({ enumerable: true, get: function () { return modules_1.isAminoMsgDelegate; } })); +Object.defineProperty(exports, "isAminoMsgDeposit", ({ enumerable: true, get: function () { return modules_1.isAminoMsgDeposit; } })); +Object.defineProperty(exports, "isAminoMsgEditValidator", ({ enumerable: true, get: function () { return modules_1.isAminoMsgEditValidator; } })); +Object.defineProperty(exports, "isAminoMsgFundCommunityPool", ({ enumerable: true, get: function () { return modules_1.isAminoMsgFundCommunityPool; } })); +Object.defineProperty(exports, "isAminoMsgMultiSend", ({ enumerable: true, get: function () { return modules_1.isAminoMsgMultiSend; } })); +Object.defineProperty(exports, "isAminoMsgSend", ({ enumerable: true, get: function () { return modules_1.isAminoMsgSend; } })); +Object.defineProperty(exports, "isAminoMsgSetWithdrawAddress", ({ enumerable: true, get: function () { return modules_1.isAminoMsgSetWithdrawAddress; } })); +Object.defineProperty(exports, "isAminoMsgSubmitEvidence", ({ enumerable: true, get: function () { return modules_1.isAminoMsgSubmitEvidence; } })); +Object.defineProperty(exports, "isAminoMsgSubmitProposal", ({ enumerable: true, get: function () { return modules_1.isAminoMsgSubmitProposal; } })); +Object.defineProperty(exports, "isAminoMsgTransfer", ({ enumerable: true, get: function () { return modules_1.isAminoMsgTransfer; } })); +Object.defineProperty(exports, "isAminoMsgUndelegate", ({ enumerable: true, get: function () { return modules_1.isAminoMsgUndelegate; } })); +Object.defineProperty(exports, "isAminoMsgUnjail", ({ enumerable: true, get: function () { return modules_1.isAminoMsgUnjail; } })); +Object.defineProperty(exports, "isAminoMsgVerifyInvariant", ({ enumerable: true, get: function () { return modules_1.isAminoMsgVerifyInvariant; } })); +Object.defineProperty(exports, "isAminoMsgVote", ({ enumerable: true, get: function () { return modules_1.isAminoMsgVote; } })); +Object.defineProperty(exports, "isAminoMsgVoteWeighted", ({ enumerable: true, get: function () { return modules_1.isAminoMsgVoteWeighted; } })); +Object.defineProperty(exports, "isAminoMsgWithdrawDelegatorReward", ({ enumerable: true, get: function () { return modules_1.isAminoMsgWithdrawDelegatorReward; } })); +Object.defineProperty(exports, "isAminoMsgWithdrawValidatorCommission", ({ enumerable: true, get: function () { return modules_1.isAminoMsgWithdrawValidatorCommission; } })); +Object.defineProperty(exports, "isMsgBeginRedelegateEncodeObject", ({ enumerable: true, get: function () { return modules_1.isMsgBeginRedelegateEncodeObject; } })); +Object.defineProperty(exports, "isMsgCreateValidatorEncodeObject", ({ enumerable: true, get: function () { return modules_1.isMsgCreateValidatorEncodeObject; } })); +Object.defineProperty(exports, "isMsgDelegateEncodeObject", ({ enumerable: true, get: function () { return modules_1.isMsgDelegateEncodeObject; } })); +Object.defineProperty(exports, "isMsgDepositEncodeObject", ({ enumerable: true, get: function () { return modules_1.isMsgDepositEncodeObject; } })); +Object.defineProperty(exports, "isMsgEditValidatorEncodeObject", ({ enumerable: true, get: function () { return modules_1.isMsgEditValidatorEncodeObject; } })); +Object.defineProperty(exports, "isMsgSendEncodeObject", ({ enumerable: true, get: function () { return modules_1.isMsgSendEncodeObject; } })); +Object.defineProperty(exports, "isMsgSubmitProposalEncodeObject", ({ enumerable: true, get: function () { return modules_1.isMsgSubmitProposalEncodeObject; } })); +Object.defineProperty(exports, "isMsgTransferEncodeObject", ({ enumerable: true, get: function () { return modules_1.isMsgTransferEncodeObject; } })); +Object.defineProperty(exports, "isMsgUndelegateEncodeObject", ({ enumerable: true, get: function () { return modules_1.isMsgUndelegateEncodeObject; } })); +Object.defineProperty(exports, "isMsgVoteEncodeObject", ({ enumerable: true, get: function () { return modules_1.isMsgVoteEncodeObject; } })); +Object.defineProperty(exports, "isMsgVoteWeightedEncodeObject", ({ enumerable: true, get: function () { return modules_1.isMsgVoteWeightedEncodeObject; } })); +Object.defineProperty(exports, "isMsgWithdrawDelegatorRewardEncodeObject", ({ enumerable: true, get: function () { return modules_1.isMsgWithdrawDelegatorRewardEncodeObject; } })); +Object.defineProperty(exports, "setupAuthExtension", ({ enumerable: true, get: function () { return modules_1.setupAuthExtension; } })); +Object.defineProperty(exports, "setupAuthzExtension", ({ enumerable: true, get: function () { return modules_1.setupAuthzExtension; } })); +Object.defineProperty(exports, "setupBankExtension", ({ enumerable: true, get: function () { return modules_1.setupBankExtension; } })); +Object.defineProperty(exports, "setupDistributionExtension", ({ enumerable: true, get: function () { return modules_1.setupDistributionExtension; } })); +Object.defineProperty(exports, "setupFeegrantExtension", ({ enumerable: true, get: function () { return modules_1.setupFeegrantExtension; } })); +Object.defineProperty(exports, "setupGovExtension", ({ enumerable: true, get: function () { return modules_1.setupGovExtension; } })); +Object.defineProperty(exports, "setupIbcExtension", ({ enumerable: true, get: function () { return modules_1.setupIbcExtension; } })); +Object.defineProperty(exports, "setupMintExtension", ({ enumerable: true, get: function () { return modules_1.setupMintExtension; } })); +Object.defineProperty(exports, "setupSlashingExtension", ({ enumerable: true, get: function () { return modules_1.setupSlashingExtension; } })); +Object.defineProperty(exports, "setupStakingExtension", ({ enumerable: true, get: function () { return modules_1.setupStakingExtension; } })); +Object.defineProperty(exports, "setupTxExtension", ({ enumerable: true, get: function () { return modules_1.setupTxExtension; } })); +var multisignature_1 = __webpack_require__(/*! ./multisignature */ "./node_modules/@cosmjs/stargate/build/multisignature.js"); +Object.defineProperty(exports, "makeMultisignedTx", ({ enumerable: true, get: function () { return multisignature_1.makeMultisignedTx; } })); +Object.defineProperty(exports, "makeMultisignedTxBytes", ({ enumerable: true, get: function () { return multisignature_1.makeMultisignedTxBytes; } })); +var queryclient_1 = __webpack_require__(/*! ./queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +Object.defineProperty(exports, "createPagination", ({ enumerable: true, get: function () { return queryclient_1.createPagination; } })); +Object.defineProperty(exports, "createProtobufRpcClient", ({ enumerable: true, get: function () { return queryclient_1.createProtobufRpcClient; } })); +Object.defineProperty(exports, "decodeCosmosSdkDecFromProto", ({ enumerable: true, get: function () { return queryclient_1.decodeCosmosSdkDecFromProto; } })); +Object.defineProperty(exports, "QueryClient", ({ enumerable: true, get: function () { return queryclient_1.QueryClient; } })); +var search_1 = __webpack_require__(/*! ./search */ "./node_modules/@cosmjs/stargate/build/search.js"); +Object.defineProperty(exports, "isSearchByHeightQuery", ({ enumerable: true, get: function () { return search_1.isSearchByHeightQuery; } })); +Object.defineProperty(exports, "isSearchBySentFromOrToQuery", ({ enumerable: true, get: function () { return search_1.isSearchBySentFromOrToQuery; } })); +Object.defineProperty(exports, "isSearchByTagsQuery", ({ enumerable: true, get: function () { return search_1.isSearchByTagsQuery; } })); +var signingstargateclient_1 = __webpack_require__(/*! ./signingstargateclient */ "./node_modules/@cosmjs/stargate/build/signingstargateclient.js"); +Object.defineProperty(exports, "createDefaultAminoConverters", ({ enumerable: true, get: function () { return signingstargateclient_1.createDefaultAminoConverters; } })); +Object.defineProperty(exports, "defaultRegistryTypes", ({ enumerable: true, get: function () { return signingstargateclient_1.defaultRegistryTypes; } })); +Object.defineProperty(exports, "SigningStargateClient", ({ enumerable: true, get: function () { return signingstargateclient_1.SigningStargateClient; } })); +var stargateclient_1 = __webpack_require__(/*! ./stargateclient */ "./node_modules/@cosmjs/stargate/build/stargateclient.js"); +Object.defineProperty(exports, "assertIsDeliverTxFailure", ({ enumerable: true, get: function () { return stargateclient_1.assertIsDeliverTxFailure; } })); +Object.defineProperty(exports, "assertIsDeliverTxSuccess", ({ enumerable: true, get: function () { return stargateclient_1.assertIsDeliverTxSuccess; } })); +Object.defineProperty(exports, "BroadcastTxError", ({ enumerable: true, get: function () { return stargateclient_1.BroadcastTxError; } })); +Object.defineProperty(exports, "isDeliverTxFailure", ({ enumerable: true, get: function () { return stargateclient_1.isDeliverTxFailure; } })); +Object.defineProperty(exports, "isDeliverTxSuccess", ({ enumerable: true, get: function () { return stargateclient_1.isDeliverTxSuccess; } })); +Object.defineProperty(exports, "StargateClient", ({ enumerable: true, get: function () { return stargateclient_1.StargateClient; } })); +Object.defineProperty(exports, "TimeoutError", ({ enumerable: true, get: function () { return stargateclient_1.TimeoutError; } })); +var proto_signing_1 = __webpack_require__(/*! @cosmjs/proto-signing */ "./node_modules/@cosmjs/proto-signing/build/index.js"); +Object.defineProperty(exports, "coin", ({ enumerable: true, get: function () { return proto_signing_1.coin; } })); +Object.defineProperty(exports, "coins", ({ enumerable: true, get: function () { return proto_signing_1.coins; } })); +Object.defineProperty(exports, "makeCosmoshubPath", ({ enumerable: true, get: function () { return proto_signing_1.makeCosmoshubPath; } })); +Object.defineProperty(exports, "parseCoins", ({ enumerable: true, get: function () { return proto_signing_1.parseCoins; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/logs.js": +/*!*****************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/logs.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.findAttribute = exports.parseRawLog = exports.parseLogs = exports.parseLog = exports.parseEvent = exports.parseAttribute = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/index.js"); +function parseAttribute(input) { + if (!(0, utils_1.isNonNullObject)(input)) + throw new Error("Attribute must be a non-null object"); + const { key, value } = input; + if (typeof key !== "string" || !key) + throw new Error("Attribute's key must be a non-empty string"); + if (typeof value !== "string" && typeof value !== "undefined") { + throw new Error("Attribute's value must be a string or unset"); + } + return { + key: key, + value: value || "", + }; +} +exports.parseAttribute = parseAttribute; +function parseEvent(input) { + if (!(0, utils_1.isNonNullObject)(input)) + throw new Error("Event must be a non-null object"); + const { type, attributes } = input; + if (typeof type !== "string" || type === "") { + throw new Error(`Event type must be a non-empty string`); + } + if (!Array.isArray(attributes)) + throw new Error("Event's attributes must be an array"); + return { + type: type, + attributes: attributes.map(parseAttribute), + }; +} +exports.parseEvent = parseEvent; +function parseLog(input) { + if (!(0, utils_1.isNonNullObject)(input)) + throw new Error("Log must be a non-null object"); + const { msg_index, log, events } = input; + if (typeof msg_index !== "number") + throw new Error("Log's msg_index must be a number"); + if (typeof log !== "string") + throw new Error("Log's log must be a string"); + if (!Array.isArray(events)) + throw new Error("Log's events must be an array"); + return { + msg_index: msg_index, + log: log, + events: events.map(parseEvent), + }; +} +exports.parseLog = parseLog; +function parseLogs(input) { + if (!Array.isArray(input)) + throw new Error("Logs must be an array"); + return input.map(parseLog); +} +exports.parseLogs = parseLogs; +function parseRawLog(input = "[]") { + const logsToParse = JSON.parse(input).map(({ events }, i) => ({ + msg_index: i, + events, + log: "", + })); + return parseLogs(logsToParse); +} +exports.parseRawLog = parseRawLog; +/** + * Searches in logs for the first event of the given event type and in that event + * for the first first attribute with the given attribute key. + * + * Throws if the attribute was not found. + */ +function findAttribute(logs, eventType, attrKey) { + const firstLogs = logs.find(() => true); + const out = firstLogs?.events + .find((event) => event.type === eventType) + ?.attributes.find((attr) => attr.key === attrKey); + if (!out) { + throw new Error(`Could not find attribute '${attrKey}' in first event of type '${eventType}' in first log.`); + } + return out; +} +exports.findAttribute = findAttribute; +//# sourceMappingURL=logs.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/auth/queries.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/auth/queries.js ***! + \*********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupAuthExtension = void 0; +const query_1 = __webpack_require__(/*! cosmjs-types/cosmos/auth/v1beta1/query */ "./node_modules/cosmjs-types/cosmos/auth/v1beta1/query.js"); +const queryclient_1 = __webpack_require__(/*! ../../queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +function setupAuthExtension(base) { + const rpc = (0, queryclient_1.createProtobufRpcClient)(base); + // Use this service to get easy typed access to query methods + // This cannot be used for proof verification + const queryService = new query_1.QueryClientImpl(rpc); + return { + auth: { + account: async (address) => { + const { account } = await queryService.Account({ address: address }); + return account ?? null; + }, + }, + }; +} +exports.setupAuthExtension = setupAuthExtension; +//# sourceMappingURL=queries.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/authz/aminomessages.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/authz/aminomessages.js ***! + \****************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createAuthzAminoConverters = void 0; +function createAuthzAminoConverters() { + return { + "/cosmos.authz.v1beta1.MsgGrant": "not_supported_by_chain", + "/cosmos.authz.v1beta1.MsgExec": "not_supported_by_chain", + "/cosmos.authz.v1beta1.MsgRevoke": "not_supported_by_chain", + }; +} +exports.createAuthzAminoConverters = createAuthzAminoConverters; +//# sourceMappingURL=aminomessages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/authz/messages.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/authz/messages.js ***! + \***********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.authzTypes = void 0; +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/authz/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/authz/v1beta1/tx.js"); +exports.authzTypes = [ + ["/cosmos.authz.v1beta1.MsgExec", tx_1.MsgExec], + ["/cosmos.authz.v1beta1.MsgGrant", tx_1.MsgGrant], + ["/cosmos.authz.v1beta1.MsgRevoke", tx_1.MsgRevoke], +]; +//# sourceMappingURL=messages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/authz/queries.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/authz/queries.js ***! + \**********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupAuthzExtension = void 0; +const query_1 = __webpack_require__(/*! cosmjs-types/cosmos/authz/v1beta1/query */ "./node_modules/cosmjs-types/cosmos/authz/v1beta1/query.js"); +const queryclient_1 = __webpack_require__(/*! ../../queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +function setupAuthzExtension(base) { + // Use this service to get easy typed access to query methods + // This cannot be used for proof verification + const rpc = (0, queryclient_1.createProtobufRpcClient)(base); + const queryService = new query_1.QueryClientImpl(rpc); + return { + authz: { + grants: async (granter, grantee, msgTypeUrl, paginationKey) => { + return await queryService.Grants({ + granter: granter, + grantee: grantee, + msgTypeUrl: msgTypeUrl, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + }, + granteeGrants: async (grantee, paginationKey) => { + return await queryService.GranteeGrants({ + grantee: grantee, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + }, + granterGrants: async (granter, paginationKey) => { + return await queryService.GranterGrants({ + granter: granter, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + }, + }, + }; +} +exports.setupAuthzExtension = setupAuthzExtension; +//# sourceMappingURL=queries.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/bank/aminomessages.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/bank/aminomessages.js ***! + \***************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createBankAminoConverters = exports.isAminoMsgMultiSend = exports.isAminoMsgSend = void 0; +function isAminoMsgSend(msg) { + return msg.type === "cosmos-sdk/MsgSend"; +} +exports.isAminoMsgSend = isAminoMsgSend; +function isAminoMsgMultiSend(msg) { + return msg.type === "cosmos-sdk/MsgMultiSend"; +} +exports.isAminoMsgMultiSend = isAminoMsgMultiSend; +function createBankAminoConverters() { + return { + "/cosmos.bank.v1beta1.MsgSend": { + aminoType: "cosmos-sdk/MsgSend", + toAmino: ({ fromAddress, toAddress, amount }) => ({ + from_address: fromAddress, + to_address: toAddress, + amount: [...amount], + }), + fromAmino: ({ from_address, to_address, amount }) => ({ + fromAddress: from_address, + toAddress: to_address, + amount: [...amount], + }), + }, + "/cosmos.bank.v1beta1.MsgMultiSend": { + aminoType: "cosmos-sdk/MsgMultiSend", + toAmino: ({ inputs, outputs }) => ({ + inputs: inputs.map((input) => ({ + address: input.address, + coins: [...input.coins], + })), + outputs: outputs.map((output) => ({ + address: output.address, + coins: [...output.coins], + })), + }), + fromAmino: ({ inputs, outputs }) => ({ + inputs: inputs.map((input) => ({ + address: input.address, + coins: [...input.coins], + })), + outputs: outputs.map((output) => ({ + address: output.address, + coins: [...output.coins], + })), + }), + }, + }; +} +exports.createBankAminoConverters = createBankAminoConverters; +//# sourceMappingURL=aminomessages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/bank/messages.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/bank/messages.js ***! + \**********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isMsgSendEncodeObject = exports.bankTypes = void 0; +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/bank/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/bank/v1beta1/tx.js"); +exports.bankTypes = [ + ["/cosmos.bank.v1beta1.MsgMultiSend", tx_1.MsgMultiSend], + ["/cosmos.bank.v1beta1.MsgSend", tx_1.MsgSend], +]; +function isMsgSendEncodeObject(encodeObject) { + return encodeObject.typeUrl === "/cosmos.bank.v1beta1.MsgSend"; +} +exports.isMsgSendEncodeObject = isMsgSendEncodeObject; +//# sourceMappingURL=messages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/bank/queries.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/bank/queries.js ***! + \*********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupBankExtension = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/index.js"); +const query_1 = __webpack_require__(/*! cosmjs-types/cosmos/bank/v1beta1/query */ "./node_modules/cosmjs-types/cosmos/bank/v1beta1/query.js"); +const queryclient_1 = __webpack_require__(/*! ../../queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +function setupBankExtension(base) { + const rpc = (0, queryclient_1.createProtobufRpcClient)(base); + // Use this service to get easy typed access to query methods + // This cannot be used for proof verification + const queryService = new query_1.QueryClientImpl(rpc); + return { + bank: { + balance: async (address, denom) => { + const { balance } = await queryService.Balance({ address: address, denom: denom }); + (0, utils_1.assert)(balance); + return balance; + }, + allBalances: async (address) => { + const { balances } = await queryService.AllBalances({ address: address }); + return balances; + }, + totalSupply: async (paginationKey) => { + const response = await queryService.TotalSupply({ + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + supplyOf: async (denom) => { + const { amount } = await queryService.SupplyOf({ denom: denom }); + (0, utils_1.assert)(amount); + return amount; + }, + denomMetadata: async (denom) => { + const { metadata } = await queryService.DenomMetadata({ denom }); + (0, utils_1.assert)(metadata); + return metadata; + }, + denomsMetadata: async () => { + const { metadatas } = await queryService.DenomsMetadata({ + pagination: undefined, // Not implemented + }); + return metadatas; + }, + }, + }; +} +exports.setupBankExtension = setupBankExtension; +//# sourceMappingURL=queries.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/crisis/aminomessages.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/crisis/aminomessages.js ***! + \*****************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createCrysisAminoConverters = exports.isAminoMsgVerifyInvariant = void 0; +function isAminoMsgVerifyInvariant(msg) { + return msg.type === "cosmos-sdk/MsgVerifyInvariant"; +} +exports.isAminoMsgVerifyInvariant = isAminoMsgVerifyInvariant; +function createCrysisAminoConverters() { + throw new Error("Not implemented"); +} +exports.createCrysisAminoConverters = createCrysisAminoConverters; +//# sourceMappingURL=aminomessages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/distribution/aminomessages.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/distribution/aminomessages.js ***! + \***********************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createDistributionAminoConverters = exports.isAminoMsgFundCommunityPool = exports.isAminoMsgWithdrawValidatorCommission = exports.isAminoMsgWithdrawDelegatorReward = exports.isAminoMsgSetWithdrawAddress = void 0; +function isAminoMsgSetWithdrawAddress(msg) { + // NOTE: Type string and names diverge here! + return msg.type === "cosmos-sdk/MsgModifyWithdrawAddress"; +} +exports.isAminoMsgSetWithdrawAddress = isAminoMsgSetWithdrawAddress; +function isAminoMsgWithdrawDelegatorReward(msg) { + // NOTE: Type string and names diverge here! + return msg.type === "cosmos-sdk/MsgWithdrawDelegationReward"; +} +exports.isAminoMsgWithdrawDelegatorReward = isAminoMsgWithdrawDelegatorReward; +function isAminoMsgWithdrawValidatorCommission(msg) { + return msg.type === "cosmos-sdk/MsgWithdrawValidatorCommission"; +} +exports.isAminoMsgWithdrawValidatorCommission = isAminoMsgWithdrawValidatorCommission; +function isAminoMsgFundCommunityPool(msg) { + return msg.type === "cosmos-sdk/MsgFundCommunityPool"; +} +exports.isAminoMsgFundCommunityPool = isAminoMsgFundCommunityPool; +function createDistributionAminoConverters() { + return { + "/cosmos.distribution.v1beta1.MsgFundCommunityPool": { + aminoType: "cosmos-sdk/MsgFundCommunityPool", + toAmino: ({ amount, depositor }) => ({ + amount: [...amount], + depositor: depositor, + }), + fromAmino: ({ amount, depositor }) => ({ + amount: [...amount], + depositor: depositor, + }), + }, + "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress": { + aminoType: "cosmos-sdk/MsgModifyWithdrawAddress", + toAmino: ({ delegatorAddress, withdrawAddress, }) => ({ + delegator_address: delegatorAddress, + withdraw_address: withdrawAddress, + }), + fromAmino: ({ delegator_address, withdraw_address, }) => ({ + delegatorAddress: delegator_address, + withdrawAddress: withdraw_address, + }), + }, + "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward": { + aminoType: "cosmos-sdk/MsgWithdrawDelegationReward", + toAmino: ({ delegatorAddress, validatorAddress, }) => ({ + delegator_address: delegatorAddress, + validator_address: validatorAddress, + }), + fromAmino: ({ delegator_address, validator_address, }) => ({ + delegatorAddress: delegator_address, + validatorAddress: validator_address, + }), + }, + "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission": { + aminoType: "cosmos-sdk/MsgWithdrawValidatorCommission", + toAmino: ({ validatorAddress, }) => ({ + validator_address: validatorAddress, + }), + fromAmino: ({ validator_address, }) => ({ + validatorAddress: validator_address, + }), + }, + }; +} +exports.createDistributionAminoConverters = createDistributionAminoConverters; +//# sourceMappingURL=aminomessages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/distribution/messages.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/distribution/messages.js ***! + \******************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isMsgWithdrawDelegatorRewardEncodeObject = exports.distributionTypes = void 0; +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/distribution/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/distribution/v1beta1/tx.js"); +exports.distributionTypes = [ + ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", tx_1.MsgFundCommunityPool], + ["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", tx_1.MsgSetWithdrawAddress], + ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", tx_1.MsgWithdrawDelegatorReward], + ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", tx_1.MsgWithdrawValidatorCommission], +]; +function isMsgWithdrawDelegatorRewardEncodeObject(object) { + return (object.typeUrl === + "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"); +} +exports.isMsgWithdrawDelegatorRewardEncodeObject = isMsgWithdrawDelegatorRewardEncodeObject; +//# sourceMappingURL=messages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/distribution/queries.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/distribution/queries.js ***! + \*****************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupDistributionExtension = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const query_1 = __webpack_require__(/*! cosmjs-types/cosmos/distribution/v1beta1/query */ "./node_modules/cosmjs-types/cosmos/distribution/v1beta1/query.js"); +const long_1 = __importDefault(__webpack_require__(/*! long */ "./node_modules/long/src/long.js")); +const queryclient_1 = __webpack_require__(/*! ../../queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +function setupDistributionExtension(base) { + const rpc = (0, queryclient_1.createProtobufRpcClient)(base); + // Use this service to get easy typed access to query methods + // This cannot be used for proof verification + const queryService = new query_1.QueryClientImpl(rpc); + return { + distribution: { + communityPool: async () => { + const response = await queryService.CommunityPool({}); + return response; + }, + delegationRewards: async (delegatorAddress, validatorAddress) => { + const response = await queryService.DelegationRewards({ + delegatorAddress: delegatorAddress, + validatorAddress: validatorAddress, + }); + return response; + }, + delegationTotalRewards: async (delegatorAddress) => { + const response = await queryService.DelegationTotalRewards({ + delegatorAddress: delegatorAddress, + }); + return response; + }, + delegatorValidators: async (delegatorAddress) => { + const response = await queryService.DelegatorValidators({ + delegatorAddress: delegatorAddress, + }); + return response; + }, + delegatorWithdrawAddress: async (delegatorAddress) => { + const response = await queryService.DelegatorWithdrawAddress({ + delegatorAddress: delegatorAddress, + }); + return response; + }, + params: async () => { + const response = await queryService.Params({}); + return response; + }, + validatorCommission: async (validatorAddress) => { + const response = await queryService.ValidatorCommission({ + validatorAddress: validatorAddress, + }); + return response; + }, + validatorOutstandingRewards: async (validatorAddress) => { + const response = await queryService.ValidatorOutstandingRewards({ + validatorAddress: validatorAddress, + }); + return response; + }, + validatorSlashes: async (validatorAddress, startingHeight, endingHeight, paginationKey) => { + const response = await queryService.ValidatorSlashes({ + validatorAddress: validatorAddress, + startingHeight: long_1.default.fromNumber(startingHeight, true), + endingHeight: long_1.default.fromNumber(endingHeight, true), + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + }, + }; +} +exports.setupDistributionExtension = setupDistributionExtension; +//# sourceMappingURL=queries.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/evidence/aminomessages.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/evidence/aminomessages.js ***! + \*******************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createEvidenceAminoConverters = exports.isAminoMsgSubmitEvidence = void 0; +function isAminoMsgSubmitEvidence(msg) { + return msg.type === "cosmos-sdk/MsgSubmitEvidence"; +} +exports.isAminoMsgSubmitEvidence = isAminoMsgSubmitEvidence; +function createEvidenceAminoConverters() { + throw new Error("Not implemented"); +} +exports.createEvidenceAminoConverters = createEvidenceAminoConverters; +//# sourceMappingURL=aminomessages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/feegrant/aminomessages.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/feegrant/aminomessages.js ***! + \*******************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createFeegrantAminoConverters = void 0; +function createFeegrantAminoConverters() { + return { + "/cosmos.feegrant.v1beta1.MsgGrantAllowance": "not_supported_by_chain", + "/cosmos.feegrant.v1beta1.MsgRevokeAllowance": "not_supported_by_chain", + }; +} +exports.createFeegrantAminoConverters = createFeegrantAminoConverters; +//# sourceMappingURL=aminomessages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/feegrant/messages.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/feegrant/messages.js ***! + \**************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.feegrantTypes = void 0; +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/feegrant/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/feegrant/v1beta1/tx.js"); +exports.feegrantTypes = [ + ["/cosmos.feegrant.v1beta1.MsgGrantAllowance", tx_1.MsgGrantAllowance], + ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", tx_1.MsgRevokeAllowance], +]; +//# sourceMappingURL=messages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/feegrant/queries.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/feegrant/queries.js ***! + \*************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupFeegrantExtension = void 0; +const query_1 = __webpack_require__(/*! cosmjs-types/cosmos/feegrant/v1beta1/query */ "./node_modules/cosmjs-types/cosmos/feegrant/v1beta1/query.js"); +const queryclient_1 = __webpack_require__(/*! ../../queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +function setupFeegrantExtension(base) { + // Use this service to get easy typed access to query methods + // This cannot be used for proof verification + const rpc = (0, queryclient_1.createProtobufRpcClient)(base); + const queryService = new query_1.QueryClientImpl(rpc); + return { + feegrant: { + allowance: async (granter, grantee) => { + const response = await queryService.Allowance({ + granter: granter, + grantee: grantee, + }); + return response; + }, + allowances: async (grantee, paginationKey) => { + const response = await queryService.Allowances({ + grantee: grantee, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + }, + }; +} +exports.setupFeegrantExtension = setupFeegrantExtension; +//# sourceMappingURL=queries.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/gov/aminomessages.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/gov/aminomessages.js ***! + \**************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createGovAminoConverters = exports.isAminoMsgDeposit = exports.isAminoMsgVoteWeighted = exports.isAminoMsgVote = exports.isAminoMsgSubmitProposal = void 0; +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/index.js"); +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/index.js"); +const gov_1 = __webpack_require__(/*! cosmjs-types/cosmos/gov/v1beta1/gov */ "./node_modules/cosmjs-types/cosmos/gov/v1beta1/gov.js"); +const any_1 = __webpack_require__(/*! cosmjs-types/google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const long_1 = __importDefault(__webpack_require__(/*! long */ "./node_modules/long/src/long.js")); +const queryclient_1 = __webpack_require__(/*! ../../queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +function isAminoMsgSubmitProposal(msg) { + return msg.type === "cosmos-sdk/MsgSubmitProposal"; +} +exports.isAminoMsgSubmitProposal = isAminoMsgSubmitProposal; +function isAminoMsgVote(msg) { + return msg.type === "cosmos-sdk/MsgVote"; +} +exports.isAminoMsgVote = isAminoMsgVote; +function isAminoMsgVoteWeighted(msg) { + return msg.type === "cosmos-sdk/MsgVoteWeighted"; +} +exports.isAminoMsgVoteWeighted = isAminoMsgVoteWeighted; +function isAminoMsgDeposit(msg) { + return msg.type === "cosmos-sdk/MsgDeposit"; +} +exports.isAminoMsgDeposit = isAminoMsgDeposit; +function createGovAminoConverters() { + return { + "/cosmos.gov.v1beta1.MsgDeposit": { + aminoType: "cosmos-sdk/MsgDeposit", + toAmino: ({ amount, depositor, proposalId }) => { + return { + amount, + depositor, + proposal_id: proposalId.toString(), + }; + }, + fromAmino: ({ amount, depositor, proposal_id }) => { + return { + amount: Array.from(amount), + depositor, + proposalId: long_1.default.fromString(proposal_id), + }; + }, + }, + "/cosmos.gov.v1beta1.MsgVote": { + aminoType: "cosmos-sdk/MsgVote", + toAmino: ({ option, proposalId, voter }) => { + return { + option: option, + proposal_id: proposalId.toString(), + voter: voter, + }; + }, + fromAmino: ({ option, proposal_id, voter }) => { + return { + option: (0, gov_1.voteOptionFromJSON)(option), + proposalId: long_1.default.fromString(proposal_id), + voter: voter, + }; + }, + }, + "/cosmos.gov.v1beta1.MsgVoteWeighted": { + aminoType: "cosmos-sdk/MsgVoteWeighted", + toAmino: ({ options, proposalId, voter }) => { + return { + options: options.map((o) => ({ + option: o.option, + // Weight is between 0 and 1, so we always have 20 characters when printing all trailing + // zeros (e.g. "0.700000000000000000" or "1.000000000000000000") + weight: (0, queryclient_1.decodeCosmosSdkDecFromProto)(o.weight).toString().padEnd(20, "0"), + })), + proposal_id: proposalId.toString(), + voter: voter, + }; + }, + fromAmino: ({ options, proposal_id, voter }) => { + return { + proposalId: long_1.default.fromString(proposal_id), + voter: voter, + options: options.map((o) => ({ + option: (0, gov_1.voteOptionFromJSON)(o.option), + weight: math_1.Decimal.fromUserInput(o.weight, 18).atomics, + })), + }; + }, + }, + "/cosmos.gov.v1beta1.MsgSubmitProposal": { + aminoType: "cosmos-sdk/MsgSubmitProposal", + toAmino: ({ initialDeposit, proposer, content, }) => { + (0, utils_1.assertDefinedAndNotNull)(content); + let proposal; + switch (content.typeUrl) { + case "/cosmos.gov.v1beta1.TextProposal": { + const textProposal = gov_1.TextProposal.decode(content.value); + proposal = { + type: "cosmos-sdk/TextProposal", + value: { + description: textProposal.description, + title: textProposal.title, + }, + }; + break; + } + default: + throw new Error(`Unsupported proposal type: '${content.typeUrl}'`); + } + return { + initial_deposit: initialDeposit, + proposer: proposer, + content: proposal, + }; + }, + fromAmino: ({ initial_deposit, proposer, content, }) => { + let any_content; + switch (content.type) { + case "cosmos-sdk/TextProposal": { + const { value } = content; + (0, utils_1.assert)((0, utils_1.isNonNullObject)(value)); + const { title, description } = value; + (0, utils_1.assert)(typeof title === "string"); + (0, utils_1.assert)(typeof description === "string"); + any_content = any_1.Any.fromPartial({ + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + value: gov_1.TextProposal.encode(gov_1.TextProposal.fromPartial({ + title: title, + description: description, + })).finish(), + }); + break; + } + default: + throw new Error(`Unsupported proposal type: '${content.type}'`); + } + return { + initialDeposit: Array.from(initial_deposit), + proposer: proposer, + content: any_content, + }; + }, + }, + }; +} +exports.createGovAminoConverters = createGovAminoConverters; +//# sourceMappingURL=aminomessages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/gov/messages.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/gov/messages.js ***! + \*********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isMsgVoteWeightedEncodeObject = exports.isMsgVoteEncodeObject = exports.isMsgSubmitProposalEncodeObject = exports.isMsgDepositEncodeObject = exports.govTypes = void 0; +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/gov/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/gov/v1beta1/tx.js"); +exports.govTypes = [ + ["/cosmos.gov.v1beta1.MsgDeposit", tx_1.MsgDeposit], + ["/cosmos.gov.v1beta1.MsgSubmitProposal", tx_1.MsgSubmitProposal], + ["/cosmos.gov.v1beta1.MsgVote", tx_1.MsgVote], + ["/cosmos.gov.v1beta1.MsgVoteWeighted", tx_1.MsgVoteWeighted], +]; +function isMsgDepositEncodeObject(object) { + return object.typeUrl === "/cosmos.gov.v1beta1.MsgDeposit"; +} +exports.isMsgDepositEncodeObject = isMsgDepositEncodeObject; +function isMsgSubmitProposalEncodeObject(object) { + return object.typeUrl === "/cosmos.gov.v1beta1.MsgSubmitProposal"; +} +exports.isMsgSubmitProposalEncodeObject = isMsgSubmitProposalEncodeObject; +function isMsgVoteEncodeObject(object) { + return object.typeUrl === "/cosmos.gov.v1beta1.MsgVote"; +} +exports.isMsgVoteEncodeObject = isMsgVoteEncodeObject; +function isMsgVoteWeightedEncodeObject(object) { + return object.typeUrl === "/cosmos.gov.v1beta1.MsgVoteWeighted"; +} +exports.isMsgVoteWeightedEncodeObject = isMsgVoteWeightedEncodeObject; +//# sourceMappingURL=messages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/gov/queries.js": +/*!********************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/gov/queries.js ***! + \********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupGovExtension = void 0; +const query_1 = __webpack_require__(/*! cosmjs-types/cosmos/gov/v1beta1/query */ "./node_modules/cosmjs-types/cosmos/gov/v1beta1/query.js"); +const queryclient_1 = __webpack_require__(/*! ../../queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +function setupGovExtension(base) { + const rpc = (0, queryclient_1.createProtobufRpcClient)(base); + // Use this service to get easy typed access to query methods + // This cannot be used for proof verification + const queryService = new query_1.QueryClientImpl(rpc); + return { + gov: { + params: async (parametersType) => { + const response = await queryService.Params({ paramsType: parametersType }); + return response; + }, + proposals: async (proposalStatus, depositorAddress, voterAddress, paginationKey) => { + const response = await queryService.Proposals({ + proposalStatus, + depositor: depositorAddress, + voter: voterAddress, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + proposal: async (proposalId) => { + const response = await queryService.Proposal({ proposalId: (0, queryclient_1.longify)(proposalId) }); + return response; + }, + deposits: async (proposalId, paginationKey) => { + const response = await queryService.Deposits({ + proposalId: (0, queryclient_1.longify)(proposalId), + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + deposit: async (proposalId, depositorAddress) => { + const response = await queryService.Deposit({ + proposalId: (0, queryclient_1.longify)(proposalId), + depositor: depositorAddress, + }); + return response; + }, + tally: async (proposalId) => { + const response = await queryService.TallyResult({ + proposalId: (0, queryclient_1.longify)(proposalId), + }); + return response; + }, + votes: async (proposalId, paginationKey) => { + const response = await queryService.Votes({ + proposalId: (0, queryclient_1.longify)(proposalId), + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + vote: async (proposalId, voterAddress) => { + const response = await queryService.Vote({ + proposalId: (0, queryclient_1.longify)(proposalId), + voter: voterAddress, + }); + return response; + }, + }, + }; +} +exports.setupGovExtension = setupGovExtension; +//# sourceMappingURL=queries.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/ibc/aminomessages.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/ibc/aminomessages.js ***! + \**************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createIbcAminoConverters = exports.isAminoMsgTransfer = void 0; +const tx_1 = __webpack_require__(/*! cosmjs-types/ibc/applications/transfer/v1/tx */ "./node_modules/cosmjs-types/ibc/applications/transfer/v1/tx.js"); +const long_1 = __importDefault(__webpack_require__(/*! long */ "./node_modules/long/src/long.js")); +function isAminoMsgTransfer(msg) { + return msg.type === "cosmos-sdk/MsgTransfer"; +} +exports.isAminoMsgTransfer = isAminoMsgTransfer; +function omitDefault(input) { + if (typeof input === "string") { + return input === "" ? undefined : input; + } + if (typeof input === "number") { + return input === 0 ? undefined : input; + } + if (long_1.default.isLong(input)) { + return input.isZero() ? undefined : input; + } + throw new Error(`Got unsupported type '${typeof input}'`); +} +function createIbcAminoConverters() { + return { + "/ibc.applications.transfer.v1.MsgTransfer": { + aminoType: "cosmos-sdk/MsgTransfer", + toAmino: ({ sourcePort, sourceChannel, token, sender, receiver, timeoutHeight, timeoutTimestamp, }) => ({ + source_port: sourcePort, + source_channel: sourceChannel, + token: token, + sender: sender, + receiver: receiver, + timeout_height: timeoutHeight + ? { + revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), + revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString(), + } + : {}, + timeout_timestamp: omitDefault(timeoutTimestamp)?.toString(), + }), + fromAmino: ({ source_port, source_channel, token, sender, receiver, timeout_height, timeout_timestamp, }) => tx_1.MsgTransfer.fromPartial({ + sourcePort: source_port, + sourceChannel: source_channel, + token: token, + sender: sender, + receiver: receiver, + timeoutHeight: timeout_height + ? { + revisionHeight: long_1.default.fromString(timeout_height.revision_height || "0", true), + revisionNumber: long_1.default.fromString(timeout_height.revision_number || "0", true), + } + : undefined, + timeoutTimestamp: long_1.default.fromString(timeout_timestamp || "0", true), + }), + }, + }; +} +exports.createIbcAminoConverters = createIbcAminoConverters; +//# sourceMappingURL=aminomessages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/ibc/messages.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/ibc/messages.js ***! + \*********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isMsgTransferEncodeObject = exports.ibcTypes = void 0; +const tx_1 = __webpack_require__(/*! cosmjs-types/ibc/applications/transfer/v1/tx */ "./node_modules/cosmjs-types/ibc/applications/transfer/v1/tx.js"); +const tx_2 = __webpack_require__(/*! cosmjs-types/ibc/core/channel/v1/tx */ "./node_modules/cosmjs-types/ibc/core/channel/v1/tx.js"); +const tx_3 = __webpack_require__(/*! cosmjs-types/ibc/core/client/v1/tx */ "./node_modules/cosmjs-types/ibc/core/client/v1/tx.js"); +const tx_4 = __webpack_require__(/*! cosmjs-types/ibc/core/connection/v1/tx */ "./node_modules/cosmjs-types/ibc/core/connection/v1/tx.js"); +exports.ibcTypes = [ + ["/ibc.applications.transfer.v1.MsgTransfer", tx_1.MsgTransfer], + ["/ibc.core.channel.v1.MsgAcknowledgement", tx_2.MsgAcknowledgement], + ["/ibc.core.channel.v1.MsgChannelCloseConfirm", tx_2.MsgChannelCloseConfirm], + ["/ibc.core.channel.v1.MsgChannelCloseInit", tx_2.MsgChannelCloseInit], + ["/ibc.core.channel.v1.MsgChannelOpenAck", tx_2.MsgChannelOpenAck], + ["/ibc.core.channel.v1.MsgChannelOpenConfirm", tx_2.MsgChannelOpenConfirm], + ["/ibc.core.channel.v1.MsgChannelOpenInit", tx_2.MsgChannelOpenInit], + ["/ibc.core.channel.v1.MsgChannelOpenTry", tx_2.MsgChannelOpenTry], + ["/ibc.core.channel.v1.MsgRecvPacket", tx_2.MsgRecvPacket], + ["/ibc.core.channel.v1.MsgTimeout", tx_2.MsgTimeout], + ["/ibc.core.channel.v1.MsgTimeoutOnClose", tx_2.MsgTimeoutOnClose], + ["/ibc.core.client.v1.MsgCreateClient", tx_3.MsgCreateClient], + ["/ibc.core.client.v1.MsgSubmitMisbehaviour", tx_3.MsgSubmitMisbehaviour], + ["/ibc.core.client.v1.MsgUpdateClient", tx_3.MsgUpdateClient], + ["/ibc.core.client.v1.MsgUpgradeClient", tx_3.MsgUpgradeClient], + ["/ibc.core.connection.v1.MsgConnectionOpenAck", tx_4.MsgConnectionOpenAck], + ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", tx_4.MsgConnectionOpenConfirm], + ["/ibc.core.connection.v1.MsgConnectionOpenInit", tx_4.MsgConnectionOpenInit], + ["/ibc.core.connection.v1.MsgConnectionOpenTry", tx_4.MsgConnectionOpenTry], +]; +function isMsgTransferEncodeObject(object) { + return object.typeUrl === "/ibc.applications.transfer.v1.MsgTransfer"; +} +exports.isMsgTransferEncodeObject = isMsgTransferEncodeObject; +//# sourceMappingURL=messages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/ibc/queries.js": +/*!********************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/ibc/queries.js ***! + \********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupIbcExtension = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/index.js"); +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/index.js"); +const query_1 = __webpack_require__(/*! cosmjs-types/ibc/applications/transfer/v1/query */ "./node_modules/cosmjs-types/ibc/applications/transfer/v1/query.js"); +const channel_1 = __webpack_require__(/*! cosmjs-types/ibc/core/channel/v1/channel */ "./node_modules/cosmjs-types/ibc/core/channel/v1/channel.js"); +const query_2 = __webpack_require__(/*! cosmjs-types/ibc/core/channel/v1/query */ "./node_modules/cosmjs-types/ibc/core/channel/v1/query.js"); +const query_3 = __webpack_require__(/*! cosmjs-types/ibc/core/client/v1/query */ "./node_modules/cosmjs-types/ibc/core/client/v1/query.js"); +const query_4 = __webpack_require__(/*! cosmjs-types/ibc/core/connection/v1/query */ "./node_modules/cosmjs-types/ibc/core/connection/v1/query.js"); +const tendermint_1 = __webpack_require__(/*! cosmjs-types/ibc/lightclients/tendermint/v1/tendermint */ "./node_modules/cosmjs-types/ibc/lightclients/tendermint/v1/tendermint.js"); +const long_1 = __importDefault(__webpack_require__(/*! long */ "./node_modules/long/src/long.js")); +const queryclient_1 = __webpack_require__(/*! ../../queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +function decodeTendermintClientStateAny(clientState) { + if (clientState?.typeUrl !== "/ibc.lightclients.tendermint.v1.ClientState") { + throw new Error(`Unexpected client state type: ${clientState?.typeUrl}`); + } + return tendermint_1.ClientState.decode(clientState.value); +} +function decodeTendermintConsensusStateAny(clientState) { + if (clientState?.typeUrl !== "/ibc.lightclients.tendermint.v1.ConsensusState") { + throw new Error(`Unexpected client state type: ${clientState?.typeUrl}`); + } + return tendermint_1.ConsensusState.decode(clientState.value); +} +function setupIbcExtension(base) { + const rpc = (0, queryclient_1.createProtobufRpcClient)(base); + // Use these services to get easy typed access to query methods + // These cannot be used for proof verification + const channelQueryService = new query_2.QueryClientImpl(rpc); + const clientQueryService = new query_3.QueryClientImpl(rpc); + const connectionQueryService = new query_4.QueryClientImpl(rpc); + const transferQueryService = new query_1.QueryClientImpl(rpc); + return { + ibc: { + channel: { + channel: async (portId, channelId) => channelQueryService.Channel({ + portId: portId, + channelId: channelId, + }), + channels: async (paginationKey) => channelQueryService.Channels({ + pagination: (0, queryclient_1.createPagination)(paginationKey), + }), + allChannels: async () => { + const channels = []; + let response; + let key; + do { + response = await channelQueryService.Channels({ + pagination: (0, queryclient_1.createPagination)(key), + }); + channels.push(...response.channels); + key = response.pagination?.nextKey; + } while (key && key.length); + return { + channels: channels, + height: response.height, + }; + }, + connectionChannels: async (connection, paginationKey) => channelQueryService.ConnectionChannels({ + connection: connection, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }), + allConnectionChannels: async (connection) => { + const channels = []; + let response; + let key; + do { + response = await channelQueryService.ConnectionChannels({ + connection: connection, + pagination: (0, queryclient_1.createPagination)(key), + }); + channels.push(...response.channels); + key = response.pagination?.nextKey; + } while (key && key.length); + return { + channels: channels, + height: response.height, + }; + }, + clientState: async (portId, channelId) => channelQueryService.ChannelClientState({ + portId: portId, + channelId: channelId, + }), + consensusState: async (portId, channelId, revisionNumber, revisionHeight) => channelQueryService.ChannelConsensusState({ + portId: portId, + channelId: channelId, + revisionNumber: long_1.default.fromNumber(revisionNumber, true), + revisionHeight: long_1.default.fromNumber(revisionHeight, true), + }), + packetCommitment: async (portId, channelId, sequence) => channelQueryService.PacketCommitment({ + portId: portId, + channelId: channelId, + sequence: long_1.default.fromNumber(sequence, true), + }), + packetCommitments: async (portId, channelId, paginationKey) => channelQueryService.PacketCommitments({ + channelId: channelId, + portId: portId, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }), + allPacketCommitments: async (portId, channelId) => { + const commitments = []; + let response; + let key; + do { + response = await channelQueryService.PacketCommitments({ + channelId: channelId, + portId: portId, + pagination: (0, queryclient_1.createPagination)(key), + }); + commitments.push(...response.commitments); + key = response.pagination?.nextKey; + } while (key && key.length); + return { + commitments: commitments, + height: response.height, + }; + }, + packetReceipt: async (portId, channelId, sequence) => channelQueryService.PacketReceipt({ + portId: portId, + channelId: channelId, + sequence: long_1.default.fromNumber(sequence, true), + }), + packetAcknowledgement: async (portId, channelId, sequence) => channelQueryService.PacketAcknowledgement({ + portId: portId, + channelId: channelId, + sequence: long_1.default.fromNumber(sequence, true), + }), + packetAcknowledgements: async (portId, channelId, paginationKey) => { + const request = query_2.QueryPacketAcknowledgementsRequest.fromPartial({ + portId: portId, + channelId: channelId, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return channelQueryService.PacketAcknowledgements(request); + }, + allPacketAcknowledgements: async (portId, channelId) => { + const acknowledgements = []; + let response; + let key; + do { + const request = query_2.QueryPacketAcknowledgementsRequest.fromPartial({ + channelId: channelId, + portId: portId, + pagination: (0, queryclient_1.createPagination)(key), + }); + response = await channelQueryService.PacketAcknowledgements(request); + acknowledgements.push(...response.acknowledgements); + key = response.pagination?.nextKey; + } while (key && key.length); + return { + acknowledgements: acknowledgements, + height: response.height, + }; + }, + unreceivedPackets: async (portId, channelId, packetCommitmentSequences) => channelQueryService.UnreceivedPackets({ + portId: portId, + channelId: channelId, + packetCommitmentSequences: packetCommitmentSequences.map((s) => long_1.default.fromNumber(s, true)), + }), + unreceivedAcks: async (portId, channelId, packetAckSequences) => channelQueryService.UnreceivedAcks({ + portId: portId, + channelId: channelId, + packetAckSequences: packetAckSequences.map((s) => long_1.default.fromNumber(s, true)), + }), + nextSequenceReceive: async (portId, channelId) => channelQueryService.NextSequenceReceive({ + portId: portId, + channelId: channelId, + }), + }, + client: { + state: async (clientId) => clientQueryService.ClientState({ clientId }), + states: async (paginationKey) => clientQueryService.ClientStates({ + pagination: (0, queryclient_1.createPagination)(paginationKey), + }), + allStates: async () => { + const clientStates = []; + let response; + let key; + do { + response = await clientQueryService.ClientStates({ + pagination: (0, queryclient_1.createPagination)(key), + }); + clientStates.push(...response.clientStates); + key = response.pagination?.nextKey; + } while (key && key.length); + return { + clientStates: clientStates, + }; + }, + consensusState: async (clientId, consensusHeight) => clientQueryService.ConsensusState(query_3.QueryConsensusStateRequest.fromPartial({ + clientId: clientId, + revisionHeight: consensusHeight !== undefined ? long_1.default.fromNumber(consensusHeight, true) : undefined, + latestHeight: consensusHeight === undefined, + })), + consensusStates: async (clientId, paginationKey) => clientQueryService.ConsensusStates({ + clientId: clientId, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }), + allConsensusStates: async (clientId) => { + const consensusStates = []; + let response; + let key; + do { + response = await clientQueryService.ConsensusStates({ + clientId: clientId, + pagination: (0, queryclient_1.createPagination)(key), + }); + consensusStates.push(...response.consensusStates); + key = response.pagination?.nextKey; + } while (key && key.length); + return { + consensusStates: consensusStates, + }; + }, + params: async () => clientQueryService.ClientParams({}), + stateTm: async (clientId) => { + const response = await clientQueryService.ClientState({ clientId }); + return decodeTendermintClientStateAny(response.clientState); + }, + statesTm: async (paginationKey) => { + const { clientStates } = await clientQueryService.ClientStates({ + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return clientStates.map(({ clientState }) => decodeTendermintClientStateAny(clientState)); + }, + allStatesTm: async () => { + const clientStates = []; + let response; + let key; + do { + response = await clientQueryService.ClientStates({ + pagination: (0, queryclient_1.createPagination)(key), + }); + clientStates.push(...response.clientStates); + key = response.pagination?.nextKey; + } while (key && key.length); + return clientStates.map(({ clientState }) => decodeTendermintClientStateAny(clientState)); + }, + consensusStateTm: async (clientId, consensusHeight) => { + const response = await clientQueryService.ConsensusState(query_3.QueryConsensusStateRequest.fromPartial({ + clientId: clientId, + revisionHeight: consensusHeight?.revisionHeight, + revisionNumber: consensusHeight?.revisionNumber, + latestHeight: consensusHeight === undefined, + })); + return decodeTendermintConsensusStateAny(response.consensusState); + }, + }, + connection: { + connection: async (connectionId) => connectionQueryService.Connection({ + connectionId: connectionId, + }), + connections: async (paginationKey) => connectionQueryService.Connections({ + pagination: (0, queryclient_1.createPagination)(paginationKey), + }), + allConnections: async () => { + const connections = []; + let response; + let key; + do { + response = await connectionQueryService.Connections({ + pagination: (0, queryclient_1.createPagination)(key), + }); + connections.push(...response.connections); + key = response.pagination?.nextKey; + } while (key && key.length); + return { + connections: connections, + height: response.height, + }; + }, + clientConnections: async (clientId) => connectionQueryService.ClientConnections({ + clientId: clientId, + }), + clientState: async (connectionId) => connectionQueryService.ConnectionClientState({ + connectionId: connectionId, + }), + consensusState: async (connectionId, revisionHeight) => connectionQueryService.ConnectionConsensusState(query_4.QueryConnectionConsensusStateRequest.fromPartial({ + connectionId: connectionId, + revisionHeight: long_1.default.fromNumber(revisionHeight, true), + })), + }, + transfer: { + denomTrace: async (hash) => transferQueryService.DenomTrace({ hash: hash }), + denomTraces: async (paginationKey) => transferQueryService.DenomTraces({ + pagination: (0, queryclient_1.createPagination)(paginationKey), + }), + allDenomTraces: async () => { + const denomTraces = []; + let response; + let key; + do { + response = await transferQueryService.DenomTraces({ + pagination: (0, queryclient_1.createPagination)(key), + }); + denomTraces.push(...response.denomTraces); + key = response.pagination?.nextKey; + } while (key && key.length); + return { + denomTraces: denomTraces, + }; + }, + params: async () => transferQueryService.Params({}), + }, + verified: { + channel: { + channel: async (portId, channelId) => { + // keeper: https://github.com/cosmos/cosmos-sdk/blob/3bafd8255a502e5a9cee07391cf8261538245dfd/x/ibc/04-channel/keeper/keeper.go#L55-L65 + // key: https://github.com/cosmos/cosmos-sdk/blob/ef0a7344af345882729598bc2958a21143930a6b/x/ibc/24-host/keys.go#L117-L120 + const key = (0, encoding_1.toAscii)(`channelEnds/ports/${portId}/channels/${channelId}`); + const { value } = await base.queryStoreVerified("ibc", key); + return value.length ? channel_1.Channel.decode(value) : null; + }, + packetCommitment: async (portId, channelId, sequence) => { + // keeper: https://github.com/cosmos/cosmos-sdk/blob/3bafd8255a502e5a9cee07391cf8261538245dfd/x/ibc/04-channel/keeper/keeper.go#L128-L133 + // key: https://github.com/cosmos/cosmos-sdk/blob/ef0a7344af345882729598bc2958a21143930a6b/x/ibc/24-host/keys.go#L183-L185 + const key = (0, encoding_1.toAscii)(`commitments/ports/${portId}/channels/${channelId}/packets/${sequence}`); + const { value } = await base.queryStoreVerified("ibc", key); + // keeper code doesn't parse, but returns raw + return value; + }, + packetAcknowledgement: async (portId, channelId, sequence) => { + // keeper: https://github.com/cosmos/cosmos-sdk/blob/3bafd8255a502e5a9cee07391cf8261538245dfd/x/ibc/04-channel/keeper/keeper.go#L159-L166 + // key: https://github.com/cosmos/cosmos-sdk/blob/ef0a7344af345882729598bc2958a21143930a6b/x/ibc/24-host/keys.go#L153-L156 + const key = (0, encoding_1.toAscii)(`acks/ports/${portId}/channels/${channelId}/acknowledgements/${sequence}`); + const { value } = await base.queryStoreVerified("ibc", key); + // keeper code doesn't parse, but returns raw + return value; + }, + nextSequenceReceive: async (portId, channelId) => { + // keeper: https://github.com/cosmos/cosmos-sdk/blob/3bafd8255a502e5a9cee07391cf8261538245dfd/x/ibc/04-channel/keeper/keeper.go#L92-L101 + // key: https://github.com/cosmos/cosmos-sdk/blob/ef0a7344af345882729598bc2958a21143930a6b/x/ibc/24-host/keys.go#L133-L136 + const key = (0, encoding_1.toAscii)(`seqAcks/ports/${portId}/channels/${channelId}/nextSequenceAck`); + const { value } = await base.queryStoreVerified("ibc", key); + return value.length ? math_1.Uint64.fromBytes(value).toNumber() : null; + }, + }, + }, + }, + }; +} +exports.setupIbcExtension = setupIbcExtension; +//# sourceMappingURL=queries.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/index.js ***! + \**************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isAminoMsgEditValidator = exports.isAminoMsgDelegate = exports.isAminoMsgCreateValidator = exports.isAminoMsgBeginRedelegate = exports.createStakingAminoConverters = exports.setupSlashingExtension = exports.isAminoMsgUnjail = exports.createSlashingAminoConverters = exports.setupMintExtension = exports.setupIbcExtension = exports.isMsgTransferEncodeObject = exports.ibcTypes = exports.isAminoMsgTransfer = exports.createIbcAminoConverters = exports.setupGovExtension = exports.isMsgVoteWeightedEncodeObject = exports.isMsgVoteEncodeObject = exports.isMsgSubmitProposalEncodeObject = exports.isMsgDepositEncodeObject = exports.govTypes = exports.isAminoMsgVoteWeighted = exports.isAminoMsgVote = exports.isAminoMsgSubmitProposal = exports.isAminoMsgDeposit = exports.createGovAminoConverters = exports.setupFeegrantExtension = exports.feegrantTypes = exports.createFeegrantAminoConverters = exports.isAminoMsgSubmitEvidence = exports.createEvidenceAminoConverters = exports.setupDistributionExtension = exports.isMsgWithdrawDelegatorRewardEncodeObject = exports.distributionTypes = exports.isAminoMsgWithdrawValidatorCommission = exports.isAminoMsgWithdrawDelegatorReward = exports.isAminoMsgSetWithdrawAddress = exports.isAminoMsgFundCommunityPool = exports.createDistributionAminoConverters = exports.isAminoMsgVerifyInvariant = exports.createCrysisAminoConverters = exports.setupBankExtension = exports.isMsgSendEncodeObject = exports.bankTypes = exports.isAminoMsgSend = exports.isAminoMsgMultiSend = exports.createBankAminoConverters = exports.setupAuthzExtension = exports.authzTypes = exports.createAuthzAminoConverters = exports.setupAuthExtension = void 0; +exports.vestingTypes = exports.isAminoMsgCreateVestingAccount = exports.createVestingAminoConverters = exports.setupTxExtension = exports.setupStakingExtension = exports.stakingTypes = exports.isMsgUndelegateEncodeObject = exports.isMsgEditValidatorEncodeObject = exports.isMsgDelegateEncodeObject = exports.isMsgCreateValidatorEncodeObject = exports.isMsgBeginRedelegateEncodeObject = exports.isAminoMsgUndelegate = void 0; +var queries_1 = __webpack_require__(/*! ./auth/queries */ "./node_modules/@cosmjs/stargate/build/modules/auth/queries.js"); +Object.defineProperty(exports, "setupAuthExtension", ({ enumerable: true, get: function () { return queries_1.setupAuthExtension; } })); +var aminomessages_1 = __webpack_require__(/*! ./authz/aminomessages */ "./node_modules/@cosmjs/stargate/build/modules/authz/aminomessages.js"); +Object.defineProperty(exports, "createAuthzAminoConverters", ({ enumerable: true, get: function () { return aminomessages_1.createAuthzAminoConverters; } })); +var messages_1 = __webpack_require__(/*! ./authz/messages */ "./node_modules/@cosmjs/stargate/build/modules/authz/messages.js"); +Object.defineProperty(exports, "authzTypes", ({ enumerable: true, get: function () { return messages_1.authzTypes; } })); +var queries_2 = __webpack_require__(/*! ./authz/queries */ "./node_modules/@cosmjs/stargate/build/modules/authz/queries.js"); +Object.defineProperty(exports, "setupAuthzExtension", ({ enumerable: true, get: function () { return queries_2.setupAuthzExtension; } })); +var aminomessages_2 = __webpack_require__(/*! ./bank/aminomessages */ "./node_modules/@cosmjs/stargate/build/modules/bank/aminomessages.js"); +Object.defineProperty(exports, "createBankAminoConverters", ({ enumerable: true, get: function () { return aminomessages_2.createBankAminoConverters; } })); +Object.defineProperty(exports, "isAminoMsgMultiSend", ({ enumerable: true, get: function () { return aminomessages_2.isAminoMsgMultiSend; } })); +Object.defineProperty(exports, "isAminoMsgSend", ({ enumerable: true, get: function () { return aminomessages_2.isAminoMsgSend; } })); +var messages_2 = __webpack_require__(/*! ./bank/messages */ "./node_modules/@cosmjs/stargate/build/modules/bank/messages.js"); +Object.defineProperty(exports, "bankTypes", ({ enumerable: true, get: function () { return messages_2.bankTypes; } })); +Object.defineProperty(exports, "isMsgSendEncodeObject", ({ enumerable: true, get: function () { return messages_2.isMsgSendEncodeObject; } })); +var queries_3 = __webpack_require__(/*! ./bank/queries */ "./node_modules/@cosmjs/stargate/build/modules/bank/queries.js"); +Object.defineProperty(exports, "setupBankExtension", ({ enumerable: true, get: function () { return queries_3.setupBankExtension; } })); +var aminomessages_3 = __webpack_require__(/*! ./crisis/aminomessages */ "./node_modules/@cosmjs/stargate/build/modules/crisis/aminomessages.js"); +Object.defineProperty(exports, "createCrysisAminoConverters", ({ enumerable: true, get: function () { return aminomessages_3.createCrysisAminoConverters; } })); +Object.defineProperty(exports, "isAminoMsgVerifyInvariant", ({ enumerable: true, get: function () { return aminomessages_3.isAminoMsgVerifyInvariant; } })); +var aminomessages_4 = __webpack_require__(/*! ./distribution/aminomessages */ "./node_modules/@cosmjs/stargate/build/modules/distribution/aminomessages.js"); +Object.defineProperty(exports, "createDistributionAminoConverters", ({ enumerable: true, get: function () { return aminomessages_4.createDistributionAminoConverters; } })); +Object.defineProperty(exports, "isAminoMsgFundCommunityPool", ({ enumerable: true, get: function () { return aminomessages_4.isAminoMsgFundCommunityPool; } })); +Object.defineProperty(exports, "isAminoMsgSetWithdrawAddress", ({ enumerable: true, get: function () { return aminomessages_4.isAminoMsgSetWithdrawAddress; } })); +Object.defineProperty(exports, "isAminoMsgWithdrawDelegatorReward", ({ enumerable: true, get: function () { return aminomessages_4.isAminoMsgWithdrawDelegatorReward; } })); +Object.defineProperty(exports, "isAminoMsgWithdrawValidatorCommission", ({ enumerable: true, get: function () { return aminomessages_4.isAminoMsgWithdrawValidatorCommission; } })); +var messages_3 = __webpack_require__(/*! ./distribution/messages */ "./node_modules/@cosmjs/stargate/build/modules/distribution/messages.js"); +Object.defineProperty(exports, "distributionTypes", ({ enumerable: true, get: function () { return messages_3.distributionTypes; } })); +Object.defineProperty(exports, "isMsgWithdrawDelegatorRewardEncodeObject", ({ enumerable: true, get: function () { return messages_3.isMsgWithdrawDelegatorRewardEncodeObject; } })); +var queries_4 = __webpack_require__(/*! ./distribution/queries */ "./node_modules/@cosmjs/stargate/build/modules/distribution/queries.js"); +Object.defineProperty(exports, "setupDistributionExtension", ({ enumerable: true, get: function () { return queries_4.setupDistributionExtension; } })); +var aminomessages_5 = __webpack_require__(/*! ./evidence/aminomessages */ "./node_modules/@cosmjs/stargate/build/modules/evidence/aminomessages.js"); +Object.defineProperty(exports, "createEvidenceAminoConverters", ({ enumerable: true, get: function () { return aminomessages_5.createEvidenceAminoConverters; } })); +Object.defineProperty(exports, "isAminoMsgSubmitEvidence", ({ enumerable: true, get: function () { return aminomessages_5.isAminoMsgSubmitEvidence; } })); +var aminomessages_6 = __webpack_require__(/*! ./feegrant/aminomessages */ "./node_modules/@cosmjs/stargate/build/modules/feegrant/aminomessages.js"); +Object.defineProperty(exports, "createFeegrantAminoConverters", ({ enumerable: true, get: function () { return aminomessages_6.createFeegrantAminoConverters; } })); +var messages_4 = __webpack_require__(/*! ./feegrant/messages */ "./node_modules/@cosmjs/stargate/build/modules/feegrant/messages.js"); +Object.defineProperty(exports, "feegrantTypes", ({ enumerable: true, get: function () { return messages_4.feegrantTypes; } })); +var queries_5 = __webpack_require__(/*! ./feegrant/queries */ "./node_modules/@cosmjs/stargate/build/modules/feegrant/queries.js"); +Object.defineProperty(exports, "setupFeegrantExtension", ({ enumerable: true, get: function () { return queries_5.setupFeegrantExtension; } })); +var aminomessages_7 = __webpack_require__(/*! ./gov/aminomessages */ "./node_modules/@cosmjs/stargate/build/modules/gov/aminomessages.js"); +Object.defineProperty(exports, "createGovAminoConverters", ({ enumerable: true, get: function () { return aminomessages_7.createGovAminoConverters; } })); +Object.defineProperty(exports, "isAminoMsgDeposit", ({ enumerable: true, get: function () { return aminomessages_7.isAminoMsgDeposit; } })); +Object.defineProperty(exports, "isAminoMsgSubmitProposal", ({ enumerable: true, get: function () { return aminomessages_7.isAminoMsgSubmitProposal; } })); +Object.defineProperty(exports, "isAminoMsgVote", ({ enumerable: true, get: function () { return aminomessages_7.isAminoMsgVote; } })); +Object.defineProperty(exports, "isAminoMsgVoteWeighted", ({ enumerable: true, get: function () { return aminomessages_7.isAminoMsgVoteWeighted; } })); +var messages_5 = __webpack_require__(/*! ./gov/messages */ "./node_modules/@cosmjs/stargate/build/modules/gov/messages.js"); +Object.defineProperty(exports, "govTypes", ({ enumerable: true, get: function () { return messages_5.govTypes; } })); +Object.defineProperty(exports, "isMsgDepositEncodeObject", ({ enumerable: true, get: function () { return messages_5.isMsgDepositEncodeObject; } })); +Object.defineProperty(exports, "isMsgSubmitProposalEncodeObject", ({ enumerable: true, get: function () { return messages_5.isMsgSubmitProposalEncodeObject; } })); +Object.defineProperty(exports, "isMsgVoteEncodeObject", ({ enumerable: true, get: function () { return messages_5.isMsgVoteEncodeObject; } })); +Object.defineProperty(exports, "isMsgVoteWeightedEncodeObject", ({ enumerable: true, get: function () { return messages_5.isMsgVoteWeightedEncodeObject; } })); +var queries_6 = __webpack_require__(/*! ./gov/queries */ "./node_modules/@cosmjs/stargate/build/modules/gov/queries.js"); +Object.defineProperty(exports, "setupGovExtension", ({ enumerable: true, get: function () { return queries_6.setupGovExtension; } })); +var aminomessages_8 = __webpack_require__(/*! ./ibc/aminomessages */ "./node_modules/@cosmjs/stargate/build/modules/ibc/aminomessages.js"); +Object.defineProperty(exports, "createIbcAminoConverters", ({ enumerable: true, get: function () { return aminomessages_8.createIbcAminoConverters; } })); +Object.defineProperty(exports, "isAminoMsgTransfer", ({ enumerable: true, get: function () { return aminomessages_8.isAminoMsgTransfer; } })); +var messages_6 = __webpack_require__(/*! ./ibc/messages */ "./node_modules/@cosmjs/stargate/build/modules/ibc/messages.js"); +Object.defineProperty(exports, "ibcTypes", ({ enumerable: true, get: function () { return messages_6.ibcTypes; } })); +Object.defineProperty(exports, "isMsgTransferEncodeObject", ({ enumerable: true, get: function () { return messages_6.isMsgTransferEncodeObject; } })); +var queries_7 = __webpack_require__(/*! ./ibc/queries */ "./node_modules/@cosmjs/stargate/build/modules/ibc/queries.js"); +Object.defineProperty(exports, "setupIbcExtension", ({ enumerable: true, get: function () { return queries_7.setupIbcExtension; } })); +var queries_8 = __webpack_require__(/*! ./mint/queries */ "./node_modules/@cosmjs/stargate/build/modules/mint/queries.js"); +Object.defineProperty(exports, "setupMintExtension", ({ enumerable: true, get: function () { return queries_8.setupMintExtension; } })); +var aminomessages_9 = __webpack_require__(/*! ./slashing/aminomessages */ "./node_modules/@cosmjs/stargate/build/modules/slashing/aminomessages.js"); +Object.defineProperty(exports, "createSlashingAminoConverters", ({ enumerable: true, get: function () { return aminomessages_9.createSlashingAminoConverters; } })); +Object.defineProperty(exports, "isAminoMsgUnjail", ({ enumerable: true, get: function () { return aminomessages_9.isAminoMsgUnjail; } })); +var queries_9 = __webpack_require__(/*! ./slashing/queries */ "./node_modules/@cosmjs/stargate/build/modules/slashing/queries.js"); +Object.defineProperty(exports, "setupSlashingExtension", ({ enumerable: true, get: function () { return queries_9.setupSlashingExtension; } })); +var aminomessages_10 = __webpack_require__(/*! ./staking/aminomessages */ "./node_modules/@cosmjs/stargate/build/modules/staking/aminomessages.js"); +Object.defineProperty(exports, "createStakingAminoConverters", ({ enumerable: true, get: function () { return aminomessages_10.createStakingAminoConverters; } })); +Object.defineProperty(exports, "isAminoMsgBeginRedelegate", ({ enumerable: true, get: function () { return aminomessages_10.isAminoMsgBeginRedelegate; } })); +Object.defineProperty(exports, "isAminoMsgCreateValidator", ({ enumerable: true, get: function () { return aminomessages_10.isAminoMsgCreateValidator; } })); +Object.defineProperty(exports, "isAminoMsgDelegate", ({ enumerable: true, get: function () { return aminomessages_10.isAminoMsgDelegate; } })); +Object.defineProperty(exports, "isAminoMsgEditValidator", ({ enumerable: true, get: function () { return aminomessages_10.isAminoMsgEditValidator; } })); +Object.defineProperty(exports, "isAminoMsgUndelegate", ({ enumerable: true, get: function () { return aminomessages_10.isAminoMsgUndelegate; } })); +var messages_7 = __webpack_require__(/*! ./staking/messages */ "./node_modules/@cosmjs/stargate/build/modules/staking/messages.js"); +Object.defineProperty(exports, "isMsgBeginRedelegateEncodeObject", ({ enumerable: true, get: function () { return messages_7.isMsgBeginRedelegateEncodeObject; } })); +Object.defineProperty(exports, "isMsgCreateValidatorEncodeObject", ({ enumerable: true, get: function () { return messages_7.isMsgCreateValidatorEncodeObject; } })); +Object.defineProperty(exports, "isMsgDelegateEncodeObject", ({ enumerable: true, get: function () { return messages_7.isMsgDelegateEncodeObject; } })); +Object.defineProperty(exports, "isMsgEditValidatorEncodeObject", ({ enumerable: true, get: function () { return messages_7.isMsgEditValidatorEncodeObject; } })); +Object.defineProperty(exports, "isMsgUndelegateEncodeObject", ({ enumerable: true, get: function () { return messages_7.isMsgUndelegateEncodeObject; } })); +Object.defineProperty(exports, "stakingTypes", ({ enumerable: true, get: function () { return messages_7.stakingTypes; } })); +var queries_10 = __webpack_require__(/*! ./staking/queries */ "./node_modules/@cosmjs/stargate/build/modules/staking/queries.js"); +Object.defineProperty(exports, "setupStakingExtension", ({ enumerable: true, get: function () { return queries_10.setupStakingExtension; } })); +var queries_11 = __webpack_require__(/*! ./tx/queries */ "./node_modules/@cosmjs/stargate/build/modules/tx/queries.js"); +Object.defineProperty(exports, "setupTxExtension", ({ enumerable: true, get: function () { return queries_11.setupTxExtension; } })); +var aminomessages_11 = __webpack_require__(/*! ./vesting/aminomessages */ "./node_modules/@cosmjs/stargate/build/modules/vesting/aminomessages.js"); +Object.defineProperty(exports, "createVestingAminoConverters", ({ enumerable: true, get: function () { return aminomessages_11.createVestingAminoConverters; } })); +Object.defineProperty(exports, "isAminoMsgCreateVestingAccount", ({ enumerable: true, get: function () { return aminomessages_11.isAminoMsgCreateVestingAccount; } })); +var messages_8 = __webpack_require__(/*! ./vesting/messages */ "./node_modules/@cosmjs/stargate/build/modules/vesting/messages.js"); +Object.defineProperty(exports, "vestingTypes", ({ enumerable: true, get: function () { return messages_8.vestingTypes; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/mint/queries.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/mint/queries.js ***! + \*********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupMintExtension = void 0; +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/index.js"); +const query_1 = __webpack_require__(/*! cosmjs-types/cosmos/mint/v1beta1/query */ "./node_modules/cosmjs-types/cosmos/mint/v1beta1/query.js"); +const queryclient_1 = __webpack_require__(/*! ../../queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +function setupMintExtension(base) { + const rpc = (0, queryclient_1.createProtobufRpcClient)(base); + // Use this service to get easy typed access to query methods + // This cannot be used for proof verification + const queryService = new query_1.QueryClientImpl(rpc); + return { + mint: { + params: async () => { + const { params } = await queryService.Params({}); + (0, utils_1.assert)(params); + return { + blocksPerYear: params.blocksPerYear, + goalBonded: (0, queryclient_1.decodeCosmosSdkDecFromProto)(params.goalBonded), + inflationMin: (0, queryclient_1.decodeCosmosSdkDecFromProto)(params.inflationMin), + inflationMax: (0, queryclient_1.decodeCosmosSdkDecFromProto)(params.inflationMax), + inflationRateChange: (0, queryclient_1.decodeCosmosSdkDecFromProto)(params.inflationRateChange), + mintDenom: params.mintDenom, + }; + }, + inflation: async () => { + const { inflation } = await queryService.Inflation({}); + return (0, queryclient_1.decodeCosmosSdkDecFromProto)(inflation); + }, + annualProvisions: async () => { + const { annualProvisions } = await queryService.AnnualProvisions({}); + return (0, queryclient_1.decodeCosmosSdkDecFromProto)(annualProvisions); + }, + }, + }; +} +exports.setupMintExtension = setupMintExtension; +//# sourceMappingURL=queries.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/slashing/aminomessages.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/slashing/aminomessages.js ***! + \*******************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createSlashingAminoConverters = exports.isAminoMsgUnjail = void 0; +function isAminoMsgUnjail(msg) { + return msg.type === "cosmos-sdk/MsgUnjail"; +} +exports.isAminoMsgUnjail = isAminoMsgUnjail; +function createSlashingAminoConverters() { + throw new Error("Not implemented"); +} +exports.createSlashingAminoConverters = createSlashingAminoConverters; +//# sourceMappingURL=aminomessages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/slashing/queries.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/slashing/queries.js ***! + \*************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupSlashingExtension = void 0; +const query_1 = __webpack_require__(/*! cosmjs-types/cosmos/slashing/v1beta1/query */ "./node_modules/cosmjs-types/cosmos/slashing/v1beta1/query.js"); +const queryclient_1 = __webpack_require__(/*! ../../queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +function setupSlashingExtension(base) { + const rpc = (0, queryclient_1.createProtobufRpcClient)(base); + const queryService = new query_1.QueryClientImpl(rpc); + return { + slashing: { + signingInfo: async (consAddress) => { + const response = await queryService.SigningInfo({ + consAddress: consAddress, + }); + return response; + }, + signingInfos: async (paginationKey) => { + const response = await queryService.SigningInfos({ + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + params: async () => { + const response = await queryService.Params({}); + return response; + }, + }, + }; +} +exports.setupSlashingExtension = setupSlashingExtension; +//# sourceMappingURL=queries.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/staking/aminomessages.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/staking/aminomessages.js ***! + \******************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createStakingAminoConverters = exports.isAminoMsgUndelegate = exports.isAminoMsgBeginRedelegate = exports.isAminoMsgDelegate = exports.isAminoMsgEditValidator = exports.isAminoMsgCreateValidator = exports.protoDecimalToJson = void 0; +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/index.js"); +const proto_signing_1 = __webpack_require__(/*! @cosmjs/proto-signing */ "./node_modules/@cosmjs/proto-signing/build/index.js"); +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/index.js"); +function protoDecimalToJson(decimal) { + const parsed = math_1.Decimal.fromAtomics(decimal, 18); + const [whole, fractional] = parsed.toString().split("."); + return `${whole}.${(fractional ?? "").padEnd(18, "0")}`; +} +exports.protoDecimalToJson = protoDecimalToJson; +function jsonDecimalToProto(decimal) { + const parsed = math_1.Decimal.fromUserInput(decimal, 18); + return parsed.atomics; +} +function isAminoMsgCreateValidator(msg) { + return msg.type === "cosmos-sdk/MsgCreateValidator"; +} +exports.isAminoMsgCreateValidator = isAminoMsgCreateValidator; +function isAminoMsgEditValidator(msg) { + return msg.type === "cosmos-sdk/MsgEditValidator"; +} +exports.isAminoMsgEditValidator = isAminoMsgEditValidator; +function isAminoMsgDelegate(msg) { + return msg.type === "cosmos-sdk/MsgDelegate"; +} +exports.isAminoMsgDelegate = isAminoMsgDelegate; +function isAminoMsgBeginRedelegate(msg) { + return msg.type === "cosmos-sdk/MsgBeginRedelegate"; +} +exports.isAminoMsgBeginRedelegate = isAminoMsgBeginRedelegate; +function isAminoMsgUndelegate(msg) { + return msg.type === "cosmos-sdk/MsgUndelegate"; +} +exports.isAminoMsgUndelegate = isAminoMsgUndelegate; +function createStakingAminoConverters() { + return { + "/cosmos.staking.v1beta1.MsgBeginRedelegate": { + aminoType: "cosmos-sdk/MsgBeginRedelegate", + toAmino: ({ delegatorAddress, validatorSrcAddress, validatorDstAddress, amount, }) => { + (0, utils_1.assertDefinedAndNotNull)(amount, "missing amount"); + return { + delegator_address: delegatorAddress, + validator_src_address: validatorSrcAddress, + validator_dst_address: validatorDstAddress, + amount: amount, + }; + }, + fromAmino: ({ delegator_address, validator_src_address, validator_dst_address, amount, }) => ({ + delegatorAddress: delegator_address, + validatorSrcAddress: validator_src_address, + validatorDstAddress: validator_dst_address, + amount: amount, + }), + }, + "/cosmos.staking.v1beta1.MsgCreateValidator": { + aminoType: "cosmos-sdk/MsgCreateValidator", + toAmino: ({ description, commission, minSelfDelegation, delegatorAddress, validatorAddress, pubkey, value, }) => { + (0, utils_1.assertDefinedAndNotNull)(description, "missing description"); + (0, utils_1.assertDefinedAndNotNull)(commission, "missing commission"); + (0, utils_1.assertDefinedAndNotNull)(pubkey, "missing pubkey"); + (0, utils_1.assertDefinedAndNotNull)(value, "missing value"); + return { + description: { + moniker: description.moniker, + identity: description.identity, + website: description.website, + security_contact: description.securityContact, + details: description.details, + }, + commission: { + rate: protoDecimalToJson(commission.rate), + max_rate: protoDecimalToJson(commission.maxRate), + max_change_rate: protoDecimalToJson(commission.maxChangeRate), + }, + min_self_delegation: minSelfDelegation, + delegator_address: delegatorAddress, + validator_address: validatorAddress, + pubkey: (0, proto_signing_1.decodePubkey)(pubkey), + value: value, + }; + }, + fromAmino: ({ description, commission, min_self_delegation, delegator_address, validator_address, pubkey, value, }) => { + return { + description: { + moniker: description.moniker, + identity: description.identity, + website: description.website, + securityContact: description.security_contact, + details: description.details, + }, + commission: { + rate: jsonDecimalToProto(commission.rate), + maxRate: jsonDecimalToProto(commission.max_rate), + maxChangeRate: jsonDecimalToProto(commission.max_change_rate), + }, + minSelfDelegation: min_self_delegation, + delegatorAddress: delegator_address, + validatorAddress: validator_address, + pubkey: (0, proto_signing_1.encodePubkey)(pubkey), + value: value, + }; + }, + }, + "/cosmos.staking.v1beta1.MsgDelegate": { + aminoType: "cosmos-sdk/MsgDelegate", + toAmino: ({ delegatorAddress, validatorAddress, amount }) => { + (0, utils_1.assertDefinedAndNotNull)(amount, "missing amount"); + return { + delegator_address: delegatorAddress, + validator_address: validatorAddress, + amount: amount, + }; + }, + fromAmino: ({ delegator_address, validator_address, amount, }) => ({ + delegatorAddress: delegator_address, + validatorAddress: validator_address, + amount: amount, + }), + }, + "/cosmos.staking.v1beta1.MsgEditValidator": { + aminoType: "cosmos-sdk/MsgEditValidator", + toAmino: ({ description, commissionRate, minSelfDelegation, validatorAddress, }) => { + (0, utils_1.assertDefinedAndNotNull)(description, "missing description"); + return { + description: { + moniker: description.moniker, + identity: description.identity, + website: description.website, + security_contact: description.securityContact, + details: description.details, + }, + // empty string in the protobuf document means "do not change" + commission_rate: commissionRate ? protoDecimalToJson(commissionRate) : undefined, + // empty string in the protobuf document means "do not change" + min_self_delegation: minSelfDelegation ? minSelfDelegation : undefined, + validator_address: validatorAddress, + }; + }, + fromAmino: ({ description, commission_rate, min_self_delegation, validator_address, }) => ({ + description: { + moniker: description.moniker, + identity: description.identity, + website: description.website, + securityContact: description.security_contact, + details: description.details, + }, + // empty string in the protobuf document means "do not change" + commissionRate: commission_rate ? jsonDecimalToProto(commission_rate) : "", + // empty string in the protobuf document means "do not change" + minSelfDelegation: min_self_delegation ?? "", + validatorAddress: validator_address, + }), + }, + "/cosmos.staking.v1beta1.MsgUndelegate": { + aminoType: "cosmos-sdk/MsgUndelegate", + toAmino: ({ delegatorAddress, validatorAddress, amount, }) => { + (0, utils_1.assertDefinedAndNotNull)(amount, "missing amount"); + return { + delegator_address: delegatorAddress, + validator_address: validatorAddress, + amount: amount, + }; + }, + fromAmino: ({ delegator_address, validator_address, amount, }) => ({ + delegatorAddress: delegator_address, + validatorAddress: validator_address, + amount: amount, + }), + }, + }; +} +exports.createStakingAminoConverters = createStakingAminoConverters; +//# sourceMappingURL=aminomessages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/staking/messages.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/staking/messages.js ***! + \*************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isMsgUndelegateEncodeObject = exports.isMsgEditValidatorEncodeObject = exports.isMsgDelegateEncodeObject = exports.isMsgCreateValidatorEncodeObject = exports.isMsgBeginRedelegateEncodeObject = exports.stakingTypes = void 0; +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/staking/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/staking/v1beta1/tx.js"); +exports.stakingTypes = [ + ["/cosmos.staking.v1beta1.MsgBeginRedelegate", tx_1.MsgBeginRedelegate], + ["/cosmos.staking.v1beta1.MsgCreateValidator", tx_1.MsgCreateValidator], + ["/cosmos.staking.v1beta1.MsgDelegate", tx_1.MsgDelegate], + ["/cosmos.staking.v1beta1.MsgEditValidator", tx_1.MsgEditValidator], + ["/cosmos.staking.v1beta1.MsgUndelegate", tx_1.MsgUndelegate], +]; +function isMsgBeginRedelegateEncodeObject(o) { + return o.typeUrl === "/cosmos.staking.v1beta1.MsgBeginRedelegate"; +} +exports.isMsgBeginRedelegateEncodeObject = isMsgBeginRedelegateEncodeObject; +function isMsgCreateValidatorEncodeObject(o) { + return o.typeUrl === "/cosmos.staking.v1beta1.MsgCreateValidator"; +} +exports.isMsgCreateValidatorEncodeObject = isMsgCreateValidatorEncodeObject; +function isMsgDelegateEncodeObject(object) { + return object.typeUrl === "/cosmos.staking.v1beta1.MsgDelegate"; +} +exports.isMsgDelegateEncodeObject = isMsgDelegateEncodeObject; +function isMsgEditValidatorEncodeObject(o) { + return o.typeUrl === "/cosmos.staking.v1beta1.MsgEditValidator"; +} +exports.isMsgEditValidatorEncodeObject = isMsgEditValidatorEncodeObject; +function isMsgUndelegateEncodeObject(object) { + return object.typeUrl === "/cosmos.staking.v1beta1.MsgUndelegate"; +} +exports.isMsgUndelegateEncodeObject = isMsgUndelegateEncodeObject; +//# sourceMappingURL=messages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/staking/queries.js": +/*!************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/staking/queries.js ***! + \************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupStakingExtension = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const query_1 = __webpack_require__(/*! cosmjs-types/cosmos/staking/v1beta1/query */ "./node_modules/cosmjs-types/cosmos/staking/v1beta1/query.js"); +const long_1 = __importDefault(__webpack_require__(/*! long */ "./node_modules/long/src/long.js")); +const queryclient_1 = __webpack_require__(/*! ../../queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +function setupStakingExtension(base) { + // Use this service to get easy typed access to query methods + // This cannot be used for proof verification + const rpc = (0, queryclient_1.createProtobufRpcClient)(base); + const queryService = new query_1.QueryClientImpl(rpc); + return { + staking: { + delegation: async (delegatorAddress, validatorAddress) => { + const response = await queryService.Delegation({ + delegatorAddr: delegatorAddress, + validatorAddr: validatorAddress, + }); + return response; + }, + delegatorDelegations: async (delegatorAddress, paginationKey) => { + const response = await queryService.DelegatorDelegations({ + delegatorAddr: delegatorAddress, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + delegatorUnbondingDelegations: async (delegatorAddress, paginationKey) => { + const response = await queryService.DelegatorUnbondingDelegations({ + delegatorAddr: delegatorAddress, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + delegatorValidator: async (delegatorAddress, validatorAddress) => { + const response = await queryService.DelegatorValidator({ + delegatorAddr: delegatorAddress, + validatorAddr: validatorAddress, + }); + return response; + }, + delegatorValidators: async (delegatorAddress, paginationKey) => { + const response = await queryService.DelegatorValidators({ + delegatorAddr: delegatorAddress, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + historicalInfo: async (height) => { + const response = await queryService.HistoricalInfo({ + height: long_1.default.fromNumber(height, true), + }); + return response; + }, + params: async () => { + const response = await queryService.Params({}); + return response; + }, + pool: async () => { + const response = await queryService.Pool({}); + return response; + }, + redelegations: async (delegatorAddress, sourceValidatorAddress, destinationValidatorAddress, paginationKey) => { + const response = await queryService.Redelegations({ + delegatorAddr: delegatorAddress, + srcValidatorAddr: sourceValidatorAddress, + dstValidatorAddr: destinationValidatorAddress, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + unbondingDelegation: async (delegatorAddress, validatorAddress) => { + const response = await queryService.UnbondingDelegation({ + delegatorAddr: delegatorAddress, + validatorAddr: validatorAddress, + }); + return response; + }, + validator: async (validatorAddress) => { + const response = await queryService.Validator({ validatorAddr: validatorAddress }); + return response; + }, + validatorDelegations: async (validatorAddress, paginationKey) => { + const response = await queryService.ValidatorDelegations({ + validatorAddr: validatorAddress, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + validators: async (status, paginationKey) => { + const response = await queryService.Validators({ + status: status, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + validatorUnbondingDelegations: async (validatorAddress, paginationKey) => { + const response = await queryService.ValidatorUnbondingDelegations({ + validatorAddr: validatorAddress, + pagination: (0, queryclient_1.createPagination)(paginationKey), + }); + return response; + }, + }, + }; +} +exports.setupStakingExtension = setupStakingExtension; +//# sourceMappingURL=queries.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/tx/queries.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/tx/queries.js ***! + \*******************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupTxExtension = void 0; +const proto_signing_1 = __webpack_require__(/*! @cosmjs/proto-signing */ "./node_modules/@cosmjs/proto-signing/build/index.js"); +const signing_1 = __webpack_require__(/*! cosmjs-types/cosmos/tx/signing/v1beta1/signing */ "./node_modules/cosmjs-types/cosmos/tx/signing/v1beta1/signing.js"); +const service_1 = __webpack_require__(/*! cosmjs-types/cosmos/tx/v1beta1/service */ "./node_modules/cosmjs-types/cosmos/tx/v1beta1/service.js"); +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/tx/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/tx/v1beta1/tx.js"); +const long_1 = __importDefault(__webpack_require__(/*! long */ "./node_modules/long/src/long.js")); +const queryclient_1 = __webpack_require__(/*! ../../queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +function setupTxExtension(base) { + // Use this service to get easy typed access to query methods + // This cannot be used for proof verification + const rpc = (0, queryclient_1.createProtobufRpcClient)(base); + const queryService = new service_1.ServiceClientImpl(rpc); + return { + tx: { + getTx: async (txId) => { + const request = { + hash: txId, + }; + const response = await queryService.GetTx(request); + return response; + }, + simulate: async (messages, memo, signer, sequence) => { + const tx = tx_1.Tx.fromPartial({ + authInfo: tx_1.AuthInfo.fromPartial({ + fee: tx_1.Fee.fromPartial({}), + signerInfos: [ + { + publicKey: (0, proto_signing_1.encodePubkey)(signer), + sequence: long_1.default.fromNumber(sequence, true), + modeInfo: { single: { mode: signing_1.SignMode.SIGN_MODE_UNSPECIFIED } }, + }, + ], + }), + body: tx_1.TxBody.fromPartial({ + messages: Array.from(messages), + memo: memo, + }), + signatures: [new Uint8Array()], + }); + const request = service_1.SimulateRequest.fromPartial({ + txBytes: tx_1.Tx.encode(tx).finish(), + }); + const response = await queryService.Simulate(request); + return response; + }, + }, + }; +} +exports.setupTxExtension = setupTxExtension; +//# sourceMappingURL=queries.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/vesting/aminomessages.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/vesting/aminomessages.js ***! + \******************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createVestingAminoConverters = exports.isAminoMsgCreateVestingAccount = void 0; +const long_1 = __importDefault(__webpack_require__(/*! long */ "./node_modules/long/src/long.js")); +function isAminoMsgCreateVestingAccount(msg) { + return msg.type === "cosmos-sdk/MsgCreateVestingAccount"; +} +exports.isAminoMsgCreateVestingAccount = isAminoMsgCreateVestingAccount; +function createVestingAminoConverters() { + return { + "/cosmos.vesting.v1beta1.MsgCreateVestingAccount": { + aminoType: "cosmos-sdk/MsgCreateVestingAccount", + toAmino: ({ fromAddress, toAddress, amount, endTime, delayed, }) => ({ + from_address: fromAddress, + to_address: toAddress, + amount: [...amount], + end_time: endTime.toString(), + delayed: delayed, + }), + fromAmino: ({ from_address, to_address, amount, end_time, delayed, }) => ({ + fromAddress: from_address, + toAddress: to_address, + amount: [...amount], + endTime: long_1.default.fromString(end_time), + delayed: delayed, + }), + }, + }; +} +exports.createVestingAminoConverters = createVestingAminoConverters; +//# sourceMappingURL=aminomessages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/modules/vesting/messages.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/modules/vesting/messages.js ***! + \*************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.vestingTypes = void 0; +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/vesting/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/vesting/v1beta1/tx.js"); +exports.vestingTypes = [ + ["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", tx_1.MsgCreateVestingAccount], +]; +//# sourceMappingURL=messages.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/multisignature.js": +/*!***************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/multisignature.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.makeMultisignedTxBytes = exports.makeMultisignedTx = exports.makeCompactBitArray = void 0; +const amino_1 = __webpack_require__(/*! @cosmjs/amino */ "./node_modules/@cosmjs/amino/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/index.js"); +const proto_signing_1 = __webpack_require__(/*! @cosmjs/proto-signing */ "./node_modules/@cosmjs/proto-signing/build/index.js"); +const multisig_1 = __webpack_require__(/*! cosmjs-types/cosmos/crypto/multisig/v1beta1/multisig */ "./node_modules/cosmjs-types/cosmos/crypto/multisig/v1beta1/multisig.js"); +const signing_1 = __webpack_require__(/*! cosmjs-types/cosmos/tx/signing/v1beta1/signing */ "./node_modules/cosmjs-types/cosmos/tx/signing/v1beta1/signing.js"); +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/tx/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/tx/v1beta1/tx.js"); +const tx_2 = __webpack_require__(/*! cosmjs-types/cosmos/tx/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/tx/v1beta1/tx.js"); +const long_1 = __importDefault(__webpack_require__(/*! long */ "./node_modules/long/src/long.js")); +function makeCompactBitArray(bits) { + const byteCount = Math.ceil(bits.length / 8); + const extraBits = bits.length - Math.floor(bits.length / 8) * 8; + const bytes = new Uint8Array(byteCount); // zero-filled + bits.forEach((value, index) => { + const bytePos = Math.floor(index / 8); + const bitPos = index % 8; + // eslint-disable-next-line no-bitwise + if (value) + bytes[bytePos] |= 0b1 << (8 - 1 - bitPos); + }); + return multisig_1.CompactBitArray.fromPartial({ elems: bytes, extraBitsStored: extraBits }); +} +exports.makeCompactBitArray = makeCompactBitArray; +/** + * Creates a signed transaction from signer info, transaction body and signatures. + * The result can be broadcasted after serialization. + * + * Consider using `makeMultisignedTxBytes` instead if you want to broadcast the + * transaction immediately. + */ +function makeMultisignedTx(multisigPubkey, sequence, fee, bodyBytes, signatures) { + const addresses = Array.from(signatures.keys()); + const prefix = (0, encoding_1.fromBech32)(addresses[0]).prefix; + const signers = Array(multisigPubkey.value.pubkeys.length).fill(false); + const signaturesList = new Array(); + for (let i = 0; i < multisigPubkey.value.pubkeys.length; i++) { + const signerAddress = (0, amino_1.pubkeyToAddress)(multisigPubkey.value.pubkeys[i], prefix); + const signature = signatures.get(signerAddress); + if (signature) { + signers[i] = true; + signaturesList.push(signature); + } + } + const signerInfo = { + publicKey: (0, proto_signing_1.encodePubkey)(multisigPubkey), + modeInfo: { + multi: { + bitarray: makeCompactBitArray(signers), + modeInfos: signaturesList.map((_) => ({ single: { mode: signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON } })), + }, + }, + sequence: long_1.default.fromNumber(sequence), + }; + const authInfo = tx_1.AuthInfo.fromPartial({ + signerInfos: [signerInfo], + fee: { + amount: [...fee.amount], + gasLimit: long_1.default.fromString(fee.gas), + }, + }); + const authInfoBytes = tx_1.AuthInfo.encode(authInfo).finish(); + const signedTx = tx_2.TxRaw.fromPartial({ + bodyBytes: bodyBytes, + authInfoBytes: authInfoBytes, + signatures: [multisig_1.MultiSignature.encode(multisig_1.MultiSignature.fromPartial({ signatures: signaturesList })).finish()], + }); + return signedTx; +} +exports.makeMultisignedTx = makeMultisignedTx; +/** + * Creates a signed transaction from signer info, transaction body and signatures. + * The result can be broadcasted. + * + * This is a wrapper around `makeMultisignedTx` that encodes the transaction for broadcasting. + */ +function makeMultisignedTxBytes(multisigPubkey, sequence, fee, bodyBytes, signatures) { + const signedTx = makeMultisignedTx(multisigPubkey, sequence, fee, bodyBytes, signatures); + return Uint8Array.from(tx_2.TxRaw.encode(signedTx).finish()); +} +exports.makeMultisignedTxBytes = makeMultisignedTxBytes; +//# sourceMappingURL=multisignature.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/queryclient/index.js": +/*!******************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/queryclient/index.js ***! + \******************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.longify = exports.decodeCosmosSdkDecFromProto = exports.createProtobufRpcClient = exports.createPagination = exports.QueryClient = void 0; +var queryclient_1 = __webpack_require__(/*! ./queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/queryclient.js"); +Object.defineProperty(exports, "QueryClient", ({ enumerable: true, get: function () { return queryclient_1.QueryClient; } })); +var utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/@cosmjs/stargate/build/queryclient/utils.js"); +Object.defineProperty(exports, "createPagination", ({ enumerable: true, get: function () { return utils_1.createPagination; } })); +Object.defineProperty(exports, "createProtobufRpcClient", ({ enumerable: true, get: function () { return utils_1.createProtobufRpcClient; } })); +Object.defineProperty(exports, "decodeCosmosSdkDecFromProto", ({ enumerable: true, get: function () { return utils_1.decodeCosmosSdkDecFromProto; } })); +Object.defineProperty(exports, "longify", ({ enumerable: true, get: function () { return utils_1.longify; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/queryclient/queryclient.js": +/*!************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/queryclient/queryclient.js ***! + \************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClient = void 0; +/* eslint-disable no-dupe-class-members, @typescript-eslint/ban-types, @typescript-eslint/naming-convention */ +const ics23_1 = __webpack_require__(/*! @confio/ics23 */ "./node_modules/@confio/ics23/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/index.js"); +const stream_1 = __webpack_require__(/*! @cosmjs/stream */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/index.js"); +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/index.js"); +function checkAndParseOp(op, kind, key) { + if (op.type !== kind) { + throw new Error(`Op expected to be ${kind}, got "${op.type}`); + } + if (!(0, utils_1.arrayContentEquals)(key, op.key)) { + throw new Error(`Proven key different than queried key.\nQuery: ${(0, encoding_1.toHex)(key)}\nProven: ${(0, encoding_1.toHex)(op.key)}`); + } + return ics23_1.ics23.CommitmentProof.decode(op.data); +} +class QueryClient { + constructor(tmClient) { + this.tmClient = tmClient; + } + static withExtensions(tmClient, ...extensionSetups) { + const client = new QueryClient(tmClient); + const extensions = extensionSetups.map((setupExtension) => setupExtension(client)); + for (const extension of extensions) { + (0, utils_1.assert)((0, utils_1.isNonNullObject)(extension), `Extension must be a non-null object`); + for (const [moduleKey, moduleValue] of Object.entries(extension)) { + (0, utils_1.assert)((0, utils_1.isNonNullObject)(moduleValue), `Module must be a non-null object. Found type ${typeof moduleValue} for module "${moduleKey}".`); + const current = client[moduleKey] || {}; + client[moduleKey] = { + ...current, + ...moduleValue, + }; + } + } + return client; + } + /** + * @deprecated use queryStoreVerified instead + */ + async queryVerified(store, queryKey, desiredHeight) { + const { value } = await this.queryStoreVerified(store, queryKey, desiredHeight); + return value; + } + /** + * Queries the database store with a proof, which is then verified. + * + * Please note: the current implementation trusts block headers it gets from the PRC endpoint. + */ + async queryStoreVerified(store, queryKey, desiredHeight) { + const { height, proof, key, value } = await this.queryRawProof(store, queryKey, desiredHeight); + const subProof = checkAndParseOp(proof.ops[0], "ics23:iavl", queryKey); + const storeProof = checkAndParseOp(proof.ops[1], "ics23:simple", (0, encoding_1.toAscii)(store)); + // this must always be existence, if the store is not a typo + (0, utils_1.assert)(storeProof.exist); + (0, utils_1.assert)(storeProof.exist.value); + // this may be exist or non-exist, depends on response + if (!value || value.length === 0) { + // non-existence check + (0, utils_1.assert)(subProof.nonexist); + // the subproof must map the desired key to the "value" of the storeProof + (0, ics23_1.verifyNonExistence)(subProof.nonexist, ics23_1.iavlSpec, storeProof.exist.value, queryKey); + } + else { + // existence check + (0, utils_1.assert)(subProof.exist); + (0, utils_1.assert)(subProof.exist.value); + // the subproof must map the desired key to the "value" of the storeProof + (0, ics23_1.verifyExistence)(subProof.exist, ics23_1.iavlSpec, storeProof.exist.value, queryKey, value); + } + // the store proof must map its declared value (root of subProof) to the appHash of the next block + const header = await this.getNextHeader(height); + (0, ics23_1.verifyExistence)(storeProof.exist, ics23_1.tendermintSpec, header.appHash, (0, encoding_1.toAscii)(store), storeProof.exist.value); + return { key, value, height }; + } + async queryRawProof(store, queryKey, desiredHeight) { + const { key, value, height, proof, code, log } = await this.tmClient.abciQuery({ + // we need the StoreKey for the module, not the module name + // https://github.com/cosmos/cosmos-sdk/blob/8cab43c8120fec5200c3459cbf4a92017bb6f287/x/auth/types/keys.go#L12 + path: `/store/${store}/key`, + data: queryKey, + prove: true, + height: desiredHeight, + }); + if (code) { + throw new Error(`Query failed with (${code}): ${log}`); + } + if (!(0, utils_1.arrayContentEquals)(queryKey, key)) { + throw new Error(`Response key ${(0, encoding_1.toHex)(key)} doesn't match query key ${(0, encoding_1.toHex)(queryKey)}`); + } + if (!height) { + throw new Error("No query height returned"); + } + if (!proof || proof.ops.length !== 2) { + throw new Error(`Expected 2 proof ops, got ${proof?.ops.length ?? 0}. Are you using stargate?`); + } + // we don't need the results, but we can ensure the data is the proper format + checkAndParseOp(proof.ops[0], "ics23:iavl", key); + checkAndParseOp(proof.ops[1], "ics23:simple", (0, encoding_1.toAscii)(store)); + return { + key: key, + value: value, + height: height, + // need to clone this: readonly input / writeable output + proof: { + ops: [...proof.ops], + }, + }; + } + /** + * Performs an ABCI query to Tendermint without requesting a proof. + * + * @deprecated use queryAbci instead + */ + async queryUnverified(path, request, desiredHeight) { + const response = await this.queryAbci(path, request, desiredHeight); + return response.value; + } + /** + * Performs an ABCI query to Tendermint without requesting a proof. + * + * If the `desiredHeight` is set, a particular height is requested. Otherwise + * the latest height is requested. The response contains the actual height of + * the query. + */ + async queryAbci(path, request, desiredHeight) { + const response = await this.tmClient.abciQuery({ + path: path, + data: request, + prove: false, + height: desiredHeight, + }); + if (response.code) { + throw new Error(`Query failed with (${response.code}): ${response.log}`); + } + if (!response.height) { + throw new Error("No query height returned"); + } + return { + value: response.value, + height: response.height, + }; + } + // this must return the header for height+1 + // throws an error if height is 0 or undefined + async getNextHeader(height) { + (0, utils_1.assertDefined)(height); + if (height === 0) { + throw new Error("Query returned height 0, cannot prove it"); + } + const searchHeight = height + 1; + let nextHeader; + let headersSubscription; + try { + headersSubscription = this.tmClient.subscribeNewBlockHeader(); + } + catch { + // Ignore exception caused by non-WebSocket Tendermint clients + } + if (headersSubscription) { + const firstHeader = await (0, stream_1.firstEvent)(headersSubscription); + // The first header we get might not be n+1 but n+2 or even higher. In such cases we fall back on a query. + if (firstHeader.height === searchHeight) { + nextHeader = firstHeader; + } + } + while (!nextHeader) { + // start from current height to avoid backend error for minHeight in the future + const correctHeader = (await this.tmClient.blockchain(height, searchHeight)).blockMetas + .map((meta) => meta.header) + .find((h) => h.height === searchHeight); + if (correctHeader) { + nextHeader = correctHeader; + } + else { + await (0, utils_1.sleep)(1000); + } + } + (0, utils_1.assert)(nextHeader.height === searchHeight, "Got wrong header. This is a bug in the logic above."); + return nextHeader; + } +} +exports.QueryClient = QueryClient; +//# sourceMappingURL=queryclient.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/queryclient/utils.js": +/*!******************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/queryclient/utils.js ***! + \******************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.decodeCosmosSdkDecFromProto = exports.longify = exports.createProtobufRpcClient = exports.createPagination = exports.toAccAddress = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/index.js"); +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/index.js"); +const pagination_1 = __webpack_require__(/*! cosmjs-types/cosmos/base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const long_1 = __importDefault(__webpack_require__(/*! long */ "./node_modules/long/src/long.js")); +/** + * Takes a bech32 encoded address and returns the data part. The prefix is ignored and discarded. + * This is called AccAddress in Cosmos SDK, which is basically an alias for raw binary data. + * The result is typically 20 bytes long but not restricted to that. + */ +function toAccAddress(address) { + return (0, encoding_1.fromBech32)(address).data; +} +exports.toAccAddress = toAccAddress; +/** + * If paginationKey is set, return a `PageRequest` with the given key. + * If paginationKey is unset, return `undefined`. + * + * Use this with a query response's pagination next key to + * request the next page. + */ +function createPagination(paginationKey) { + return paginationKey ? pagination_1.PageRequest.fromPartial({ key: paginationKey }) : undefined; +} +exports.createPagination = createPagination; +function createProtobufRpcClient(base) { + return { + request: async (service, method, data) => { + const path = `/${service}/${method}`; + const response = await base.queryAbci(path, data, undefined); + return response.value; + }, + }; +} +exports.createProtobufRpcClient = createProtobufRpcClient; +/** + * Takes a uint64 value as string, number, Long or Uint64 and returns an unsigned Long instance + * of it. + */ +function longify(value) { + const checkedValue = math_1.Uint64.fromString(value.toString()); + return long_1.default.fromBytesBE([...checkedValue.toBytesBigEndian()], true); +} +exports.longify = longify; +/** + * Takes a string or binary encoded `github.com/cosmos/cosmos-sdk/types.Dec` from the + * protobuf API and converts it into a `Decimal` with 18 fractional digits. + * + * See https://github.com/cosmos/cosmos-sdk/issues/10863 for more context why this is needed. + */ +function decodeCosmosSdkDecFromProto(input) { + const asString = typeof input === "string" ? input : (0, encoding_1.fromAscii)(input); + return math_1.Decimal.fromAtomics(asString, 18); +} +exports.decodeCosmosSdkDecFromProto = decodeCosmosSdkDecFromProto; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/search.js": +/*!*******************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/search.js ***! + \*******************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isSearchByTagsQuery = exports.isSearchBySentFromOrToQuery = exports.isSearchByHeightQuery = void 0; +function isSearchByHeightQuery(query) { + return query.height !== undefined; +} +exports.isSearchByHeightQuery = isSearchByHeightQuery; +function isSearchBySentFromOrToQuery(query) { + return query.sentFromOrTo !== undefined; +} +exports.isSearchBySentFromOrToQuery = isSearchBySentFromOrToQuery; +function isSearchByTagsQuery(query) { + return query.tags !== undefined; +} +exports.isSearchByTagsQuery = isSearchByTagsQuery; +//# sourceMappingURL=search.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/signingstargateclient.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/signingstargateclient.js ***! + \**********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SigningStargateClient = exports.createDefaultAminoConverters = exports.defaultRegistryTypes = void 0; +const amino_1 = __webpack_require__(/*! @cosmjs/amino */ "./node_modules/@cosmjs/amino/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/index.js"); +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/index.js"); +const proto_signing_1 = __webpack_require__(/*! @cosmjs/proto-signing */ "./node_modules/@cosmjs/proto-signing/build/index.js"); +const tendermint_rpc_1 = __webpack_require__(/*! @cosmjs/tendermint-rpc */ "./node_modules/@cosmjs/tendermint-rpc/build/index.js"); +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/index.js"); +const coin_1 = __webpack_require__(/*! cosmjs-types/cosmos/base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const tx_1 = __webpack_require__(/*! cosmjs-types/cosmos/distribution/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/distribution/v1beta1/tx.js"); +const tx_2 = __webpack_require__(/*! cosmjs-types/cosmos/staking/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/staking/v1beta1/tx.js"); +const signing_1 = __webpack_require__(/*! cosmjs-types/cosmos/tx/signing/v1beta1/signing */ "./node_modules/cosmjs-types/cosmos/tx/signing/v1beta1/signing.js"); +const tx_3 = __webpack_require__(/*! cosmjs-types/cosmos/tx/v1beta1/tx */ "./node_modules/cosmjs-types/cosmos/tx/v1beta1/tx.js"); +const tx_4 = __webpack_require__(/*! cosmjs-types/ibc/applications/transfer/v1/tx */ "./node_modules/cosmjs-types/ibc/applications/transfer/v1/tx.js"); +const long_1 = __importDefault(__webpack_require__(/*! long */ "./node_modules/long/src/long.js")); +const aminotypes_1 = __webpack_require__(/*! ./aminotypes */ "./node_modules/@cosmjs/stargate/build/aminotypes.js"); +const fee_1 = __webpack_require__(/*! ./fee */ "./node_modules/@cosmjs/stargate/build/fee.js"); +const modules_1 = __webpack_require__(/*! ./modules */ "./node_modules/@cosmjs/stargate/build/modules/index.js"); +const modules_2 = __webpack_require__(/*! ./modules */ "./node_modules/@cosmjs/stargate/build/modules/index.js"); +const stargateclient_1 = __webpack_require__(/*! ./stargateclient */ "./node_modules/@cosmjs/stargate/build/stargateclient.js"); +exports.defaultRegistryTypes = [ + ["/cosmos.base.v1beta1.Coin", coin_1.Coin], + ...modules_1.authzTypes, + ...modules_1.bankTypes, + ...modules_1.distributionTypes, + ...modules_1.feegrantTypes, + ...modules_1.govTypes, + ...modules_1.stakingTypes, + ...modules_1.ibcTypes, + ...modules_1.vestingTypes, +]; +function createDefaultAminoConverters() { + return { + ...(0, modules_2.createAuthzAminoConverters)(), + ...(0, modules_2.createBankAminoConverters)(), + ...(0, modules_2.createDistributionAminoConverters)(), + ...(0, modules_2.createGovAminoConverters)(), + ...(0, modules_2.createStakingAminoConverters)(), + ...(0, modules_2.createIbcAminoConverters)(), + ...(0, modules_2.createFeegrantAminoConverters)(), + ...(0, modules_2.createVestingAminoConverters)(), + }; +} +exports.createDefaultAminoConverters = createDefaultAminoConverters; +class SigningStargateClient extends stargateclient_1.StargateClient { + constructor(tmClient, signer, options) { + super(tmClient, options); + const { registry = new proto_signing_1.Registry(exports.defaultRegistryTypes), aminoTypes = new aminotypes_1.AminoTypes(createDefaultAminoConverters()), } = options; + this.registry = registry; + this.aminoTypes = aminoTypes; + this.signer = signer; + this.broadcastTimeoutMs = options.broadcastTimeoutMs; + this.broadcastPollIntervalMs = options.broadcastPollIntervalMs; + this.gasPrice = options.gasPrice; + } + /** + * Creates an instance by connecting to the given Tendermint RPC endpoint. + * + * For now this uses the Tendermint 0.34 client. If you need Tendermint 0.37 + * support, see `createWithSigner`. + */ + static async connectWithSigner(endpoint, signer, options = {}) { + const tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint); + return SigningStargateClient.createWithSigner(tmClient, signer, options); + } + /** + * Creates an instance from a manually created Tendermint client. + * Use this to use `Tendermint37Client` instead of `Tendermint34Client`. + */ + static async createWithSigner(tmClient, signer, options = {}) { + return new SigningStargateClient(tmClient, signer, options); + } + /** + * Creates a client in offline mode. + * + * This should only be used in niche cases where you know exactly what you're doing, + * e.g. when building an offline signing application. + * + * When you try to use online functionality with such a signer, an + * exception will be raised. + */ + static async offline(signer, options = {}) { + return new SigningStargateClient(undefined, signer, options); + } + async simulate(signerAddress, messages, memo) { + const anyMsgs = messages.map((m) => this.registry.encodeAsAny(m)); + const accountFromSigner = (await this.signer.getAccounts()).find((account) => account.address === signerAddress); + if (!accountFromSigner) { + throw new Error("Failed to retrieve account from signer"); + } + const pubkey = (0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey); + const { sequence } = await this.getSequence(signerAddress); + const { gasInfo } = await this.forceGetQueryClient().tx.simulate(anyMsgs, memo, pubkey, sequence); + (0, utils_1.assertDefined)(gasInfo); + return math_1.Uint53.fromString(gasInfo.gasUsed.toString()).toNumber(); + } + async sendTokens(senderAddress, recipientAddress, amount, fee, memo = "") { + const sendMsg = { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value: { + fromAddress: senderAddress, + toAddress: recipientAddress, + amount: [...amount], + }, + }; + return this.signAndBroadcast(senderAddress, [sendMsg], fee, memo); + } + async delegateTokens(delegatorAddress, validatorAddress, amount, fee, memo = "") { + const delegateMsg = { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + value: tx_2.MsgDelegate.fromPartial({ + delegatorAddress: delegatorAddress, + validatorAddress: validatorAddress, + amount: amount, + }), + }; + return this.signAndBroadcast(delegatorAddress, [delegateMsg], fee, memo); + } + async undelegateTokens(delegatorAddress, validatorAddress, amount, fee, memo = "") { + const undelegateMsg = { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", + value: tx_2.MsgUndelegate.fromPartial({ + delegatorAddress: delegatorAddress, + validatorAddress: validatorAddress, + amount: amount, + }), + }; + return this.signAndBroadcast(delegatorAddress, [undelegateMsg], fee, memo); + } + async withdrawRewards(delegatorAddress, validatorAddress, fee, memo = "") { + const withdrawMsg = { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + value: tx_1.MsgWithdrawDelegatorReward.fromPartial({ + delegatorAddress: delegatorAddress, + validatorAddress: validatorAddress, + }), + }; + return this.signAndBroadcast(delegatorAddress, [withdrawMsg], fee, memo); + } + async sendIbcTokens(senderAddress, recipientAddress, transferAmount, sourcePort, sourceChannel, timeoutHeight, + /** timeout in seconds */ + timeoutTimestamp, fee, memo = "") { + const timeoutTimestampNanoseconds = timeoutTimestamp + ? long_1.default.fromNumber(timeoutTimestamp).multiply(1000000000) + : undefined; + const transferMsg = { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + value: tx_4.MsgTransfer.fromPartial({ + sourcePort: sourcePort, + sourceChannel: sourceChannel, + sender: senderAddress, + receiver: recipientAddress, + token: transferAmount, + timeoutHeight: timeoutHeight, + timeoutTimestamp: timeoutTimestampNanoseconds, + }), + }; + return this.signAndBroadcast(senderAddress, [transferMsg], fee, memo); + } + async signAndBroadcast(signerAddress, messages, fee, memo = "") { + let usedFee; + if (fee == "auto" || typeof fee === "number") { + (0, utils_1.assertDefined)(this.gasPrice, "Gas price must be set in the client options when auto gas is used."); + const gasEstimation = await this.simulate(signerAddress, messages, memo); + const multiplier = typeof fee === "number" ? fee : 1.3; + usedFee = (0, fee_1.calculateFee)(Math.round(gasEstimation * multiplier), this.gasPrice); + } + else { + usedFee = fee; + } + const txRaw = await this.sign(signerAddress, messages, usedFee, memo); + const txBytes = tx_3.TxRaw.encode(txRaw).finish(); + return this.broadcastTx(txBytes, this.broadcastTimeoutMs, this.broadcastPollIntervalMs); + } + /** + * Gets account number and sequence from the API, creates a sign doc, + * creates a single signature and assembles the signed transaction. + * + * The sign mode (SIGN_MODE_DIRECT or SIGN_MODE_LEGACY_AMINO_JSON) is determined by this client's signer. + * + * You can pass signer data (account number, sequence and chain ID) explicitly instead of querying them + * from the chain. This is needed when signing for a multisig account, but it also allows for offline signing + * (See the SigningStargateClient.offline constructor). + */ + async sign(signerAddress, messages, fee, memo, explicitSignerData) { + let signerData; + if (explicitSignerData) { + signerData = explicitSignerData; + } + else { + const { accountNumber, sequence } = await this.getSequence(signerAddress); + const chainId = await this.getChainId(); + signerData = { + accountNumber: accountNumber, + sequence: sequence, + chainId: chainId, + }; + } + return (0, proto_signing_1.isOfflineDirectSigner)(this.signer) + ? this.signDirect(signerAddress, messages, fee, memo, signerData) + : this.signAmino(signerAddress, messages, fee, memo, signerData); + } + async signAmino(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId }) { + (0, utils_1.assert)(!(0, proto_signing_1.isOfflineDirectSigner)(this.signer)); + const accountFromSigner = (await this.signer.getAccounts()).find((account) => account.address === signerAddress); + if (!accountFromSigner) { + throw new Error("Failed to retrieve account from signer"); + } + const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey)); + const signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON; + const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg)); + const signDoc = (0, amino_1.makeSignDoc)(msgs, fee, chainId, memo, accountNumber, sequence); + const { signature, signed } = await this.signer.signAmino(signerAddress, signDoc); + const signedTxBody = { + messages: signed.msgs.map((msg) => this.aminoTypes.fromAmino(msg)), + memo: signed.memo, + }; + const signedTxBodyEncodeObject = { + typeUrl: "/cosmos.tx.v1beta1.TxBody", + value: signedTxBody, + }; + const signedTxBodyBytes = this.registry.encode(signedTxBodyEncodeObject); + const signedGasLimit = math_1.Int53.fromString(signed.fee.gas).toNumber(); + const signedSequence = math_1.Int53.fromString(signed.sequence).toNumber(); + const signedAuthInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signed.fee.granter, signed.fee.payer, signMode); + return tx_3.TxRaw.fromPartial({ + bodyBytes: signedTxBodyBytes, + authInfoBytes: signedAuthInfoBytes, + signatures: [(0, encoding_1.fromBase64)(signature.signature)], + }); + } + async signDirect(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId }) { + (0, utils_1.assert)((0, proto_signing_1.isOfflineDirectSigner)(this.signer)); + const accountFromSigner = (await this.signer.getAccounts()).find((account) => account.address === signerAddress); + if (!accountFromSigner) { + throw new Error("Failed to retrieve account from signer"); + } + const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey)); + const txBodyEncodeObject = { + typeUrl: "/cosmos.tx.v1beta1.TxBody", + value: { + messages: messages, + memo: memo, + }, + }; + const txBodyBytes = this.registry.encode(txBodyEncodeObject); + const gasLimit = math_1.Int53.fromString(fee.gas).toNumber(); + const authInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence }], fee.amount, gasLimit, fee.granter, fee.payer); + const signDoc = (0, proto_signing_1.makeSignDoc)(txBodyBytes, authInfoBytes, chainId, accountNumber); + const { signature, signed } = await this.signer.signDirect(signerAddress, signDoc); + return tx_3.TxRaw.fromPartial({ + bodyBytes: signed.bodyBytes, + authInfoBytes: signed.authInfoBytes, + signatures: [(0, encoding_1.fromBase64)(signature.signature)], + }); + } +} +exports.SigningStargateClient = SigningStargateClient; +//# sourceMappingURL=signingstargateclient.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/build/stargateclient.js": +/*!***************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/build/stargateclient.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StargateClient = exports.BroadcastTxError = exports.assertIsDeliverTxFailure = exports.assertIsDeliverTxSuccess = exports.isDeliverTxSuccess = exports.isDeliverTxFailure = exports.TimeoutError = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const amino_1 = __webpack_require__(/*! @cosmjs/amino */ "./node_modules/@cosmjs/amino/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/index.js"); +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/index.js"); +const tendermint_rpc_1 = __webpack_require__(/*! @cosmjs/tendermint-rpc */ "./node_modules/@cosmjs/tendermint-rpc/build/index.js"); +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/index.js"); +const accounts_1 = __webpack_require__(/*! ./accounts */ "./node_modules/@cosmjs/stargate/build/accounts.js"); +const events_1 = __webpack_require__(/*! ./events */ "./node_modules/@cosmjs/stargate/build/events.js"); +const modules_1 = __webpack_require__(/*! ./modules */ "./node_modules/@cosmjs/stargate/build/modules/index.js"); +const queryclient_1 = __webpack_require__(/*! ./queryclient */ "./node_modules/@cosmjs/stargate/build/queryclient/index.js"); +const search_1 = __webpack_require__(/*! ./search */ "./node_modules/@cosmjs/stargate/build/search.js"); +class TimeoutError extends Error { + constructor(message, txId) { + super(message); + this.txId = txId; + } +} +exports.TimeoutError = TimeoutError; +function isDeliverTxFailure(result) { + return !!result.code; +} +exports.isDeliverTxFailure = isDeliverTxFailure; +function isDeliverTxSuccess(result) { + return !isDeliverTxFailure(result); +} +exports.isDeliverTxSuccess = isDeliverTxSuccess; +/** + * Ensures the given result is a success. Throws a detailed error message otherwise. + */ +function assertIsDeliverTxSuccess(result) { + if (isDeliverTxFailure(result)) { + throw new Error(`Error when broadcasting tx ${result.transactionHash} at height ${result.height}. Code: ${result.code}; Raw log: ${result.rawLog}`); + } +} +exports.assertIsDeliverTxSuccess = assertIsDeliverTxSuccess; +/** + * Ensures the given result is a failure. Throws a detailed error message otherwise. + */ +function assertIsDeliverTxFailure(result) { + if (isDeliverTxSuccess(result)) { + throw new Error(`Transaction ${result.transactionHash} did not fail at height ${result.height}. Code: ${result.code}; Raw log: ${result.rawLog}`); + } +} +exports.assertIsDeliverTxFailure = assertIsDeliverTxFailure; +/** + * An error when broadcasting the transaction. This contains the CheckTx errors + * from the blockchain. Once a transaction is included in a block no BroadcastTxError + * is thrown, even if the execution fails (DeliverTx errors). + */ +class BroadcastTxError extends Error { + constructor(code, codespace, log) { + super(`Broadcasting transaction failed with code ${code} (codespace: ${codespace}). Log: ${log}`); + this.code = code; + this.codespace = codespace; + this.log = log; + } +} +exports.BroadcastTxError = BroadcastTxError; +class StargateClient { + constructor(tmClient, options) { + if (tmClient) { + this.tmClient = tmClient; + this.queryClient = queryclient_1.QueryClient.withExtensions(tmClient, modules_1.setupAuthExtension, modules_1.setupBankExtension, modules_1.setupStakingExtension, modules_1.setupTxExtension); + } + const { accountParser = accounts_1.accountFromAny } = options; + this.accountParser = accountParser; + } + /** + * Creates an instance by connecting to the given Tendermint RPC endpoint. + * + * For now this uses the Tendermint 0.34 client. If you need Tendermint 0.37 + * support, see `create`. + */ + static async connect(endpoint, options = {}) { + const tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint); + return StargateClient.create(tmClient, options); + } + /** + * Creates an instance from a manually created Tendermint client. + * Use this to use `Tendermint37Client` instead of `Tendermint34Client`. + */ + static async create(tmClient, options = {}) { + return new StargateClient(tmClient, options); + } + getTmClient() { + return this.tmClient; + } + forceGetTmClient() { + if (!this.tmClient) { + throw new Error("Tendermint client not available. You cannot use online functionality in offline mode."); + } + return this.tmClient; + } + getQueryClient() { + return this.queryClient; + } + forceGetQueryClient() { + if (!this.queryClient) { + throw new Error("Query client not available. You cannot use online functionality in offline mode."); + } + return this.queryClient; + } + async getChainId() { + if (!this.chainId) { + const response = await this.forceGetTmClient().status(); + const chainId = response.nodeInfo.network; + if (!chainId) + throw new Error("Chain ID must not be empty"); + this.chainId = chainId; + } + return this.chainId; + } + async getHeight() { + const status = await this.forceGetTmClient().status(); + return status.syncInfo.latestBlockHeight; + } + async getAccount(searchAddress) { + try { + const account = await this.forceGetQueryClient().auth.account(searchAddress); + return account ? this.accountParser(account) : null; + } + catch (error) { + if (/rpc error: code = NotFound/i.test(error.toString())) { + return null; + } + throw error; + } + } + async getSequence(address) { + const account = await this.getAccount(address); + if (!account) { + throw new Error(`Account '${address}' does not exist on chain. Send some tokens there before trying to query sequence.`); + } + return { + accountNumber: account.accountNumber, + sequence: account.sequence, + }; + } + async getBlock(height) { + const response = await this.forceGetTmClient().block(height); + return { + id: (0, encoding_1.toHex)(response.blockId.hash).toUpperCase(), + header: { + version: { + block: new math_1.Uint53(response.block.header.version.block).toString(), + app: new math_1.Uint53(response.block.header.version.app).toString(), + }, + height: response.block.header.height, + chainId: response.block.header.chainId, + time: (0, tendermint_rpc_1.toRfc3339WithNanoseconds)(response.block.header.time), + }, + txs: response.block.txs, + }; + } + async getBalance(address, searchDenom) { + return this.forceGetQueryClient().bank.balance(address, searchDenom); + } + /** + * Queries all balances for all denoms that belong to this address. + * + * Uses the grpc queries (which iterates over the store internally), and we cannot get + * proofs from such a method. + */ + async getAllBalances(address) { + return this.forceGetQueryClient().bank.allBalances(address); + } + async getBalanceStaked(address) { + const allDelegations = []; + let startAtKey = undefined; + do { + const { delegationResponses, pagination } = await this.forceGetQueryClient().staking.delegatorDelegations(address, startAtKey); + const loadedDelegations = delegationResponses || []; + allDelegations.push(...loadedDelegations); + startAtKey = pagination?.nextKey; + } while (startAtKey !== undefined && startAtKey.length !== 0); + const sumValues = allDelegations.reduce((previousValue, currentValue) => { + // Safe because field is set to non-nullable (https://github.com/cosmos/cosmos-sdk/blob/v0.45.3/proto/cosmos/staking/v1beta1/staking.proto#L295) + (0, utils_1.assert)(currentValue.balance); + return previousValue !== null ? (0, amino_1.addCoins)(previousValue, currentValue.balance) : currentValue.balance; + }, null); + return sumValues; + } + async getDelegation(delegatorAddress, validatorAddress) { + let delegatedAmount; + try { + delegatedAmount = (await this.forceGetQueryClient().staking.delegation(delegatorAddress, validatorAddress)).delegationResponse?.balance; + } + catch (e) { + if (e.toString().includes("key not found")) { + // ignore, `delegatedAmount` remains undefined + } + else { + throw e; + } + } + return delegatedAmount || null; + } + async getTx(id) { + const results = await this.txsQuery(`tx.hash='${id}'`); + return results[0] ?? null; + } + async searchTx(query, filter = {}) { + const minHeight = filter.minHeight || 0; + const maxHeight = filter.maxHeight || Number.MAX_SAFE_INTEGER; + if (maxHeight < minHeight) + return []; // optional optimization + function withFilters(originalQuery) { + return `${originalQuery} AND tx.height>=${minHeight} AND tx.height<=${maxHeight}`; + } + let txs; + if ((0, search_1.isSearchByHeightQuery)(query)) { + txs = + query.height >= minHeight && query.height <= maxHeight + ? await this.txsQuery(`tx.height=${query.height}`) + : []; + } + else if ((0, search_1.isSearchBySentFromOrToQuery)(query)) { + const sentQuery = withFilters(`message.module='bank' AND transfer.sender='${query.sentFromOrTo}'`); + const receivedQuery = withFilters(`message.module='bank' AND transfer.recipient='${query.sentFromOrTo}'`); + const [sent, received] = await Promise.all([sentQuery, receivedQuery].map((rawQuery) => this.txsQuery(rawQuery))); + const sentHashes = sent.map((t) => t.hash); + txs = [...sent, ...received.filter((t) => !sentHashes.includes(t.hash))]; + } + else if ((0, search_1.isSearchByTagsQuery)(query)) { + const rawQuery = withFilters(query.tags.map((t) => `${t.key}='${t.value}'`).join(" AND ")); + txs = await this.txsQuery(rawQuery); + } + else { + throw new Error("Unknown query type"); + } + const filtered = txs.filter((tx) => tx.height >= minHeight && tx.height <= maxHeight); + return filtered; + } + disconnect() { + if (this.tmClient) + this.tmClient.disconnect(); + } + /** + * Broadcasts a signed transaction to the network and monitors its inclusion in a block. + * + * If broadcasting is rejected by the node for some reason (e.g. because of a CheckTx failure), + * an error is thrown. + * + * If the transaction is not included in a block before the provided timeout, this errors with a `TimeoutError`. + * + * If the transaction is included in a block, a `DeliverTxResponse` is returned. The caller then + * usually needs to check for execution success or failure. + */ + async broadcastTx(tx, timeoutMs = 60000, pollIntervalMs = 3000) { + let timedOut = false; + const txPollTimeout = setTimeout(() => { + timedOut = true; + }, timeoutMs); + const pollForTx = async (txId) => { + if (timedOut) { + throw new TimeoutError(`Transaction with ID ${txId} was submitted but was not yet found on the chain. You might want to check later. There was a wait of ${timeoutMs / 1000} seconds.`, txId); + } + await (0, utils_1.sleep)(pollIntervalMs); + const result = await this.getTx(txId); + return result + ? { + code: result.code, + height: result.height, + txIndex: result.txIndex, + events: result.events, + rawLog: result.rawLog, + transactionHash: txId, + gasUsed: result.gasUsed, + gasWanted: result.gasWanted, + } + : pollForTx(txId); + }; + const broadcasted = await this.forceGetTmClient().broadcastTxSync({ tx }); + if (broadcasted.code) { + return Promise.reject(new BroadcastTxError(broadcasted.code, broadcasted.codespace ?? "", broadcasted.log)); + } + const transactionId = (0, encoding_1.toHex)(broadcasted.hash).toUpperCase(); + return new Promise((resolve, reject) => pollForTx(transactionId).then((value) => { + clearTimeout(txPollTimeout); + resolve(value); + }, (error) => { + clearTimeout(txPollTimeout); + reject(error); + })); + } + async txsQuery(query) { + const results = await this.forceGetTmClient().txSearchAll({ query: query }); + return results.txs.map((tx) => { + return { + height: tx.height, + txIndex: tx.index, + hash: (0, encoding_1.toHex)(tx.hash).toUpperCase(), + code: tx.result.code, + events: tx.result.events.map(events_1.fromTendermintEvent), + rawLog: tx.result.log || "", + tx: tx.tx, + gasUsed: tx.result.gasUsed, + gasWanted: tx.result.gasWanted, + }; + }); + } +} +exports.StargateClient = StargateClient; +//# sourceMappingURL=stargateclient.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/ascii.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/ascii.js ***! + \************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromAscii = exports.toAscii = void 0; +function toAscii(input) { + const toNums = (str) => str.split("").map((x) => { + const charCode = x.charCodeAt(0); + // 0x00–0x1F control characters + // 0x20–0x7E printable characters + // 0x7F delete character + // 0x80–0xFF out of 7 bit ascii range + if (charCode < 0x20 || charCode > 0x7e) { + throw new Error("Cannot encode character that is out of printable ASCII range: " + charCode); + } + return charCode; + }); + return Uint8Array.from(toNums(input)); +} +exports.toAscii = toAscii; +function fromAscii(data) { + const fromNums = (listOfNumbers) => listOfNumbers.map((x) => { + // 0x00–0x1F control characters + // 0x20–0x7E printable characters + // 0x7F delete character + // 0x80–0xFF out of 7 bit ascii range + if (x < 0x20 || x > 0x7e) { + throw new Error("Cannot decode character that is out of printable ASCII range: " + x); + } + return String.fromCharCode(x); + }); + return fromNums(Array.from(data)).join(""); +} +exports.fromAscii = fromAscii; +//# sourceMappingURL=ascii.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/base64.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/base64.js ***! + \*************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromBase64 = exports.toBase64 = void 0; +const base64js = __importStar(__webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")); +function toBase64(data) { + return base64js.fromByteArray(data); +} +exports.toBase64 = toBase64; +function fromBase64(base64String) { + if (!base64String.match(/^[a-zA-Z0-9+/]*={0,2}$/)) { + throw new Error("Invalid base64 string format"); + } + return base64js.toByteArray(base64String); +} +exports.fromBase64 = fromBase64; +//# sourceMappingURL=base64.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/bech32.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/bech32.js ***! + \*************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.normalizeBech32 = exports.fromBech32 = exports.toBech32 = void 0; +const bech32 = __importStar(__webpack_require__(/*! bech32 */ "./node_modules/bech32/index.js")); +function toBech32(prefix, data, limit) { + const address = bech32.encode(prefix, bech32.toWords(data), limit); + return address; +} +exports.toBech32 = toBech32; +function fromBech32(address, limit = Infinity) { + const decodedAddress = bech32.decode(address, limit); + return { + prefix: decodedAddress.prefix, + data: new Uint8Array(bech32.fromWords(decodedAddress.words)), + }; +} +exports.fromBech32 = fromBech32; +/** + * Takes a bech32 address and returns a normalized (i.e. lower case) representation of it. + * + * The input is validated along the way, which makes this significantly safer than + * using `address.toLowerCase()`. + */ +function normalizeBech32(address) { + const { prefix, data } = fromBech32(address); + return toBech32(prefix, data); +} +exports.normalizeBech32 = normalizeBech32; +//# sourceMappingURL=bech32.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/hex.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/hex.js ***! + \**********************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromHex = exports.toHex = void 0; +function toHex(data) { + let out = ""; + for (const byte of data) { + out += ("0" + byte.toString(16)).slice(-2); + } + return out; +} +exports.toHex = toHex; +function fromHex(hexstring) { + if (hexstring.length % 2 !== 0) { + throw new Error("hex string length must be a multiple of 2"); + } + const out = new Uint8Array(hexstring.length / 2); + for (let i = 0; i < out.length; i++) { + const j = 2 * i; + const hexByteAsString = hexstring.slice(j, j + 2); + if (!hexByteAsString.match(/[0-9a-f]{2}/i)) { + throw new Error("hex string contains invalid characters"); + } + out[i] = parseInt(hexByteAsString, 16); + } + return out; +} +exports.fromHex = fromHex; +//# sourceMappingURL=hex.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/index.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/index.js ***! + \************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toUtf8 = exports.fromUtf8 = exports.toRfc3339 = exports.fromRfc3339 = exports.toHex = exports.fromHex = exports.toBech32 = exports.normalizeBech32 = exports.fromBech32 = exports.toBase64 = exports.fromBase64 = exports.toAscii = exports.fromAscii = void 0; +var ascii_1 = __webpack_require__(/*! ./ascii */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/ascii.js"); +Object.defineProperty(exports, "fromAscii", ({ enumerable: true, get: function () { return ascii_1.fromAscii; } })); +Object.defineProperty(exports, "toAscii", ({ enumerable: true, get: function () { return ascii_1.toAscii; } })); +var base64_1 = __webpack_require__(/*! ./base64 */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/base64.js"); +Object.defineProperty(exports, "fromBase64", ({ enumerable: true, get: function () { return base64_1.fromBase64; } })); +Object.defineProperty(exports, "toBase64", ({ enumerable: true, get: function () { return base64_1.toBase64; } })); +var bech32_1 = __webpack_require__(/*! ./bech32 */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/bech32.js"); +Object.defineProperty(exports, "fromBech32", ({ enumerable: true, get: function () { return bech32_1.fromBech32; } })); +Object.defineProperty(exports, "normalizeBech32", ({ enumerable: true, get: function () { return bech32_1.normalizeBech32; } })); +Object.defineProperty(exports, "toBech32", ({ enumerable: true, get: function () { return bech32_1.toBech32; } })); +var hex_1 = __webpack_require__(/*! ./hex */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/hex.js"); +Object.defineProperty(exports, "fromHex", ({ enumerable: true, get: function () { return hex_1.fromHex; } })); +Object.defineProperty(exports, "toHex", ({ enumerable: true, get: function () { return hex_1.toHex; } })); +var rfc3339_1 = __webpack_require__(/*! ./rfc3339 */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/rfc3339.js"); +Object.defineProperty(exports, "fromRfc3339", ({ enumerable: true, get: function () { return rfc3339_1.fromRfc3339; } })); +Object.defineProperty(exports, "toRfc3339", ({ enumerable: true, get: function () { return rfc3339_1.toRfc3339; } })); +var utf8_1 = __webpack_require__(/*! ./utf8 */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/utf8.js"); +Object.defineProperty(exports, "fromUtf8", ({ enumerable: true, get: function () { return utf8_1.fromUtf8; } })); +Object.defineProperty(exports, "toUtf8", ({ enumerable: true, get: function () { return utf8_1.toUtf8; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/rfc3339.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/rfc3339.js ***! + \**************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toRfc3339 = exports.fromRfc3339 = void 0; +const rfc3339Matcher = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?((?:[+-]\d{2}:\d{2})|Z)$/; +function padded(integer, length = 2) { + return integer.toString().padStart(length, "0"); +} +function fromRfc3339(str) { + const matches = rfc3339Matcher.exec(str); + if (!matches) { + throw new Error("Date string is not in RFC3339 format"); + } + const year = +matches[1]; + const month = +matches[2]; + const day = +matches[3]; + const hour = +matches[4]; + const minute = +matches[5]; + const second = +matches[6]; + // fractional seconds match either undefined or a string like ".1", ".123456789" + const milliSeconds = matches[7] ? Math.floor(+matches[7] * 1000) : 0; + let tzOffsetSign; + let tzOffsetHours; + let tzOffsetMinutes; + // if timezone is undefined, it must be Z or nothing (otherwise the group would have captured). + if (matches[8] === "Z") { + tzOffsetSign = 1; + tzOffsetHours = 0; + tzOffsetMinutes = 0; + } + else { + tzOffsetSign = matches[8].substring(0, 1) === "-" ? -1 : 1; + tzOffsetHours = +matches[8].substring(1, 3); + tzOffsetMinutes = +matches[8].substring(4, 6); + } + const tzOffset = tzOffsetSign * (tzOffsetHours * 60 + tzOffsetMinutes) * 60; // seconds + const timestamp = Date.UTC(year, month - 1, day, hour, minute, second, milliSeconds) - tzOffset * 1000; + return new Date(timestamp); +} +exports.fromRfc3339 = fromRfc3339; +function toRfc3339(date) { + const year = date.getUTCFullYear(); + const month = padded(date.getUTCMonth() + 1); + const day = padded(date.getUTCDate()); + const hour = padded(date.getUTCHours()); + const minute = padded(date.getUTCMinutes()); + const second = padded(date.getUTCSeconds()); + const ms = padded(date.getUTCMilliseconds(), 3); + return `${year}-${month}-${day}T${hour}:${minute}:${second}.${ms}Z`; +} +exports.toRfc3339 = toRfc3339; +//# sourceMappingURL=rfc3339.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/utf8.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/encoding/build/utf8.js ***! + \***********************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromUtf8 = exports.toUtf8 = void 0; +function toUtf8(str) { + return new TextEncoder().encode(str); +} +exports.toUtf8 = toUtf8; +/** + * Takes UTF-8 data and decodes it to a string. + * + * In lossy mode, the replacement character � is used to substitude invalid + * encodings. By default lossy mode is off and invalid data will lead to exceptions. + */ +function fromUtf8(data, lossy = false) { + const fatal = !lossy; + return new TextDecoder("utf-8", { fatal }).decode(data); +} +exports.fromUtf8 = fromUtf8; +//# sourceMappingURL=utf8.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/decimal.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/decimal.js ***! + \**********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Decimal = void 0; +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +// Too large values lead to massive memory usage. Limit to something sensible. +// The largest value we need is 18 (Ether). +const maxFractionalDigits = 100; +/** + * A type for arbitrary precision, non-negative decimals. + * + * Instances of this class are immutable. + */ +class Decimal { + constructor(atomics, fractionalDigits) { + if (!atomics.match(/^[0-9]+$/)) { + throw new Error("Invalid string format. Only non-negative integers in decimal representation supported."); + } + this.data = { + atomics: new bn_js_1.default(atomics), + fractionalDigits: fractionalDigits, + }; + } + static fromUserInput(input, fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + const badCharacter = input.match(/[^0-9.]/); + if (badCharacter) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + throw new Error(`Invalid character at position ${badCharacter.index + 1}`); + } + let whole; + let fractional; + if (input === "") { + whole = "0"; + fractional = ""; + } + else if (input.search(/\./) === -1) { + // integer format, no separator + whole = input; + fractional = ""; + } + else { + const parts = input.split("."); + switch (parts.length) { + case 0: + case 1: + throw new Error("Fewer than two elements in split result. This must not happen here."); + case 2: + if (!parts[1]) + throw new Error("Fractional part missing"); + whole = parts[0]; + fractional = parts[1].replace(/0+$/, ""); + break; + default: + throw new Error("More than one separator found"); + } + } + if (fractional.length > fractionalDigits) { + throw new Error("Got more fractional digits than supported"); + } + const quantity = `${whole}${fractional.padEnd(fractionalDigits, "0")}`; + return new Decimal(quantity, fractionalDigits); + } + static fromAtomics(atomics, fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal(atomics, fractionalDigits); + } + /** + * Creates a Decimal with value 0.0 and the given number of fractial digits. + * + * Fractional digits are not relevant for the value but needed to be able + * to perform arithmetic operations with other decimals. + */ + static zero(fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal("0", fractionalDigits); + } + /** + * Creates a Decimal with value 1.0 and the given number of fractial digits. + * + * Fractional digits are not relevant for the value but needed to be able + * to perform arithmetic operations with other decimals. + */ + static one(fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal("1" + "0".repeat(fractionalDigits), fractionalDigits); + } + static verifyFractionalDigits(fractionalDigits) { + if (!Number.isInteger(fractionalDigits)) + throw new Error("Fractional digits is not an integer"); + if (fractionalDigits < 0) + throw new Error("Fractional digits must not be negative"); + if (fractionalDigits > maxFractionalDigits) { + throw new Error(`Fractional digits must not exceed ${maxFractionalDigits}`); + } + } + static compare(a, b) { + if (a.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + return a.data.atomics.cmp(new bn_js_1.default(b.atomics)); + } + get atomics() { + return this.data.atomics.toString(); + } + get fractionalDigits() { + return this.data.fractionalDigits; + } + /** Creates a new instance with the same value */ + clone() { + return new Decimal(this.atomics, this.fractionalDigits); + } + /** Returns the greatest decimal <= this which has no fractional part (rounding down) */ + floor() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return this.clone(); + } + else { + return Decimal.fromAtomics(whole.mul(factor).toString(), this.fractionalDigits); + } + } + /** Returns the smallest decimal >= this which has no fractional part (rounding up) */ + ceil() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return this.clone(); + } + else { + return Decimal.fromAtomics(whole.addn(1).mul(factor).toString(), this.fractionalDigits); + } + } + toString() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return whole.toString(); + } + else { + const fullFractionalPart = fractional.toString().padStart(this.data.fractionalDigits, "0"); + const trimmedFractionalPart = fullFractionalPart.replace(/0+$/, ""); + return `${whole.toString()}.${trimmedFractionalPart}`; + } + } + /** + * Returns an approximation as a float type. Only use this if no + * exact calculation is required. + */ + toFloatApproximation() { + const out = Number(this.toString()); + if (Number.isNaN(out)) + throw new Error("Conversion to number failed"); + return out; + } + /** + * a.plus(b) returns a+b. + * + * Both values need to have the same fractional digits. + */ + plus(b) { + if (this.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + const sum = this.data.atomics.add(new bn_js_1.default(b.atomics)); + return new Decimal(sum.toString(), this.fractionalDigits); + } + /** + * a.minus(b) returns a-b. + * + * Both values need to have the same fractional digits. + * The resulting difference needs to be non-negative. + */ + minus(b) { + if (this.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + const difference = this.data.atomics.sub(new bn_js_1.default(b.atomics)); + if (difference.ltn(0)) + throw new Error("Difference must not be negative"); + return new Decimal(difference.toString(), this.fractionalDigits); + } + /** + * a.multiply(b) returns a*b. + * + * We only allow multiplication by unsigned integers to avoid rounding errors. + */ + multiply(b) { + const product = this.data.atomics.mul(new bn_js_1.default(b.toString())); + return new Decimal(product.toString(), this.fractionalDigits); + } + equals(b) { + return Decimal.compare(this, b) === 0; + } + isLessThan(b) { + return Decimal.compare(this, b) < 0; + } + isLessThanOrEqual(b) { + return Decimal.compare(this, b) <= 0; + } + isGreaterThan(b) { + return Decimal.compare(this, b) > 0; + } + isGreaterThanOrEqual(b) { + return Decimal.compare(this, b) >= 0; + } +} +exports.Decimal = Decimal; +//# sourceMappingURL=decimal.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/index.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/index.js ***! + \********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Uint64 = exports.Uint53 = exports.Uint32 = exports.Int53 = exports.Decimal = void 0; +var decimal_1 = __webpack_require__(/*! ./decimal */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/decimal.js"); +Object.defineProperty(exports, "Decimal", ({ enumerable: true, get: function () { return decimal_1.Decimal; } })); +var integers_1 = __webpack_require__(/*! ./integers */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/integers.js"); +Object.defineProperty(exports, "Int53", ({ enumerable: true, get: function () { return integers_1.Int53; } })); +Object.defineProperty(exports, "Uint32", ({ enumerable: true, get: function () { return integers_1.Uint32; } })); +Object.defineProperty(exports, "Uint53", ({ enumerable: true, get: function () { return integers_1.Uint53; } })); +Object.defineProperty(exports, "Uint64", ({ enumerable: true, get: function () { return integers_1.Uint64; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/integers.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/math/build/integers.js ***! + \***********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Uint64 = exports.Uint53 = exports.Int53 = exports.Uint32 = void 0; +/* eslint-disable no-bitwise */ +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +const uint64MaxValue = new bn_js_1.default("18446744073709551615", 10, "be"); +class Uint32 { + constructor(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + if (input < 0 || input > 4294967295) { + throw new Error("Input not in uint32 range: " + input.toString()); + } + this.data = input; + } + /** @deprecated use Uint32.fromBytes */ + static fromBigEndianBytes(bytes) { + return Uint32.fromBytes(bytes); + } + /** + * Creates a Uint32 from a fixed length byte array. + * + * @param bytes a list of exactly 4 bytes + * @param endianess defaults to big endian + */ + static fromBytes(bytes, endianess = "be") { + if (bytes.length !== 4) { + throw new Error("Invalid input length. Expected 4 bytes."); + } + for (let i = 0; i < bytes.length; ++i) { + if (!Number.isInteger(bytes[i]) || bytes[i] > 255 || bytes[i] < 0) { + throw new Error("Invalid value in byte. Found: " + bytes[i]); + } + } + const beBytes = endianess === "be" ? bytes : Array.from(bytes).reverse(); + // Use mulitiplication instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint32(beBytes[0] * 2 ** 24 + beBytes[1] * 2 ** 16 + beBytes[2] * 2 ** 8 + beBytes[3]); + } + static fromString(str) { + if (!str.match(/^[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Uint32(Number.parseInt(str, 10)); + } + toBytesBigEndian() { + // Use division instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint8Array([ + Math.floor(this.data / 2 ** 24) & 0xff, + Math.floor(this.data / 2 ** 16) & 0xff, + Math.floor(this.data / 2 ** 8) & 0xff, + Math.floor(this.data / 2 ** 0) & 0xff, + ]); + } + toBytesLittleEndian() { + // Use division instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint8Array([ + Math.floor(this.data / 2 ** 0) & 0xff, + Math.floor(this.data / 2 ** 8) & 0xff, + Math.floor(this.data / 2 ** 16) & 0xff, + Math.floor(this.data / 2 ** 24) & 0xff, + ]); + } + toNumber() { + return this.data; + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Uint32 = Uint32; +class Int53 { + constructor(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + if (input < Number.MIN_SAFE_INTEGER || input > Number.MAX_SAFE_INTEGER) { + throw new Error("Input not in int53 range: " + input.toString()); + } + this.data = input; + } + static fromString(str) { + if (!str.match(/^-?[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Int53(Number.parseInt(str, 10)); + } + toNumber() { + return this.data; + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Int53 = Int53; +class Uint53 { + constructor(input) { + const signed = new Int53(input); + if (signed.toNumber() < 0) { + throw new Error("Input is negative"); + } + this.data = signed; + } + static fromString(str) { + const signed = Int53.fromString(str); + return new Uint53(signed.toNumber()); + } + toNumber() { + return this.data.toNumber(); + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Uint53 = Uint53; +class Uint64 { + constructor(data) { + if (data.isNeg()) { + throw new Error("Input is negative"); + } + if (data.gt(uint64MaxValue)) { + throw new Error("Input exceeds uint64 range"); + } + this.data = data; + } + /** @deprecated use Uint64.fromBytes */ + static fromBytesBigEndian(bytes) { + return Uint64.fromBytes(bytes); + } + /** + * Creates a Uint64 from a fixed length byte array. + * + * @param bytes a list of exactly 8 bytes + * @param endianess defaults to big endian + */ + static fromBytes(bytes, endianess = "be") { + if (bytes.length !== 8) { + throw new Error("Invalid input length. Expected 8 bytes."); + } + for (let i = 0; i < bytes.length; ++i) { + if (!Number.isInteger(bytes[i]) || bytes[i] > 255 || bytes[i] < 0) { + throw new Error("Invalid value in byte. Found: " + bytes[i]); + } + } + const beBytes = endianess === "be" ? Array.from(bytes) : Array.from(bytes).reverse(); + return new Uint64(new bn_js_1.default(beBytes)); + } + static fromString(str) { + if (!str.match(/^[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Uint64(new bn_js_1.default(str, 10, "be")); + } + static fromNumber(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + let bigint; + try { + bigint = new bn_js_1.default(input); + } + catch { + throw new Error("Input is not a safe integer"); + } + return new Uint64(bigint); + } + toBytesBigEndian() { + return Uint8Array.from(this.data.toArray("be", 8)); + } + toBytesLittleEndian() { + return Uint8Array.from(this.data.toArray("le", 8)); + } + toString() { + return this.data.toString(10); + } + toBigInt() { + return BigInt(this.toString()); + } + toNumber() { + return this.data.toNumber(); + } +} +exports.Uint64 = Uint64; +// Assign classes to unused variables in order to verify static interface conformance at compile time. +// Workaround for https://github.com/microsoft/TypeScript/issues/33892 +const _int53Class = Int53; +const _uint53Class = Uint53; +const _uint32Class = Uint32; +const _uint64Class = Uint64; +//# sourceMappingURL=integers.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/concat.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/concat.js ***! + \***********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.concat = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +/** + * An implementation of concat that buffers all source stream events + * + * Marble diagram: + * + * ```text + * --1--2---3---4-| + * -a--b-c--d-| + * --------X---------Y---------Z- + * concat + * --1--2---3---4-abcdXY-------Z- + * ``` + * + * This is inspired by RxJS's concat as documented at http://rxmarbles.com/#concat and behaves + * differently than xstream's concat as discussed in https://github.com/staltz/xstream/issues/170. + * + */ +function concat(...streams) { + const subscriptions = new Array(); + const queues = new Array(); // one queue per stream + const completedStreams = new Set(); + let activeStreamIndex = 0; + function reset() { + while (subscriptions.length > 0) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const subscription = subscriptions.shift(); + subscription.unsubscribe(); + } + queues.length = 0; + completedStreams.clear(); + activeStreamIndex = 0; + } + const producer = { + start: (listener) => { + streams.forEach((_) => queues.push([])); + function emitAllQueuesEvents(streamIndex) { + // eslint-disable-next-line no-constant-condition + while (true) { + const element = queues[streamIndex].shift(); + if (element === undefined) { + return; + } + listener.next(element); + } + } + function isDone() { + return activeStreamIndex >= streams.length; + } + if (isDone()) { + listener.complete(); + return; + } + streams.forEach((stream, index) => { + subscriptions.push(stream.subscribe({ + next: (value) => { + if (index === activeStreamIndex) { + listener.next(value); + } + else { + queues[index].push(value); + } + }, + complete: () => { + completedStreams.add(index); + while (completedStreams.has(activeStreamIndex)) { + // this stream completed: emit all and move on + emitAllQueuesEvents(activeStreamIndex); + activeStreamIndex++; + } + if (isDone()) { + listener.complete(); + } + else { + // now active stream can have some events queued but did not yet complete + emitAllQueuesEvents(activeStreamIndex); + } + }, + error: (error) => { + listener.error(error); + reset(); + }, + })); + }); + }, + stop: () => { + reset(); + }, + }; + return xstream_1.Stream.create(producer); +} +exports.concat = concat; +//# sourceMappingURL=concat.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/defaultvalueproducer.js": +/*!*************************************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/defaultvalueproducer.js ***! + \*************************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DefaultValueProducer = void 0; +// allows pre-producing values before anyone is listening +class DefaultValueProducer { + constructor(value, callbacks) { + this.callbacks = callbacks; + this.internalValue = value; + } + get value() { + return this.internalValue; + } + /** + * Update the current value. + * + * If producer is active (i.e. someone is listening), this emits an event. + * If not, just the current value is updated. + */ + update(value) { + this.internalValue = value; + if (this.listener) { + this.listener.next(value); + } + } + /** + * Produce an error + */ + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + error(error) { + if (this.listener) { + this.listener.error(error); + } + } + /** + * Called by the stream. Do not call this directly. + */ + start(listener) { + this.listener = listener; + listener.next(this.internalValue); + if (this.callbacks) { + this.callbacks.onStarted(); + } + } + /** + * Called by the stream. Do not call this directly. + */ + stop() { + if (this.callbacks) { + this.callbacks.onStop(); + } + this.listener = undefined; + } +} +exports.DefaultValueProducer = DefaultValueProducer; +//# sourceMappingURL=defaultvalueproducer.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/dropduplicates.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/dropduplicates.js ***! + \*******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.dropDuplicates = void 0; +/** + * Drops duplicate values in a stream. + * + * Marble diagram: + * + * ```text + * -1-1-1-2-4-3-3-4-- + * dropDuplicates + * -1-----2-4-3------ + * ``` + * + * Each value must be uniquely identified by a string given by + * valueToKey(value). + * + * Internally this maintains a set of keys that have been processed already, + * i.e. memory consumption and Set lookup times should be considered when + * using this function. + */ +function dropDuplicates(valueToKey) { + const operand = (instream) => { + const emittedKeys = new Set(); + const deduplicatedStream = instream + .filter((value) => !emittedKeys.has(valueToKey(value))) + .debug((value) => emittedKeys.add(valueToKey(value))); + return deduplicatedStream; + }; + return operand; +} +exports.dropDuplicates = dropDuplicates; +//# sourceMappingURL=dropduplicates.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/index.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/index.js ***! + \**********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ValueAndUpdates = exports.toListPromise = exports.fromListPromise = exports.firstEvent = exports.dropDuplicates = exports.DefaultValueProducer = exports.concat = void 0; +var concat_1 = __webpack_require__(/*! ./concat */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/concat.js"); +Object.defineProperty(exports, "concat", ({ enumerable: true, get: function () { return concat_1.concat; } })); +var defaultvalueproducer_1 = __webpack_require__(/*! ./defaultvalueproducer */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/defaultvalueproducer.js"); +Object.defineProperty(exports, "DefaultValueProducer", ({ enumerable: true, get: function () { return defaultvalueproducer_1.DefaultValueProducer; } })); +var dropduplicates_1 = __webpack_require__(/*! ./dropduplicates */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/dropduplicates.js"); +Object.defineProperty(exports, "dropDuplicates", ({ enumerable: true, get: function () { return dropduplicates_1.dropDuplicates; } })); +var promise_1 = __webpack_require__(/*! ./promise */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/promise.js"); +Object.defineProperty(exports, "firstEvent", ({ enumerable: true, get: function () { return promise_1.firstEvent; } })); +Object.defineProperty(exports, "fromListPromise", ({ enumerable: true, get: function () { return promise_1.fromListPromise; } })); +Object.defineProperty(exports, "toListPromise", ({ enumerable: true, get: function () { return promise_1.toListPromise; } })); +__exportStar(__webpack_require__(/*! ./reducer */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/reducer.js"), exports); +var valueandupdates_1 = __webpack_require__(/*! ./valueandupdates */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/valueandupdates.js"); +Object.defineProperty(exports, "ValueAndUpdates", ({ enumerable: true, get: function () { return valueandupdates_1.ValueAndUpdates; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/promise.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/promise.js ***! + \************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.firstEvent = exports.toListPromise = exports.fromListPromise = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +/** + * Emits one event for each list element as soon as the promise resolves + */ +function fromListPromise(promise) { + const producer = { + start: (listener) => { + // the code in `start` runs as soon as anyone listens to the stream + promise + .then((iterable) => { + for (const element of iterable) { + listener.next(element); + } + listener.complete(); + }) + .catch((error) => listener.error(error)); + }, + // eslint-disable-next-line @typescript-eslint/no-empty-function + stop: () => { }, + }; + return xstream_1.Stream.create(producer); +} +exports.fromListPromise = fromListPromise; +/** + * Listens to stream and collects events. When `count` events are collected, + * the promise resolves with an array of events. + * + * Rejects if stream completes before `count` events are collected. + */ +async function toListPromise(stream, count) { + return new Promise((resolve, reject) => { + if (count === 0) { + resolve([]); + return; + } + const events = new Array(); + // take() unsubscribes from source stream automatically + stream.take(count).subscribe({ + next: (event) => { + events.push(event); + if (events.length === count) { + resolve(events); + } + }, + complete: () => { + reject(`Stream completed before all events could be collected. ` + + `Collected ${events.length}, expected ${count}`); + }, + error: (error) => reject(error), + }); + }); +} +exports.toListPromise = toListPromise; +/** + * Listens to stream, collects one event and revolves. + * + * Rejects if stream completes before one event was fired. + */ +async function firstEvent(stream) { + return (await toListPromise(stream, 1))[0]; +} +exports.firstEvent = firstEvent; +//# sourceMappingURL=promise.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/reducer.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/reducer.js ***! + \************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.lastValue = exports.asArray = exports.countStream = exports.Reducer = void 0; +// Reducer takes a stream of events T and a ReducerFunc, that +// materializes a state of type U. +class Reducer { + constructor(stream, reducer, initState) { + this.stream = stream; + this.reducer = reducer; + this.state = initState; + this.completed = new Promise((resolve, reject) => { + const subscription = this.stream.subscribe({ + next: (evt) => { + this.state = this.reducer(this.state, evt); + }, + complete: () => { + resolve(); + // this must happen after resolve, to ensure stream.subscribe() has finished + subscription.unsubscribe(); + }, + error: (err) => { + reject(err); + // the stream already closed on error, but unsubscribe to be safe + subscription.unsubscribe(); + }, + }); + }); + } + // value returns current materialized state + value() { + return this.state; + } + // finished resolves on completed stream, rejects on stream error + async finished() { + return this.completed; + } +} +exports.Reducer = Reducer; +function increment(sum, _) { + return sum + 1; +} +// countStream returns a reducer that contains current count +// of events on the stream +function countStream(stream) { + return new Reducer(stream, increment, 0); +} +exports.countStream = countStream; +function append(list, evt) { + return [...list, evt]; +} +// asArray maintains an array containing all events that have +// occurred on the stream +function asArray(stream) { + return new Reducer(stream, append, []); +} +exports.asArray = asArray; +function last(_, event) { + return event; +} +// lastValue returns the last value read from the stream, or undefined if no values sent +function lastValue(stream) { + return new Reducer(stream, last, undefined); +} +exports.lastValue = lastValue; +//# sourceMappingURL=reducer.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/valueandupdates.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/stream/build/valueandupdates.js ***! + \********************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ValueAndUpdates = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +/** + * A read only wrapper around DefaultValueProducer that allows + * to synchronously get the current value using the .value property + * and listen to to updates by suscribing to the .updates stream + */ +class ValueAndUpdates { + constructor(producer) { + this.producer = producer; + this.updates = xstream_1.MemoryStream.createWithMemory(this.producer); + } + get value() { + return this.producer.value; + } + /** + * Resolves as soon as search value is found. + * + * @param search either a value or a function that must return true when found + * @returns the value of the update that caused the search match + */ + async waitFor(search) { + const searchImplementation = typeof search === "function" ? search : (value) => value === search; + return new Promise((resolve, reject) => { + const subscription = this.updates.subscribe({ + next: (newValue) => { + if (searchImplementation(newValue)) { + resolve(newValue); + // MemoryStream.subscribe() calls next with the last value. + // Make async to ensure the subscription exists + setTimeout(() => subscription.unsubscribe(), 0); + } + }, + complete: () => { + subscription.unsubscribe(); + reject("Update stream completed without expected value"); + }, + error: (error) => { + reject(error); + }, + }); + }); + } +} +exports.ValueAndUpdates = ValueAndUpdates; +//# sourceMappingURL=valueandupdates.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/arrays.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/arrays.js ***! + \**********************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.arrayContentStartsWith = exports.arrayContentEquals = void 0; +/** + * Compares the content of two arrays-like objects for equality. + * + * Equality is defined as having equal length and element values, where element equality means `===` returning `true`. + * + * This allows you to compare the content of a Buffer, Uint8Array or number[], ignoring the specific type. + * As a consequence, this returns different results than Jasmine's `toEqual`, which ensures elements have the same type. + */ +function arrayContentEquals(a, b) { + if (a.length !== b.length) + return false; + for (let i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; +} +exports.arrayContentEquals = arrayContentEquals; +/** + * Checks if `a` starts with the contents of `b`. + * + * This requires equality of the element values, where element equality means `===` returning `true`. + * + * This allows you to compare the content of a Buffer, Uint8Array or number[], ignoring the specific type. + * As a consequence, this returns different results than Jasmine's `toEqual`, which ensures elements have the same type. + */ +function arrayContentStartsWith(a, b) { + if (a.length < b.length) + return false; + for (let i = 0; i < b.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; +} +exports.arrayContentStartsWith = arrayContentStartsWith; +//# sourceMappingURL=arrays.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/assert.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/assert.js ***! + \**********************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.assertDefinedAndNotNull = exports.assertDefined = exports.assert = void 0; +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function assert(condition, msg) { + if (!condition) { + throw new Error(msg || "condition is not truthy"); + } +} +exports.assert = assert; +function assertDefined(value, msg) { + if (value === undefined) { + throw new Error(msg ?? "value is undefined"); + } +} +exports.assertDefined = assertDefined; +function assertDefinedAndNotNull(value, msg) { + if (value === undefined || value === null) { + throw new Error(msg ?? "value is undefined or null"); + } +} +exports.assertDefinedAndNotNull = assertDefinedAndNotNull; +//# sourceMappingURL=assert.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/index.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/index.js ***! + \*********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isUint8Array = exports.isNonNullObject = exports.isDefined = exports.sleep = exports.assertDefinedAndNotNull = exports.assertDefined = exports.assert = exports.arrayContentStartsWith = exports.arrayContentEquals = void 0; +var arrays_1 = __webpack_require__(/*! ./arrays */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/arrays.js"); +Object.defineProperty(exports, "arrayContentEquals", ({ enumerable: true, get: function () { return arrays_1.arrayContentEquals; } })); +Object.defineProperty(exports, "arrayContentStartsWith", ({ enumerable: true, get: function () { return arrays_1.arrayContentStartsWith; } })); +var assert_1 = __webpack_require__(/*! ./assert */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/assert.js"); +Object.defineProperty(exports, "assert", ({ enumerable: true, get: function () { return assert_1.assert; } })); +Object.defineProperty(exports, "assertDefined", ({ enumerable: true, get: function () { return assert_1.assertDefined; } })); +Object.defineProperty(exports, "assertDefinedAndNotNull", ({ enumerable: true, get: function () { return assert_1.assertDefinedAndNotNull; } })); +var sleep_1 = __webpack_require__(/*! ./sleep */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/sleep.js"); +Object.defineProperty(exports, "sleep", ({ enumerable: true, get: function () { return sleep_1.sleep; } })); +var typechecks_1 = __webpack_require__(/*! ./typechecks */ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/typechecks.js"); +Object.defineProperty(exports, "isDefined", ({ enumerable: true, get: function () { return typechecks_1.isDefined; } })); +Object.defineProperty(exports, "isNonNullObject", ({ enumerable: true, get: function () { return typechecks_1.isNonNullObject; } })); +Object.defineProperty(exports, "isUint8Array", ({ enumerable: true, get: function () { return typechecks_1.isUint8Array; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/sleep.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/sleep.js ***! + \*********************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.sleep = void 0; +async function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} +exports.sleep = sleep; +//# sourceMappingURL=sleep.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/typechecks.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@cosmjs/stargate/node_modules/@cosmjs/utils/build/typechecks.js ***! + \**************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isDefined = exports.isUint8Array = exports.isNonNullObject = void 0; +/** + * Checks if data is a non-null object (i.e. matches the TypeScript object type). + * + * Note: this returns true for arrays, which are objects in JavaScript + * even though array and object are different types in JSON. + * + * @see https://www.typescriptlang.org/docs/handbook/basic-types.html#object + */ +// eslint-disable-next-line @typescript-eslint/ban-types +function isNonNullObject(data) { + return typeof data === "object" && data !== null; +} +exports.isNonNullObject = isNonNullObject; +/** + * Checks if data is an Uint8Array. Note: Buffer is treated as not a Uint8Array + */ +function isUint8Array(data) { + if (!isNonNullObject(data)) + return false; + // Avoid instanceof check which is unreliable in some JS environments + // https://medium.com/@simonwarta/limitations-of-the-instanceof-operator-f4bcdbe7a400 + // Use check that was discussed in https://github.com/crypto-browserify/pbkdf2/pull/81 + if (Object.prototype.toString.call(data) !== "[object Uint8Array]") + return false; + if (typeof Buffer !== "undefined" && typeof Buffer.isBuffer !== "undefined") { + // Buffer.isBuffer is available at runtime + if (Buffer.isBuffer(data)) + return false; + } + return true; +} +exports.isUint8Array = isUint8Array; +/** + * Checks if input is not undefined in a TypeScript-friendly way. + * + * This is convenient to use in e.g. `Array.filter` as it will convert + * the type of a `Array` to `Array`. + */ +function isDefined(value) { + return value !== undefined; +} +exports.isDefined = isDefined; +//# sourceMappingURL=typechecks.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/addresses.js": +/*!****************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/addresses.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pubkeyToAddress = exports.pubkeyToRawAddress = exports.rawSecp256k1PubkeyToRawAddress = exports.rawEd25519PubkeyToRawAddress = void 0; +const crypto_1 = __webpack_require__(/*! @cosmjs/crypto */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/index.js"); +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js"); +function rawEd25519PubkeyToRawAddress(pubkeyData) { + if (pubkeyData.length !== 32) { + throw new Error(`Invalid Ed25519 pubkey length: ${pubkeyData.length}`); + } + return (0, crypto_1.sha256)(pubkeyData).slice(0, 20); +} +exports.rawEd25519PubkeyToRawAddress = rawEd25519PubkeyToRawAddress; +function rawSecp256k1PubkeyToRawAddress(pubkeyData) { + if (pubkeyData.length !== 33) { + throw new Error(`Invalid Secp256k1 pubkey length (compressed): ${pubkeyData.length}`); + } + return (0, crypto_1.ripemd160)((0, crypto_1.sha256)(pubkeyData)); +} +exports.rawSecp256k1PubkeyToRawAddress = rawSecp256k1PubkeyToRawAddress; +/** + * Returns Tendermint address as bytes. + * + * This is for addresses that are derived by the Tendermint keypair (typically Ed25519). + * Sometimes those addresses are bech32-encoded and contain the term "cons" in the presix + * ("cosmosvalcons1..."). + * + * For secp256k1 this assumes we already have a compressed pubkey, which is the default in Cosmos. + */ +function pubkeyToRawAddress(type, data) { + switch (type) { + case "ed25519": + return rawEd25519PubkeyToRawAddress(data); + case "secp256k1": + return rawSecp256k1PubkeyToRawAddress(data); + default: + // Keep this case here to guard against new types being added but not handled + throw new Error(`Pubkey type ${type} not supported`); + } +} +exports.pubkeyToRawAddress = pubkeyToRawAddress; +/** + * Returns Tendermint address in uppercase hex format. + * + * This is for addresses that are derived by the Tendermint keypair (typically Ed25519). + * Sometimes those addresses are bech32-encoded and contain the term "cons" in the presix + * ("cosmosvalcons1..."). + * + * For secp256k1 this assumes we already have a compressed pubkey, which is the default in Cosmos. + */ +function pubkeyToAddress(type, data) { + return (0, encoding_1.toHex)(pubkeyToRawAddress(type, data)).toUpperCase(); +} +exports.pubkeyToAddress = pubkeyToAddress; +//# sourceMappingURL=addresses.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/dates.js": +/*!************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/dates.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DateTime = exports.toSeconds = exports.fromSeconds = exports.toRfc3339WithNanoseconds = exports.fromRfc3339WithNanoseconds = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js"); +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/math/build/index.js"); +function fromRfc3339WithNanoseconds(dateTimeString) { + const out = (0, encoding_1.fromRfc3339)(dateTimeString); + const nanosecondsMatch = dateTimeString.match(/\.(\d+)Z$/); + const nanoseconds = nanosecondsMatch ? nanosecondsMatch[1].slice(3) : ""; + out.nanoseconds = parseInt(nanoseconds.padEnd(6, "0"), 10); + return out; +} +exports.fromRfc3339WithNanoseconds = fromRfc3339WithNanoseconds; +function toRfc3339WithNanoseconds(dateTime) { + const millisecondIso = dateTime.toISOString(); + const nanoseconds = dateTime.nanoseconds?.toString() ?? ""; + return `${millisecondIso.slice(0, -1)}${nanoseconds.padStart(6, "0")}Z`; +} +exports.toRfc3339WithNanoseconds = toRfc3339WithNanoseconds; +function fromSeconds(seconds, nanos = 0) { + const checkedNanos = new math_1.Uint32(nanos).toNumber(); + if (checkedNanos > 999999999) { + throw new Error("Nano seconds must not exceed 999999999"); + } + const out = new Date(seconds * 1000 + Math.floor(checkedNanos / 1000000)); + out.nanoseconds = checkedNanos % 1000000; + return out; +} +exports.fromSeconds = fromSeconds; +/** + * Calculates the UNIX timestamp in seconds as well as the nanoseconds after the given second. + * + * This is useful when dealing with external systems like the protobuf type + * [.google.protobuf.Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp) + * or any other system that does not use millisecond precision. + */ +function toSeconds(date) { + return { + seconds: Math.floor(date.getTime() / 1000), + nanos: (date.getTime() % 1000) * 1000000 + (date.nanoseconds ?? 0), + }; +} +exports.toSeconds = toSeconds; +/** @deprecated Use fromRfc3339WithNanoseconds/toRfc3339WithNanoseconds instead */ +class DateTime { + /** @deprecated Use fromRfc3339WithNanoseconds instead */ + static decode(dateTimeString) { + return fromRfc3339WithNanoseconds(dateTimeString); + } + /** @deprecated Use toRfc3339WithNanoseconds instead */ + static encode(dateTime) { + return toRfc3339WithNanoseconds(dateTime); + } +} +exports.DateTime = DateTime; +//# sourceMappingURL=dates.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/index.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BlockIdFlag = exports.isTendermint37Client = exports.isTendermint34Client = exports.Tendermint37Client = exports.tendermint37 = exports.Tendermint34Client = exports.tendermint34 = exports.VoteType = exports.SubscriptionEventType = exports.Method = exports.broadcastTxSyncSuccess = exports.broadcastTxCommitSuccess = exports.WebsocketClient = exports.HttpClient = exports.HttpBatchClient = exports.toSeconds = exports.toRfc3339WithNanoseconds = exports.fromSeconds = exports.fromRfc3339WithNanoseconds = exports.DateTime = exports.rawSecp256k1PubkeyToRawAddress = exports.rawEd25519PubkeyToRawAddress = exports.pubkeyToRawAddress = exports.pubkeyToAddress = void 0; +var addresses_1 = __webpack_require__(/*! ./addresses */ "./node_modules/@cosmjs/tendermint-rpc/build/addresses.js"); +Object.defineProperty(exports, "pubkeyToAddress", ({ enumerable: true, get: function () { return addresses_1.pubkeyToAddress; } })); +Object.defineProperty(exports, "pubkeyToRawAddress", ({ enumerable: true, get: function () { return addresses_1.pubkeyToRawAddress; } })); +Object.defineProperty(exports, "rawEd25519PubkeyToRawAddress", ({ enumerable: true, get: function () { return addresses_1.rawEd25519PubkeyToRawAddress; } })); +Object.defineProperty(exports, "rawSecp256k1PubkeyToRawAddress", ({ enumerable: true, get: function () { return addresses_1.rawSecp256k1PubkeyToRawAddress; } })); +var dates_1 = __webpack_require__(/*! ./dates */ "./node_modules/@cosmjs/tendermint-rpc/build/dates.js"); +Object.defineProperty(exports, "DateTime", ({ enumerable: true, get: function () { return dates_1.DateTime; } })); +Object.defineProperty(exports, "fromRfc3339WithNanoseconds", ({ enumerable: true, get: function () { return dates_1.fromRfc3339WithNanoseconds; } })); +Object.defineProperty(exports, "fromSeconds", ({ enumerable: true, get: function () { return dates_1.fromSeconds; } })); +Object.defineProperty(exports, "toRfc3339WithNanoseconds", ({ enumerable: true, get: function () { return dates_1.toRfc3339WithNanoseconds; } })); +Object.defineProperty(exports, "toSeconds", ({ enumerable: true, get: function () { return dates_1.toSeconds; } })); +// The public Tendermint34Client.create constructor allows manually choosing an RpcClient. +// This is currently the only way to switch to the HttpBatchClient (which may become default at some point). +// Due to this API, we make RPC client implementations public. +var rpcclients_1 = __webpack_require__(/*! ./rpcclients */ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/index.js"); +Object.defineProperty(exports, "HttpBatchClient", ({ enumerable: true, get: function () { return rpcclients_1.HttpBatchClient; } })); +Object.defineProperty(exports, "HttpClient", ({ enumerable: true, get: function () { return rpcclients_1.HttpClient; } })); +Object.defineProperty(exports, "WebsocketClient", ({ enumerable: true, get: function () { return rpcclients_1.WebsocketClient; } })); +var tendermint34_1 = __webpack_require__(/*! ./tendermint34 */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/index.js"); +Object.defineProperty(exports, "broadcastTxCommitSuccess", ({ enumerable: true, get: function () { return tendermint34_1.broadcastTxCommitSuccess; } })); +Object.defineProperty(exports, "broadcastTxSyncSuccess", ({ enumerable: true, get: function () { return tendermint34_1.broadcastTxSyncSuccess; } })); +Object.defineProperty(exports, "Method", ({ enumerable: true, get: function () { return tendermint34_1.Method; } })); +Object.defineProperty(exports, "SubscriptionEventType", ({ enumerable: true, get: function () { return tendermint34_1.SubscriptionEventType; } })); +Object.defineProperty(exports, "VoteType", ({ enumerable: true, get: function () { return tendermint34_1.VoteType; } })); +exports.tendermint34 = __importStar(__webpack_require__(/*! ./tendermint34 */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/index.js")); +var tendermint34_2 = __webpack_require__(/*! ./tendermint34 */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/index.js"); +Object.defineProperty(exports, "Tendermint34Client", ({ enumerable: true, get: function () { return tendermint34_2.Tendermint34Client; } })); +exports.tendermint37 = __importStar(__webpack_require__(/*! ./tendermint37 */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/index.js")); +var tendermint37_1 = __webpack_require__(/*! ./tendermint37 */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/index.js"); +Object.defineProperty(exports, "Tendermint37Client", ({ enumerable: true, get: function () { return tendermint37_1.Tendermint37Client; } })); +var tendermintclient_1 = __webpack_require__(/*! ./tendermintclient */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermintclient.js"); +Object.defineProperty(exports, "isTendermint34Client", ({ enumerable: true, get: function () { return tendermintclient_1.isTendermint34Client; } })); +Object.defineProperty(exports, "isTendermint37Client", ({ enumerable: true, get: function () { return tendermintclient_1.isTendermint37Client; } })); +var types_1 = __webpack_require__(/*! ./types */ "./node_modules/@cosmjs/tendermint-rpc/build/types.js"); +Object.defineProperty(exports, "BlockIdFlag", ({ enumerable: true, get: function () { return types_1.BlockIdFlag; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/inthelpers.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/inthelpers.js ***! + \*****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.smallIntToApi = exports.apiToBigInt = exports.apiToSmallInt = void 0; +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/math/build/index.js"); +const encodings_1 = __webpack_require__(/*! ./tendermint34/encodings */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/encodings.js"); +/** + * Takes an integer value from the Tendermint RPC API and + * returns it as number. + * + * Only works within the safe integer range. + */ +function apiToSmallInt(input) { + const asInt = typeof input === "number" ? new math_1.Int53(input) : math_1.Int53.fromString(input); + return asInt.toNumber(); +} +exports.apiToSmallInt = apiToSmallInt; +/** + * Takes an integer value from the Tendermint RPC API and + * returns it as BigInt. + * + * This supports the full uint64 and int64 ranges. + */ +function apiToBigInt(input) { + (0, encodings_1.assertString)(input); // Runtime check on top of TypeScript just to be safe for semi-trusted API types + if (!input.match(/^-?[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return BigInt(input); +} +exports.apiToBigInt = apiToBigInt; +/** + * Takes an integer in the safe integer range and returns + * a string representation to be used in the Tendermint RPC API. + */ +function smallIntToApi(num) { + return new math_1.Int53(num).toString(); +} +exports.smallIntToApi = smallIntToApi; +//# sourceMappingURL=inthelpers.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/jsonrpc.js": +/*!**************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/jsonrpc.js ***! + \**************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createJsonRpcRequest = void 0; +const numbersWithoutZero = "123456789"; +/** generates a random numeric character */ +function randomNumericChar() { + return numbersWithoutZero[Math.floor(Math.random() * numbersWithoutZero.length)]; +} +/** + * An (absolutely not cryptographically secure) random integer > 0. + */ +function randomId() { + return parseInt(Array.from({ length: 12 }) + .map(() => randomNumericChar()) + .join(""), 10); +} +/** Creates a JSON-RPC request with random ID */ +// eslint-disable-next-line @typescript-eslint/ban-types +function createJsonRpcRequest(method, params) { + const paramsCopy = params ? { ...params } : {}; + return { + jsonrpc: "2.0", + id: randomId(), + method: method, + params: paramsCopy, + }; +} +exports.createJsonRpcRequest = createJsonRpcRequest; +//# sourceMappingURL=jsonrpc.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/http.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/http.js ***! + \**********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.http = void 0; +const axios_1 = __importDefault(__webpack_require__(/*! axios */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/index.js")); +function filterBadStatus(res) { + if (res.status >= 400) { + throw new Error(`Bad status on response: ${res.status}`); + } + return res; +} +/** + * Node.js 18 comes with exprimental fetch support (https://nodejs.org/de/blog/announcements/v18-release-announce/). + * This is nice, but the implementation does not yet work wekk for us. We + * can just stick with axios on those systems for now. + */ +// eslint-disable-next-line @typescript-eslint/ban-types +function isExperimental(nodeJsFunc) { + // This works because we get this info in node 18: + // + // > fetch.toString() + // 'async function fetch(input, init = undefined) {\n' + + // " emitExperimentalWarning('The Fetch API');\n" + + // ' return lazyUndici().fetch(input, init);\n' + + // ' }' + return nodeJsFunc.toString().includes("emitExperimentalWarning"); +} +/** + * Helper to work around missing CORS support in Tendermint (https://github.com/tendermint/tendermint/pull/2800) + * + * For some reason, fetch does not complain about missing server-side CORS support. + */ +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +async function http(method, url, headers, request) { + if (typeof fetch === "function" && !isExperimental(fetch)) { + const settings = { + method: method, + body: request ? JSON.stringify(request) : undefined, + headers: { + // eslint-disable-next-line @typescript-eslint/naming-convention + "Content-Type": "application/json", + ...headers, + }, + }; + return fetch(url, settings) + .then(filterBadStatus) + .then((res) => res.json()); + } + else { + return axios_1.default + .request({ url: url, method: method, data: request, headers: headers }) + .then((res) => res.data); + } +} +exports.http = http; +//# sourceMappingURL=http.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/httpbatchclient.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/httpbatchclient.js ***! + \*********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.HttpBatchClient = void 0; +const json_rpc_1 = __webpack_require__(/*! @cosmjs/json-rpc */ "./node_modules/@cosmjs/json-rpc/build/index.js"); +const http_1 = __webpack_require__(/*! ./http */ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/http.js"); +const rpcclient_1 = __webpack_require__(/*! ./rpcclient */ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/rpcclient.js"); +// Those values are private and can change any time. +// Does a user need to know them? I don't think so. You either set +// a custom value or leave the option field unset. +const defaultHttpBatchClientOptions = { + dispatchInterval: 20, + batchSizeLimit: 20, +}; +class HttpBatchClient { + constructor(endpoint, options = {}) { + this.queue = []; + this.options = { + batchSizeLimit: options.batchSizeLimit ?? defaultHttpBatchClientOptions.batchSizeLimit, + dispatchInterval: options.dispatchInterval ?? defaultHttpBatchClientOptions.dispatchInterval, + }; + if (typeof endpoint === "string") { + // accept host.name:port and assume http protocol + this.url = (0, rpcclient_1.hasProtocol)(endpoint) ? endpoint : "http://" + endpoint; + } + else { + this.url = endpoint.url; + this.headers = endpoint.headers; + } + this.timer = setInterval(() => this.tick(), options.dispatchInterval); + this.validate(); + } + disconnect() { + this.timer && clearInterval(this.timer); + this.timer = undefined; + } + async execute(request) { + return new Promise((resolve, reject) => { + this.queue.push({ request, resolve, reject }); + if (this.queue.length >= this.options.batchSizeLimit) { + // this train is full, let's go + this.tick(); + } + }); + } + validate() { + if (!this.options.batchSizeLimit || + !Number.isSafeInteger(this.options.batchSizeLimit) || + this.options.batchSizeLimit < 1) { + throw new Error("batchSizeLimit must be a safe integer >= 1"); + } + } + /** + * This is called in an interval where promise rejections cannot be handled. + * So this is not async and HTTP errors need to be handled by the queued promises. + */ + tick() { + // Avoid race conditions + const batch = this.queue.splice(0, this.options.batchSizeLimit); + if (!batch.length) + return; + const requests = batch.map((s) => s.request); + const requestIds = requests.map((request) => request.id); + (0, http_1.http)("POST", this.url, this.headers, requests).then((raw) => { + // Requests with a single entry return as an object + const arr = Array.isArray(raw) ? raw : [raw]; + arr.forEach((el) => { + const req = batch.find((s) => s.request.id === el.id); + if (!req) + return; + const { reject, resolve } = req; + const response = (0, json_rpc_1.parseJsonRpcResponse)(el); + if ((0, json_rpc_1.isJsonRpcErrorResponse)(response)) { + reject(new Error(JSON.stringify(response.error))); + } + else { + resolve(response); + } + }); + }, (error) => { + for (const requestId of requestIds) { + const req = batch.find((s) => s.request.id === requestId); + if (!req) + return; + req.reject(error); + } + }); + } +} +exports.HttpBatchClient = HttpBatchClient; +//# sourceMappingURL=httpbatchclient.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/httpclient.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/httpclient.js ***! + \****************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.HttpClient = void 0; +const json_rpc_1 = __webpack_require__(/*! @cosmjs/json-rpc */ "./node_modules/@cosmjs/json-rpc/build/index.js"); +const http_1 = __webpack_require__(/*! ./http */ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/http.js"); +const rpcclient_1 = __webpack_require__(/*! ./rpcclient */ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/rpcclient.js"); +class HttpClient { + constructor(endpoint) { + if (typeof endpoint === "string") { + // accept host.name:port and assume http protocol + this.url = (0, rpcclient_1.hasProtocol)(endpoint) ? endpoint : "http://" + endpoint; + } + else { + this.url = endpoint.url; + this.headers = endpoint.headers; + } + } + disconnect() { + // nothing to be done + } + async execute(request) { + const response = (0, json_rpc_1.parseJsonRpcResponse)(await (0, http_1.http)("POST", this.url, this.headers, request)); + if ((0, json_rpc_1.isJsonRpcErrorResponse)(response)) { + throw new Error(JSON.stringify(response.error)); + } + return response; + } +} +exports.HttpClient = HttpClient; +//# sourceMappingURL=httpclient.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/index.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/index.js ***! + \***********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +// This folder contains Tendermint-specific RPC clients +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.WebsocketClient = exports.instanceOfRpcStreamingClient = exports.HttpClient = exports.HttpBatchClient = void 0; +var httpbatchclient_1 = __webpack_require__(/*! ./httpbatchclient */ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/httpbatchclient.js"); +Object.defineProperty(exports, "HttpBatchClient", ({ enumerable: true, get: function () { return httpbatchclient_1.HttpBatchClient; } })); +var httpclient_1 = __webpack_require__(/*! ./httpclient */ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/httpclient.js"); +Object.defineProperty(exports, "HttpClient", ({ enumerable: true, get: function () { return httpclient_1.HttpClient; } })); +var rpcclient_1 = __webpack_require__(/*! ./rpcclient */ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/rpcclient.js"); +Object.defineProperty(exports, "instanceOfRpcStreamingClient", ({ enumerable: true, get: function () { return rpcclient_1.instanceOfRpcStreamingClient; } })); +var websocketclient_1 = __webpack_require__(/*! ./websocketclient */ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/websocketclient.js"); +Object.defineProperty(exports, "WebsocketClient", ({ enumerable: true, get: function () { return websocketclient_1.WebsocketClient; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/rpcclient.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/rpcclient.js ***! + \***************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.hasProtocol = exports.instanceOfRpcStreamingClient = void 0; +function instanceOfRpcStreamingClient(client) { + return typeof client.listen === "function"; +} +exports.instanceOfRpcStreamingClient = instanceOfRpcStreamingClient; +// Helpers for all RPC clients +function hasProtocol(url) { + return url.search("://") !== -1; +} +exports.hasProtocol = hasProtocol; +//# sourceMappingURL=rpcclient.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/websocketclient.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/websocketclient.js ***! + \*********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.WebsocketClient = void 0; +const json_rpc_1 = __webpack_require__(/*! @cosmjs/json-rpc */ "./node_modules/@cosmjs/json-rpc/build/index.js"); +const socket_1 = __webpack_require__(/*! @cosmjs/socket */ "./node_modules/@cosmjs/socket/build/index.js"); +const stream_1 = __webpack_require__(/*! @cosmjs/stream */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/index.js"); +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +const rpcclient_1 = __webpack_require__(/*! ./rpcclient */ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/rpcclient.js"); +function defaultErrorHandler(error) { + throw error; +} +function toJsonRpcResponse(message) { + // this should never happen, but I want an alert if it does + if (message.type !== "message") { + throw new Error(`Unexcepted message type on websocket: ${message.type}`); + } + const jsonRpcEvent = (0, json_rpc_1.parseJsonRpcResponse)(JSON.parse(message.data)); + return jsonRpcEvent; +} +class RpcEventProducer { + constructor(request, socket) { + this.running = false; + this.subscriptions = []; + this.request = request; + this.socket = socket; + } + /** + * Implementation of Producer.start + */ + start(listener) { + if (this.running) { + throw Error("Already started. Please stop first before restarting."); + } + this.running = true; + this.connectToClient(listener); + this.socket.queueRequest(JSON.stringify(this.request)); + } + /** + * Implementation of Producer.stop + * + * Called by the stream when the stream's last listener stopped listening + * or when the producer completed. + */ + stop() { + this.running = false; + // Tell the server we are done in order to save resources. We cannot wait for the result. + // This may fail when socket connection is not open, thus ignore errors in queueRequest + const endRequest = { ...this.request, method: "unsubscribe" }; + try { + this.socket.queueRequest(JSON.stringify(endRequest)); + } + catch (error) { + if (error instanceof Error && error.message.match(/socket has disconnected/i)) { + // ignore + } + else { + throw error; + } + } + } + connectToClient(listener) { + const responseStream = this.socket.events.map(toJsonRpcResponse); + // this should unsubscribe itself, so doesn't need to be removed explicitly + const idSubscription = responseStream + .filter((response) => response.id === this.request.id) + .subscribe({ + next: (response) => { + if ((0, json_rpc_1.isJsonRpcErrorResponse)(response)) { + this.closeSubscriptions(); + listener.error(JSON.stringify(response.error)); + } + idSubscription.unsubscribe(); + }, + }); + // this will fire on a response (success or error) + // Tendermint adds an "#event" suffix for events that follow a previous subscription + // https://github.com/tendermint/tendermint/blob/v0.23.0/rpc/core/events.go#L107 + const idEventSubscription = responseStream + .filter((response) => response.id === this.request.id) + .subscribe({ + next: (response) => { + if ((0, json_rpc_1.isJsonRpcErrorResponse)(response)) { + this.closeSubscriptions(); + listener.error(JSON.stringify(response.error)); + } + else { + listener.next(response.result); + } + }, + }); + // this will fire in case the websocket disconnects cleanly + const nonResponseSubscription = responseStream.subscribe({ + error: (error) => { + this.closeSubscriptions(); + listener.error(error); + }, + complete: () => { + this.closeSubscriptions(); + listener.complete(); + }, + }); + this.subscriptions.push(idSubscription, idEventSubscription, nonResponseSubscription); + } + closeSubscriptions() { + for (const subscription of this.subscriptions) { + subscription.unsubscribe(); + } + // clear unused subscriptions + this.subscriptions = []; + } +} +class WebsocketClient { + constructor(baseUrl, onError = defaultErrorHandler) { + // Lazily create streams and use the same stream when listening to the same query twice. + // + // Creating streams is cheap since producer is not started as long as nobody listens to events. Thus this + // map is never cleared and there is no need to do so. But unsubscribe all the subscriptions! + this.subscriptionStreams = new Map(); + // accept host.name:port and assume ws protocol + // make sure we don't end up with ...//websocket + const path = baseUrl.endsWith("/") ? "websocket" : "/websocket"; + const cleanBaseUrl = (0, rpcclient_1.hasProtocol)(baseUrl) ? baseUrl : "ws://" + baseUrl; + this.url = cleanBaseUrl + path; + this.socket = new socket_1.ReconnectingSocket(this.url); + const errorSubscription = this.socket.events.subscribe({ + error: (error) => { + onError(error); + errorSubscription.unsubscribe(); + }, + }); + this.jsonRpcResponseStream = this.socket.events.map(toJsonRpcResponse); + this.socket.connect(); + } + async execute(request) { + const pendingResponse = this.responseForRequestId(request.id); + this.socket.queueRequest(JSON.stringify(request)); + const response = await pendingResponse; + if ((0, json_rpc_1.isJsonRpcErrorResponse)(response)) { + throw new Error(JSON.stringify(response.error)); + } + return response; + } + listen(request) { + if (request.method !== "subscribe") { + throw new Error(`Request method must be "subscribe" to start event listening`); + } + const query = request.params.query; + if (typeof query !== "string") { + throw new Error("request.params.query must be a string"); + } + if (!this.subscriptionStreams.has(query)) { + const producer = new RpcEventProducer(request, this.socket); + const stream = xstream_1.Stream.create(producer); + this.subscriptionStreams.set(query, stream); + } + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return this.subscriptionStreams.get(query).filter((response) => response.query !== undefined); + } + /** + * Resolves as soon as websocket is connected. execute() queues requests automatically, + * so this should be required for testing purposes only. + */ + async connected() { + await this.socket.connectionStatus.waitFor(socket_1.ConnectionStatus.Connected); + } + disconnect() { + this.socket.disconnect(); + } + async responseForRequestId(id) { + return (0, stream_1.firstEvent)(this.jsonRpcResponseStream.filter((r) => r.id === id)); + } +} +exports.WebsocketClient = WebsocketClient; +//# sourceMappingURL=websocketclient.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/index.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/index.js ***! + \*********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.adaptor34 = void 0; +const hasher_1 = __webpack_require__(/*! ../hasher */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/hasher.js"); +const requests_1 = __webpack_require__(/*! ./requests */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/requests.js"); +const responses_1 = __webpack_require__(/*! ./responses */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js"); +exports.adaptor34 = { + params: requests_1.Params, + responses: responses_1.Responses, + hashTx: hasher_1.hashTx, + hashBlock: hasher_1.hashBlock, +}; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/requests.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/requests.js ***! + \************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Params = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js"); +const inthelpers_1 = __webpack_require__(/*! ../../inthelpers */ "./node_modules/@cosmjs/tendermint-rpc/build/inthelpers.js"); +const jsonrpc_1 = __webpack_require__(/*! ../../jsonrpc */ "./node_modules/@cosmjs/tendermint-rpc/build/jsonrpc.js"); +const encodings_1 = __webpack_require__(/*! ../encodings */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/encodings.js"); +const requests = __importStar(__webpack_require__(/*! ../requests */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/requests.js")); +function encodeHeightParam(param) { + return { + height: (0, encodings_1.may)(inthelpers_1.smallIntToApi, param.height), + }; +} +function encodeBlockchainRequestParams(param) { + return { + minHeight: (0, encodings_1.may)(inthelpers_1.smallIntToApi, param.minHeight), + maxHeight: (0, encodings_1.may)(inthelpers_1.smallIntToApi, param.maxHeight), + }; +} +function encodeBlockSearchParams(params) { + return { + query: params.query, + page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.page), + per_page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.per_page), + order_by: params.order_by, + }; +} +function encodeAbciQueryParams(params) { + return { + path: (0, encodings_1.assertNotEmpty)(params.path), + data: (0, encoding_1.toHex)(params.data), + height: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.height), + prove: params.prove, + }; +} +function encodeBroadcastTxParams(params) { + return { + tx: (0, encoding_1.toBase64)((0, encodings_1.assertNotEmpty)(params.tx)), + }; +} +function encodeTxParams(params) { + return { + hash: (0, encoding_1.toBase64)((0, encodings_1.assertNotEmpty)(params.hash)), + prove: params.prove, + }; +} +function encodeTxSearchParams(params) { + return { + query: params.query, + prove: params.prove, + page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.page), + per_page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.per_page), + order_by: params.order_by, + }; +} +function encodeValidatorsParams(params) { + return { + height: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.height), + page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.page), + per_page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.per_page), + }; +} +class Params { + static encodeAbciInfo(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method); + } + static encodeAbciQuery(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeAbciQueryParams(req.params)); + } + static encodeBlock(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeHeightParam(req.params)); + } + static encodeBlockchain(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeBlockchainRequestParams(req.params)); + } + static encodeBlockResults(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeHeightParam(req.params)); + } + static encodeBlockSearch(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeBlockSearchParams(req.params)); + } + static encodeBroadcastTx(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeBroadcastTxParams(req.params)); + } + static encodeCommit(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeHeightParam(req.params)); + } + static encodeGenesis(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method); + } + static encodeHealth(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method); + } + static encodeNumUnconfirmedTxs(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method); + } + static encodeStatus(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method); + } + static encodeSubscribe(req) { + const eventTag = { key: "tm.event", value: req.query.type }; + const query = requests.buildQuery({ tags: [eventTag], raw: req.query.raw }); + return (0, jsonrpc_1.createJsonRpcRequest)("subscribe", { query: query }); + } + static encodeTx(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeTxParams(req.params)); + } + // TODO: encode params for query string??? + static encodeTxSearch(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeTxSearchParams(req.params)); + } + static encodeValidators(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeValidatorsParams(req.params)); + } +} +exports.Params = Params; +//# sourceMappingURL=requests.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js ***! + \*************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Responses = exports.decodeValidatorInfo = exports.decodeValidatorGenesis = exports.decodeValidatorUpdate = exports.decodeEvent = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js"); +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/index.js"); +const dates_1 = __webpack_require__(/*! ../../dates */ "./node_modules/@cosmjs/tendermint-rpc/build/dates.js"); +const inthelpers_1 = __webpack_require__(/*! ../../inthelpers */ "./node_modules/@cosmjs/tendermint-rpc/build/inthelpers.js"); +const types_1 = __webpack_require__(/*! ../../types */ "./node_modules/@cosmjs/tendermint-rpc/build/types.js"); +const encodings_1 = __webpack_require__(/*! ../encodings */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/encodings.js"); +const hasher_1 = __webpack_require__(/*! ../hasher */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/hasher.js"); +function decodeAbciInfo(data) { + return { + data: data.data, + lastBlockHeight: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.last_block_height), + lastBlockAppHash: (0, encodings_1.may)(encoding_1.fromBase64, data.last_block_app_hash), + }; +} +function decodeQueryProof(data) { + return { + ops: data.ops.map((op) => ({ + type: op.type, + key: (0, encoding_1.fromBase64)(op.key), + data: (0, encoding_1.fromBase64)(op.data), + })), + }; +} +function decodeAbciQuery(data) { + return { + key: (0, encoding_1.fromBase64)((0, encodings_1.assertString)(data.key ?? "")), + value: (0, encoding_1.fromBase64)((0, encodings_1.assertString)(data.value ?? "")), + proof: (0, encodings_1.may)(decodeQueryProof, data.proofOps), + height: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.height), + code: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.code), + codespace: (0, encodings_1.assertString)(data.codespace ?? ""), + index: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.index), + log: data.log, + info: (0, encodings_1.assertString)(data.info ?? ""), + }; +} +function decodeAttribute(attribute) { + return { + key: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(attribute.key)), + value: (0, encoding_1.fromBase64)((0, encodings_1.assertString)(attribute.value ?? "")), + }; +} +function decodeAttributes(attributes) { + return (0, encodings_1.assertArray)(attributes).map(decodeAttribute); +} +function decodeEvent(event) { + return { + type: event.type, + attributes: event.attributes ? decodeAttributes(event.attributes) : [], + }; +} +exports.decodeEvent = decodeEvent; +function decodeEvents(events) { + return (0, encodings_1.assertArray)(events).map(decodeEvent); +} +function decodeTxData(data) { + return { + code: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNumber)(data.code ?? 0)), + codespace: data.codespace, + log: data.log, + data: (0, encodings_1.may)(encoding_1.fromBase64, data.data), + events: data.events ? decodeEvents(data.events) : [], + gasWanted: (0, inthelpers_1.apiToSmallInt)(data.gas_wanted ?? "0"), + gasUsed: (0, inthelpers_1.apiToSmallInt)(data.gas_used ?? "0"), + }; +} +function decodePubkey(data) { + if ("Sum" in data) { + // we don't need to check type because we're checking algorithm + const [[algorithm, value]] = Object.entries(data.Sum.value); + (0, utils_1.assert)(algorithm === "ed25519" || algorithm === "secp256k1", `unknown pubkey type: ${algorithm}`); + return { + algorithm, + data: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(value)), + }; + } + else { + switch (data.type) { + // go-amino special code + case "tendermint/PubKeyEd25519": + return { + algorithm: "ed25519", + data: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.value)), + }; + case "tendermint/PubKeySecp256k1": + return { + algorithm: "secp256k1", + data: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.value)), + }; + default: + throw new Error(`unknown pubkey type: ${data.type}`); + } + } +} +/** + * Note: we do not parse block.time_iota_ms for now because of this CHANGELOG entry + * + * > Add time_iota_ms to block's consensus parameters (not exposed to the application) + * https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md#v0310 + */ +function decodeBlockParams(data) { + return { + maxBytes: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.max_bytes)), + maxGas: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.max_gas)), + }; +} +function decodeEvidenceParams(data) { + return { + maxAgeNumBlocks: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.max_age_num_blocks)), + maxAgeDuration: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.max_age_duration)), + }; +} +function decodeConsensusParams(data) { + return { + block: decodeBlockParams((0, encodings_1.assertObject)(data.block)), + evidence: decodeEvidenceParams((0, encodings_1.assertObject)(data.evidence)), + }; +} +function decodeValidatorUpdate(data) { + return { + pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)), + votingPower: (0, inthelpers_1.apiToBigInt)(data.power ?? "0"), + }; +} +exports.decodeValidatorUpdate = decodeValidatorUpdate; +function decodeBlockResults(data) { + return { + height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), + results: (data.txs_results || []).map(decodeTxData), + validatorUpdates: (data.validator_updates || []).map(decodeValidatorUpdate), + consensusUpdates: (0, encodings_1.may)(decodeConsensusParams, data.consensus_param_updates), + beginBlockEvents: decodeEvents(data.begin_block_events || []), + endBlockEvents: decodeEvents(data.end_block_events || []), + }; +} +function decodeBlockId(data) { + return { + hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)), + parts: { + total: (0, encodings_1.assertNotEmpty)(data.parts.total), + hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.parts.hash)), + }, + }; +} +function decodeBlockVersion(data) { + return { + block: (0, inthelpers_1.apiToSmallInt)(data.block), + app: (0, inthelpers_1.apiToSmallInt)(data.app ?? 0), + }; +} +function decodeHeader(data) { + return { + version: decodeBlockVersion(data.version), + chainId: (0, encodings_1.assertNotEmpty)(data.chain_id), + height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), + time: (0, dates_1.fromRfc3339WithNanoseconds)((0, encodings_1.assertNotEmpty)(data.time)), + // When there is no last block ID (i.e. this block's height is 1), we get an empty structure like this: + // { hash: '', parts: { total: 0, hash: '' } } + lastBlockId: data.last_block_id.hash ? decodeBlockId(data.last_block_id) : null, + lastCommitHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.last_commit_hash)), + dataHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.data_hash)), + validatorsHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.validators_hash)), + nextValidatorsHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.next_validators_hash)), + consensusHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.consensus_hash)), + appHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.app_hash)), + lastResultsHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.last_results_hash)), + evidenceHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.evidence_hash)), + proposerAddress: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.proposer_address)), + }; +} +function decodeBlockMeta(data) { + return { + blockId: decodeBlockId(data.block_id), + blockSize: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.block_size)), + header: decodeHeader(data.header), + numTxs: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.num_txs)), + }; +} +function decodeBlockchain(data) { + return { + lastHeight: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.last_height)), + blockMetas: (0, encodings_1.assertArray)(data.block_metas).map(decodeBlockMeta), + }; +} +function decodeBroadcastTxSync(data) { + return { + ...decodeTxData(data), + hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)), + }; +} +function decodeBroadcastTxCommit(data) { + return { + height: (0, inthelpers_1.apiToSmallInt)(data.height), + hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)), + checkTx: decodeTxData((0, encodings_1.assertObject)(data.check_tx)), + deliverTx: (0, encodings_1.may)(decodeTxData, data.deliver_tx), + }; +} +function decodeBlockIdFlag(blockIdFlag) { + (0, utils_1.assert)(blockIdFlag in types_1.BlockIdFlag); + return blockIdFlag; +} +/** + * In some cases a timestamp is optional and set to the value 0 in Go. + * This can lead to strings like "0001-01-01T00:00:00Z" (see https://github.com/cosmos/cosmjs/issues/704#issuecomment-797122415). + * This decoder tries to clean up such encoding from the API and turn them + * into undefined values. + */ +function decodeOptionalTime(timestamp) { + const nonZeroTime = timestamp && !timestamp.startsWith("0001-01-01"); + return nonZeroTime ? (0, dates_1.fromRfc3339WithNanoseconds)(timestamp) : undefined; +} +function decodeCommitSignature(data) { + return { + blockIdFlag: decodeBlockIdFlag(data.block_id_flag), + validatorAddress: data.validator_address ? (0, encoding_1.fromHex)(data.validator_address) : undefined, + timestamp: decodeOptionalTime(data.timestamp), + signature: data.signature ? (0, encoding_1.fromBase64)(data.signature) : undefined, + }; +} +function decodeCommit(data) { + return { + blockId: decodeBlockId((0, encodings_1.assertObject)(data.block_id)), + height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), + round: (0, inthelpers_1.apiToSmallInt)(data.round), + signatures: (0, encodings_1.assertArray)(data.signatures).map(decodeCommitSignature), + }; +} +function decodeCommitResponse(data) { + return { + canonical: (0, encodings_1.assertBoolean)(data.canonical), + header: decodeHeader(data.signed_header.header), + commit: decodeCommit(data.signed_header.commit), + }; +} +function decodeValidatorGenesis(data) { + return { + address: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.address)), + pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)), + votingPower: (0, inthelpers_1.apiToBigInt)((0, encodings_1.assertNotEmpty)(data.power)), + }; +} +exports.decodeValidatorGenesis = decodeValidatorGenesis; +function decodeGenesis(data) { + return { + genesisTime: (0, dates_1.fromRfc3339WithNanoseconds)((0, encodings_1.assertNotEmpty)(data.genesis_time)), + chainId: (0, encodings_1.assertNotEmpty)(data.chain_id), + consensusParams: decodeConsensusParams(data.consensus_params), + validators: data.validators ? (0, encodings_1.assertArray)(data.validators).map(decodeValidatorGenesis) : [], + appHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.app_hash)), + appState: data.app_state, + }; +} +function decodeValidatorInfo(data) { + return { + pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)), + votingPower: (0, inthelpers_1.apiToBigInt)((0, encodings_1.assertNotEmpty)(data.voting_power)), + address: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.address)), + proposerPriority: data.proposer_priority ? (0, inthelpers_1.apiToSmallInt)(data.proposer_priority) : undefined, + }; +} +exports.decodeValidatorInfo = decodeValidatorInfo; +function decodeNodeInfo(data) { + return { + id: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.id)), + listenAddr: (0, encodings_1.assertNotEmpty)(data.listen_addr), + network: (0, encodings_1.assertNotEmpty)(data.network), + version: (0, encodings_1.assertString)(data.version), + channels: (0, encodings_1.assertNotEmpty)(data.channels), + moniker: (0, encodings_1.assertNotEmpty)(data.moniker), + other: (0, encodings_1.dictionaryToStringMap)(data.other), + protocolVersion: { + app: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.protocol_version.app)), + block: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.protocol_version.block)), + p2p: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.protocol_version.p2p)), + }, + }; +} +function decodeSyncInfo(data) { + return { + latestBlockHash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.latest_block_hash)), + latestAppHash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.latest_app_hash)), + latestBlockTime: (0, dates_1.fromRfc3339WithNanoseconds)((0, encodings_1.assertNotEmpty)(data.latest_block_time)), + latestBlockHeight: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.latest_block_height)), + catchingUp: (0, encodings_1.assertBoolean)(data.catching_up), + }; +} +function decodeStatus(data) { + return { + nodeInfo: decodeNodeInfo(data.node_info), + syncInfo: decodeSyncInfo(data.sync_info), + validatorInfo: decodeValidatorInfo(data.validator_info), + }; +} +function decodeTxProof(data) { + return { + data: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.data)), + rootHash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.root_hash)), + proof: { + total: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.proof.total)), + index: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.proof.index)), + leafHash: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.proof.leaf_hash)), + aunts: (0, encodings_1.assertArray)(data.proof.aunts).map(encoding_1.fromBase64), + }, + }; +} +function decodeTxResponse(data) { + return { + tx: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.tx)), + result: decodeTxData((0, encodings_1.assertObject)(data.tx_result)), + height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), + index: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNumber)(data.index)), + hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)), + proof: (0, encodings_1.may)(decodeTxProof, data.proof), + }; +} +function decodeTxSearch(data) { + return { + totalCount: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total_count)), + txs: (0, encodings_1.assertArray)(data.txs).map(decodeTxResponse), + }; +} +function decodeTxEvent(data) { + const tx = (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.tx)); + return { + tx: tx, + hash: (0, hasher_1.hashTx)(tx), + result: decodeTxData(data.result), + height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), + }; +} +function decodeValidators(data) { + return { + blockHeight: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.block_height)), + validators: (0, encodings_1.assertArray)(data.validators).map(decodeValidatorInfo), + count: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.count)), + total: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total)), + }; +} +function decodeBlock(data) { + return { + header: decodeHeader((0, encodings_1.assertObject)(data.header)), + // For the block at height 1, last commit is not set. This is represented in an empty object like this: + // { height: '0', round: 0, block_id: { hash: '', parts: [Object] }, signatures: [] } + lastCommit: data.last_commit.block_id.hash ? decodeCommit((0, encodings_1.assertObject)(data.last_commit)) : null, + txs: data.data.txs ? (0, encodings_1.assertArray)(data.data.txs).map(encoding_1.fromBase64) : [], + // Lift up .evidence.evidence to just .evidence + // See https://github.com/tendermint/tendermint/issues/7697 + evidence: data.evidence?.evidence ?? [], + }; +} +function decodeBlockResponse(data) { + return { + blockId: decodeBlockId(data.block_id), + block: decodeBlock(data.block), + }; +} +function decodeBlockSearch(data) { + return { + totalCount: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total_count)), + blocks: (0, encodings_1.assertArray)(data.blocks).map(decodeBlockResponse), + }; +} +function decodeNumUnconfirmedTxs(data) { + return { + total: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total)), + totalBytes: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total_bytes)), + }; +} +class Responses { + static decodeAbciInfo(response) { + return decodeAbciInfo((0, encodings_1.assertObject)(response.result.response)); + } + static decodeAbciQuery(response) { + return decodeAbciQuery((0, encodings_1.assertObject)(response.result.response)); + } + static decodeBlock(response) { + return decodeBlockResponse(response.result); + } + static decodeBlockResults(response) { + return decodeBlockResults(response.result); + } + static decodeBlockSearch(response) { + return decodeBlockSearch(response.result); + } + static decodeBlockchain(response) { + return decodeBlockchain(response.result); + } + static decodeBroadcastTxSync(response) { + return decodeBroadcastTxSync(response.result); + } + static decodeBroadcastTxAsync(response) { + return Responses.decodeBroadcastTxSync(response); + } + static decodeBroadcastTxCommit(response) { + return decodeBroadcastTxCommit(response.result); + } + static decodeCommit(response) { + return decodeCommitResponse(response.result); + } + static decodeGenesis(response) { + return decodeGenesis((0, encodings_1.assertObject)(response.result.genesis)); + } + static decodeHealth() { + return null; + } + static decodeNumUnconfirmedTxs(response) { + return decodeNumUnconfirmedTxs(response.result); + } + static decodeStatus(response) { + return decodeStatus(response.result); + } + static decodeNewBlockEvent(event) { + return decodeBlock(event.data.value.block); + } + static decodeNewBlockHeaderEvent(event) { + return decodeHeader(event.data.value.header); + } + static decodeTxEvent(event) { + return decodeTxEvent(event.data.value.TxResult); + } + static decodeTx(response) { + return decodeTxResponse(response.result); + } + static decodeTxSearch(response) { + return decodeTxSearch(response.result); + } + static decodeValidators(response) { + return decodeValidators(response.result); + } +} +exports.Responses = Responses; +//# sourceMappingURL=responses.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/encodings.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/encodings.js ***! + \*****************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.encodeBlockId = exports.encodeVersion = exports.encodeBytes = exports.encodeTime = exports.encodeUvarint = exports.encodeString = exports.dictionaryToStringMap = exports.may = exports.assertNotEmpty = exports.assertObject = exports.assertArray = exports.assertNumber = exports.assertString = exports.assertBoolean = exports.assertSet = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js"); +/** + * A runtime checker that ensures a given value is set (i.e. not undefined or null) + * + * This is used when you want to verify that data at runtime matches the expected type. + */ +function assertSet(value) { + if (value === undefined) { + throw new Error("Value must not be undefined"); + } + if (value === null) { + throw new Error("Value must not be null"); + } + return value; +} +exports.assertSet = assertSet; +/** + * A runtime checker that ensures a given value is a boolean + * + * This is used when you want to verify that data at runtime matches the expected type. + * This implies assertSet. + */ +function assertBoolean(value) { + assertSet(value); + if (typeof value !== "boolean") { + throw new Error("Value must be a boolean"); + } + return value; +} +exports.assertBoolean = assertBoolean; +/** + * A runtime checker that ensures a given value is a string. + * + * This is used when you want to verify that data at runtime matches the expected type. + * This implies assertSet. + */ +function assertString(value) { + assertSet(value); + if (typeof value !== "string") { + throw new Error("Value must be a string"); + } + return value; +} +exports.assertString = assertString; +/** + * A runtime checker that ensures a given value is a number + * + * This is used when you want to verify that data at runtime matches the expected type. + * This implies assertSet. + */ +function assertNumber(value) { + assertSet(value); + if (typeof value !== "number") { + throw new Error("Value must be a number"); + } + return value; +} +exports.assertNumber = assertNumber; +/** + * A runtime checker that ensures a given value is an array + * + * This is used when you want to verify that data at runtime matches the expected type. + * This implies assertSet. + */ +function assertArray(value) { + assertSet(value); + if (!Array.isArray(value)) { + throw new Error("Value must be a an array"); + } + return value; +} +exports.assertArray = assertArray; +/** + * A runtime checker that ensures a given value is an object in the sense of JSON + * (an unordered collection of key–value pairs where the keys are strings) + * + * This is used when you want to verify that data at runtime matches the expected type. + * This implies assertSet. + */ +function assertObject(value) { + assertSet(value); + if (typeof value !== "object") { + throw new Error("Value must be an object"); + } + // Exclude special kind of objects like Array, Date or Uint8Array + // Object.prototype.toString() returns a specified value: + // http://www.ecma-international.org/ecma-262/7.0/index.html#sec-object.prototype.tostring + if (Object.prototype.toString.call(value) !== "[object Object]") { + throw new Error("Value must be a simple object"); + } + return value; +} +exports.assertObject = assertObject; +/** + * Throws an error if value matches the empty value for the + * given type (array/string of length 0, number of value 0, ...) + * + * Otherwise returns the value. + * + * This implies assertSet + */ +function assertNotEmpty(value) { + assertSet(value); + if (typeof value === "number" && value === 0) { + throw new Error("must provide a non-zero value"); + } + else if (value.length === 0) { + throw new Error("must provide a non-empty value"); + } + return value; +} +exports.assertNotEmpty = assertNotEmpty; +// may will run the transform if value is defined, otherwise returns undefined +function may(transform, value) { + return value === undefined || value === null ? undefined : transform(value); +} +exports.may = may; +function dictionaryToStringMap(obj) { + const out = new Map(); + for (const key of Object.keys(obj)) { + const value = obj[key]; + if (typeof value !== "string") { + throw new Error("Found dictionary value of type other than string"); + } + out.set(key, value); + } + return out; +} +exports.dictionaryToStringMap = dictionaryToStringMap; +// Encodings needed for hashing block headers +// Several of these functions are inspired by https://github.com/nomic-io/js-tendermint/blob/tendermint-0.30/src/ +// See https://github.com/tendermint/go-amino/blob/v0.15.0/encoder.go#L193-L195 +function encodeString(s) { + const utf8 = (0, encoding_1.toUtf8)(s); + return Uint8Array.from([utf8.length, ...utf8]); +} +exports.encodeString = encodeString; +// See https://github.com/tendermint/go-amino/blob/v0.15.0/encoder.go#L79-L87 +function encodeUvarint(n) { + return n >= 0x80 + ? // eslint-disable-next-line no-bitwise + Uint8Array.from([(n & 0xff) | 0x80, ...encodeUvarint(n >> 7)]) + : // eslint-disable-next-line no-bitwise + Uint8Array.from([n & 0xff]); +} +exports.encodeUvarint = encodeUvarint; +// See https://github.com/tendermint/go-amino/blob/v0.15.0/encoder.go#L134-L178 +function encodeTime(time) { + const milliseconds = time.getTime(); + const seconds = Math.floor(milliseconds / 1000); + const secondsArray = seconds ? [0x08, ...encodeUvarint(seconds)] : new Uint8Array(); + const nanoseconds = (time.nanoseconds || 0) + (milliseconds % 1000) * 1e6; + const nanosecondsArray = nanoseconds ? [0x10, ...encodeUvarint(nanoseconds)] : new Uint8Array(); + return Uint8Array.from([...secondsArray, ...nanosecondsArray]); +} +exports.encodeTime = encodeTime; +// See https://github.com/tendermint/go-amino/blob/v0.15.0/encoder.go#L180-L187 +function encodeBytes(bytes) { + // Since we're only dealing with short byte arrays we don't need a full VarBuffer implementation yet + if (bytes.length >= 0x80) + throw new Error("Not implemented for byte arrays of length 128 or more"); + return bytes.length ? Uint8Array.from([bytes.length, ...bytes]) : new Uint8Array(); +} +exports.encodeBytes = encodeBytes; +function encodeVersion(version) { + const blockArray = version.block + ? Uint8Array.from([0x08, ...encodeUvarint(version.block)]) + : new Uint8Array(); + const appArray = version.app ? Uint8Array.from([0x10, ...encodeUvarint(version.app)]) : new Uint8Array(); + return Uint8Array.from([...blockArray, ...appArray]); +} +exports.encodeVersion = encodeVersion; +function encodeBlockId(blockId) { + return Uint8Array.from([ + 0x0a, + blockId.hash.length, + ...blockId.hash, + 0x12, + blockId.parts.hash.length + 4, + 0x08, + blockId.parts.total, + 0x12, + blockId.parts.hash.length, + ...blockId.parts.hash, + ]); +} +exports.encodeBlockId = encodeBlockId; +//# sourceMappingURL=encodings.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/hasher.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/hasher.js ***! + \**************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.hashBlock = exports.hashTx = void 0; +const crypto_1 = __webpack_require__(/*! @cosmjs/crypto */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/index.js"); +const encodings_1 = __webpack_require__(/*! ./encodings */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/encodings.js"); +// hash is sha256 +// https://github.com/tendermint/tendermint/blob/master/UPGRADING.md#v0260 +function hashTx(tx) { + return (0, crypto_1.sha256)(tx); +} +exports.hashTx = hashTx; +function getSplitPoint(n) { + if (n < 1) + throw new Error("Cannot split an empty tree"); + const largestPowerOf2 = 2 ** Math.floor(Math.log2(n)); + return largestPowerOf2 < n ? largestPowerOf2 : largestPowerOf2 / 2; +} +function hashLeaf(leaf) { + const hash = new crypto_1.Sha256(Uint8Array.from([0])); + hash.update(leaf); + return hash.digest(); +} +function hashInner(left, right) { + const hash = new crypto_1.Sha256(Uint8Array.from([1])); + hash.update(left); + hash.update(right); + return hash.digest(); +} +// See https://github.com/tendermint/tendermint/blob/v0.31.8/docs/spec/blockchain/encoding.md#merkleroot +// Note: the hashes input may not actually be hashes, especially before a recursive call +function hashTree(hashes) { + switch (hashes.length) { + case 0: + throw new Error("Cannot hash empty tree"); + case 1: + return hashLeaf(hashes[0]); + default: { + const slicePoint = getSplitPoint(hashes.length); + const left = hashTree(hashes.slice(0, slicePoint)); + const right = hashTree(hashes.slice(slicePoint)); + return hashInner(left, right); + } + } +} +function hashBlock(header) { + if (!header.lastBlockId) { + throw new Error("Hashing a block header with no last block ID (i.e. header at height 1) is not supported. If you need this, contributions are welcome. Please add documentation and test vectors for this case."); + } + const encodedFields = [ + (0, encodings_1.encodeVersion)(header.version), + (0, encodings_1.encodeString)(header.chainId), + (0, encodings_1.encodeUvarint)(header.height), + (0, encodings_1.encodeTime)(header.time), + (0, encodings_1.encodeBlockId)(header.lastBlockId), + (0, encodings_1.encodeBytes)(header.lastCommitHash), + (0, encodings_1.encodeBytes)(header.dataHash), + (0, encodings_1.encodeBytes)(header.validatorsHash), + (0, encodings_1.encodeBytes)(header.nextValidatorsHash), + (0, encodings_1.encodeBytes)(header.consensusHash), + (0, encodings_1.encodeBytes)(header.appHash), + (0, encodings_1.encodeBytes)(header.lastResultsHash), + (0, encodings_1.encodeBytes)(header.evidenceHash), + (0, encodings_1.encodeBytes)(header.proposerAddress), + ]; + return hashTree(encodedFields); +} +exports.hashBlock = hashBlock; +//# sourceMappingURL=hasher.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/index.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/index.js ***! + \*************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +// Note: all exports in this module are publicly available via +// `import { tendermint34 } from "@cosmjs/tendermint-rpc"` +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Tendermint34Client = exports.VoteType = exports.broadcastTxSyncSuccess = exports.broadcastTxCommitSuccess = exports.SubscriptionEventType = exports.Method = void 0; +var requests_1 = __webpack_require__(/*! ./requests */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/requests.js"); +Object.defineProperty(exports, "Method", ({ enumerable: true, get: function () { return requests_1.Method; } })); +Object.defineProperty(exports, "SubscriptionEventType", ({ enumerable: true, get: function () { return requests_1.SubscriptionEventType; } })); +var responses_1 = __webpack_require__(/*! ./responses */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/responses.js"); +Object.defineProperty(exports, "broadcastTxCommitSuccess", ({ enumerable: true, get: function () { return responses_1.broadcastTxCommitSuccess; } })); +Object.defineProperty(exports, "broadcastTxSyncSuccess", ({ enumerable: true, get: function () { return responses_1.broadcastTxSyncSuccess; } })); +Object.defineProperty(exports, "VoteType", ({ enumerable: true, get: function () { return responses_1.VoteType; } })); +var tendermint34client_1 = __webpack_require__(/*! ./tendermint34client */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.js"); +Object.defineProperty(exports, "Tendermint34Client", ({ enumerable: true, get: function () { return tendermint34client_1.Tendermint34Client; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/requests.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/requests.js ***! + \****************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +/* eslint-disable @typescript-eslint/naming-convention */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.buildQuery = exports.SubscriptionEventType = exports.Method = void 0; +/** + * RPC methods as documented in https://docs.tendermint.com/master/rpc/ + * + * Enum raw value must match the spelling in the "shell" example call (snake_case) + */ +var Method; +(function (Method) { + Method["AbciInfo"] = "abci_info"; + Method["AbciQuery"] = "abci_query"; + Method["Block"] = "block"; + /** Get block headers for minHeight <= height <= maxHeight. */ + Method["Blockchain"] = "blockchain"; + Method["BlockResults"] = "block_results"; + Method["BlockSearch"] = "block_search"; + Method["BroadcastTxAsync"] = "broadcast_tx_async"; + Method["BroadcastTxSync"] = "broadcast_tx_sync"; + Method["BroadcastTxCommit"] = "broadcast_tx_commit"; + Method["Commit"] = "commit"; + Method["Genesis"] = "genesis"; + Method["Health"] = "health"; + Method["NumUnconfirmedTxs"] = "num_unconfirmed_txs"; + Method["Status"] = "status"; + Method["Subscribe"] = "subscribe"; + Method["Tx"] = "tx"; + Method["TxSearch"] = "tx_search"; + Method["Validators"] = "validators"; + Method["Unsubscribe"] = "unsubscribe"; +})(Method = exports.Method || (exports.Method = {})); +/** + * Raw values must match the tendermint event name + * + * @see https://godoc.org/github.com/tendermint/tendermint/types#pkg-constants + */ +var SubscriptionEventType; +(function (SubscriptionEventType) { + SubscriptionEventType["NewBlock"] = "NewBlock"; + SubscriptionEventType["NewBlockHeader"] = "NewBlockHeader"; + SubscriptionEventType["Tx"] = "Tx"; +})(SubscriptionEventType = exports.SubscriptionEventType || (exports.SubscriptionEventType = {})); +function buildQuery(components) { + const tags = components.tags ? components.tags : []; + const tagComponents = tags.map((tag) => `${tag.key}='${tag.value}'`); + const rawComponents = components.raw ? [components.raw] : []; + return [...tagComponents, ...rawComponents].join(" AND "); +} +exports.buildQuery = buildQuery; +//# sourceMappingURL=requests.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/responses.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/responses.js ***! + \*****************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.VoteType = exports.broadcastTxCommitSuccess = exports.broadcastTxSyncSuccess = void 0; +/** + * Returns true iff transaction made it successfully into the transaction pool + */ +function broadcastTxSyncSuccess(res) { + // code must be 0 on success + return res.code === 0; +} +exports.broadcastTxSyncSuccess = broadcastTxSyncSuccess; +/** + * Returns true iff transaction made it successfully into a block + * (i.e. success in `check_tx` and `deliver_tx` field) + */ +function broadcastTxCommitSuccess(response) { + // code must be 0 on success + // deliverTx may be present but empty on failure + return response.checkTx.code === 0 && !!response.deliverTx && response.deliverTx.code === 0; +} +exports.broadcastTxCommitSuccess = broadcastTxCommitSuccess; +/** + * raw values from https://github.com/tendermint/tendermint/blob/dfa9a9a30a666132425b29454e90a472aa579a48/types/vote.go#L44 + */ +var VoteType; +(function (VoteType) { + VoteType[VoteType["PreVote"] = 1] = "PreVote"; + VoteType[VoteType["PreCommit"] = 2] = "PreCommit"; +})(VoteType = exports.VoteType || (exports.VoteType = {})); +//# sourceMappingURL=responses.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/tendermint34client.js ***! + \**************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Tendermint34Client = void 0; +const jsonrpc_1 = __webpack_require__(/*! ../jsonrpc */ "./node_modules/@cosmjs/tendermint-rpc/build/jsonrpc.js"); +const rpcclients_1 = __webpack_require__(/*! ../rpcclients */ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/index.js"); +const adaptor_1 = __webpack_require__(/*! ./adaptor */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/index.js"); +const requests = __importStar(__webpack_require__(/*! ./requests */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/requests.js")); +class Tendermint34Client { + /** + * Use `Tendermint34Client.connect` or `Tendermint34Client.create` to create an instance. + */ + constructor(client) { + this.client = client; + this.p = adaptor_1.adaptor34.params; + this.r = adaptor_1.adaptor34.responses; + } + /** + * Creates a new Tendermint client for the given endpoint. + * + * Uses HTTP when the URL schema is http or https. Uses WebSockets otherwise. + */ + static async connect(endpoint) { + let rpcClient; + if (typeof endpoint === "object") { + rpcClient = new rpcclients_1.HttpClient(endpoint); + } + else { + const useHttp = endpoint.startsWith("http://") || endpoint.startsWith("https://"); + rpcClient = useHttp ? new rpcclients_1.HttpClient(endpoint) : new rpcclients_1.WebsocketClient(endpoint); + } + // For some very strange reason I don't understand, tests start to fail on some systems + // (our CI) when skipping the status call before doing other queries. Sleeping a little + // while did not help. Thus we query the version as a way to say "hi" to the backend, + // even in cases where we don't use the result. + const _version = await this.detectVersion(rpcClient); + return Tendermint34Client.create(rpcClient); + } + /** + * Creates a new Tendermint client given an RPC client. + */ + static async create(rpcClient) { + return new Tendermint34Client(rpcClient); + } + static async detectVersion(client) { + const req = (0, jsonrpc_1.createJsonRpcRequest)(requests.Method.Status); + const response = await client.execute(req); + const result = response.result; + if (!result || !result.node_info) { + throw new Error("Unrecognized format for status response"); + } + const version = result.node_info.version; + if (typeof version !== "string") { + throw new Error("Unrecognized version format: must be string"); + } + return version; + } + disconnect() { + this.client.disconnect(); + } + async abciInfo() { + const query = { method: requests.Method.AbciInfo }; + return this.doCall(query, this.p.encodeAbciInfo, this.r.decodeAbciInfo); + } + async abciQuery(params) { + const query = { params: params, method: requests.Method.AbciQuery }; + return this.doCall(query, this.p.encodeAbciQuery, this.r.decodeAbciQuery); + } + async block(height) { + const query = { method: requests.Method.Block, params: { height: height } }; + return this.doCall(query, this.p.encodeBlock, this.r.decodeBlock); + } + async blockResults(height) { + const query = { + method: requests.Method.BlockResults, + params: { height: height }, + }; + return this.doCall(query, this.p.encodeBlockResults, this.r.decodeBlockResults); + } + /** + * Search for events that are in a block. + * + * NOTE + * This method will error on any node that is running a Tendermint version lower than 0.34.9. + * + * @see https://docs.tendermint.com/master/rpc/#/Info/block_search + */ + async blockSearch(params) { + const query = { params: params, method: requests.Method.BlockSearch }; + const resp = await this.doCall(query, this.p.encodeBlockSearch, this.r.decodeBlockSearch); + return { + ...resp, + // make sure we sort by height, as tendermint may be sorting by string value of the height + blocks: [...resp.blocks].sort((a, b) => a.block.header.height - b.block.header.height), + }; + } + // this should paginate through all blockSearch options to ensure it returns all results. + // starts with page 1 or whatever was provided (eg. to start on page 7) + // + // NOTE + // This method will error on any node that is running a Tendermint version lower than 0.34.9. + async blockSearchAll(params) { + let page = params.page || 1; + const blocks = []; + let done = false; + while (!done) { + const resp = await this.blockSearch({ ...params, page: page }); + blocks.push(...resp.blocks); + if (blocks.length < resp.totalCount) { + page++; + } + else { + done = true; + } + } + // make sure we sort by height, as tendermint may be sorting by string value of the height + // and the earlier items may be in a higher page than the later items + blocks.sort((a, b) => a.block.header.height - b.block.header.height); + return { + totalCount: blocks.length, + blocks: blocks, + }; + } + /** + * Queries block headers filtered by minHeight <= height <= maxHeight. + * + * @param minHeight The minimum height to be included in the result. Defaults to 0. + * @param maxHeight The maximum height to be included in the result. Defaults to infinity. + */ + async blockchain(minHeight, maxHeight) { + const query = { + method: requests.Method.Blockchain, + params: { + minHeight: minHeight, + maxHeight: maxHeight, + }, + }; + return this.doCall(query, this.p.encodeBlockchain, this.r.decodeBlockchain); + } + /** + * Broadcast transaction to mempool and wait for response + * + * @see https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_sync + */ + async broadcastTxSync(params) { + const query = { params: params, method: requests.Method.BroadcastTxSync }; + return this.doCall(query, this.p.encodeBroadcastTx, this.r.decodeBroadcastTxSync); + } + /** + * Broadcast transaction to mempool and do not wait for result + * + * @see https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_async + */ + async broadcastTxAsync(params) { + const query = { params: params, method: requests.Method.BroadcastTxAsync }; + return this.doCall(query, this.p.encodeBroadcastTx, this.r.decodeBroadcastTxAsync); + } + /** + * Broadcast transaction to mempool and wait for block + * + * @see https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_commit + */ + async broadcastTxCommit(params) { + const query = { params: params, method: requests.Method.BroadcastTxCommit }; + return this.doCall(query, this.p.encodeBroadcastTx, this.r.decodeBroadcastTxCommit); + } + async commit(height) { + const query = { method: requests.Method.Commit, params: { height: height } }; + return this.doCall(query, this.p.encodeCommit, this.r.decodeCommit); + } + async genesis() { + const query = { method: requests.Method.Genesis }; + return this.doCall(query, this.p.encodeGenesis, this.r.decodeGenesis); + } + async health() { + const query = { method: requests.Method.Health }; + return this.doCall(query, this.p.encodeHealth, this.r.decodeHealth); + } + async numUnconfirmedTxs() { + const query = { method: requests.Method.NumUnconfirmedTxs }; + return this.doCall(query, this.p.encodeNumUnconfirmedTxs, this.r.decodeNumUnconfirmedTxs); + } + async status() { + const query = { method: requests.Method.Status }; + return this.doCall(query, this.p.encodeStatus, this.r.decodeStatus); + } + subscribeNewBlock() { + const request = { + method: requests.Method.Subscribe, + query: { type: requests.SubscriptionEventType.NewBlock }, + }; + return this.subscribe(request, this.r.decodeNewBlockEvent); + } + subscribeNewBlockHeader() { + const request = { + method: requests.Method.Subscribe, + query: { type: requests.SubscriptionEventType.NewBlockHeader }, + }; + return this.subscribe(request, this.r.decodeNewBlockHeaderEvent); + } + subscribeTx(query) { + const request = { + method: requests.Method.Subscribe, + query: { + type: requests.SubscriptionEventType.Tx, + raw: query, + }, + }; + return this.subscribe(request, this.r.decodeTxEvent); + } + /** + * Get a single transaction by hash + * + * @see https://docs.tendermint.com/master/rpc/#/Info/tx + */ + async tx(params) { + const query = { params: params, method: requests.Method.Tx }; + return this.doCall(query, this.p.encodeTx, this.r.decodeTx); + } + /** + * Search for transactions that are in a block + * + * @see https://docs.tendermint.com/master/rpc/#/Info/tx_search + */ + async txSearch(params) { + const query = { params: params, method: requests.Method.TxSearch }; + return this.doCall(query, this.p.encodeTxSearch, this.r.decodeTxSearch); + } + // this should paginate through all txSearch options to ensure it returns all results. + // starts with page 1 or whatever was provided (eg. to start on page 7) + async txSearchAll(params) { + let page = params.page || 1; + const txs = []; + let done = false; + while (!done) { + const resp = await this.txSearch({ ...params, page: page }); + txs.push(...resp.txs); + if (txs.length < resp.totalCount) { + page++; + } + else { + done = true; + } + } + return { + totalCount: txs.length, + txs: txs, + }; + } + async validators(params) { + const query = { + method: requests.Method.Validators, + params: params, + }; + return this.doCall(query, this.p.encodeValidators, this.r.decodeValidators); + } + async validatorsAll(height) { + const validators = []; + let page = 1; + let done = false; + let blockHeight = height; + while (!done) { + const response = await this.validators({ + per_page: 50, + height: blockHeight, + page: page, + }); + validators.push(...response.validators); + blockHeight = blockHeight || response.blockHeight; + if (validators.length < response.total) { + page++; + } + else { + done = true; + } + } + return { + // NOTE: Default value is for type safety but this should always be set + blockHeight: blockHeight ?? 0, + count: validators.length, + total: validators.length, + validators: validators, + }; + } + // doCall is a helper to handle the encode/call/decode logic + async doCall(request, encode, decode) { + const req = encode(request); + const result = await this.client.execute(req); + return decode(result); + } + subscribe(request, decode) { + if (!(0, rpcclients_1.instanceOfRpcStreamingClient)(this.client)) { + throw new Error("This RPC client type cannot subscribe to events"); + } + const req = this.p.encodeSubscribe(request); + const eventStream = this.client.listen(req); + return eventStream.map((event) => { + return decode(event); + }); + } +} +exports.Tendermint34Client = Tendermint34Client; +//# sourceMappingURL=tendermint34client.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/adaptor/index.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/adaptor/index.js ***! + \*********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.adaptor37 = void 0; +const hasher_1 = __webpack_require__(/*! ../hasher */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/hasher.js"); +const requests_1 = __webpack_require__(/*! ./requests */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/adaptor/requests.js"); +const responses_1 = __webpack_require__(/*! ./responses */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/adaptor/responses.js"); +exports.adaptor37 = { + params: requests_1.Params, + responses: responses_1.Responses, + hashTx: hasher_1.hashTx, + hashBlock: hasher_1.hashBlock, +}; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/adaptor/requests.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/adaptor/requests.js ***! + \************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Params = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js"); +const inthelpers_1 = __webpack_require__(/*! ../../inthelpers */ "./node_modules/@cosmjs/tendermint-rpc/build/inthelpers.js"); +const jsonrpc_1 = __webpack_require__(/*! ../../jsonrpc */ "./node_modules/@cosmjs/tendermint-rpc/build/jsonrpc.js"); +const encodings_1 = __webpack_require__(/*! ../encodings */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/encodings.js"); +const requests = __importStar(__webpack_require__(/*! ../requests */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/requests.js")); +function encodeHeightParam(param) { + return { + height: (0, encodings_1.may)(inthelpers_1.smallIntToApi, param.height), + }; +} +function encodeBlockchainRequestParams(param) { + return { + minHeight: (0, encodings_1.may)(inthelpers_1.smallIntToApi, param.minHeight), + maxHeight: (0, encodings_1.may)(inthelpers_1.smallIntToApi, param.maxHeight), + }; +} +function encodeBlockSearchParams(params) { + return { + query: params.query, + page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.page), + per_page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.per_page), + order_by: params.order_by, + }; +} +function encodeAbciQueryParams(params) { + return { + path: (0, encodings_1.assertNotEmpty)(params.path), + data: (0, encoding_1.toHex)(params.data), + height: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.height), + prove: params.prove, + }; +} +function encodeBroadcastTxParams(params) { + return { + tx: (0, encoding_1.toBase64)((0, encodings_1.assertNotEmpty)(params.tx)), + }; +} +function encodeTxParams(params) { + return { + hash: (0, encoding_1.toBase64)((0, encodings_1.assertNotEmpty)(params.hash)), + prove: params.prove, + }; +} +function encodeTxSearchParams(params) { + return { + query: params.query, + prove: params.prove, + page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.page), + per_page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.per_page), + order_by: params.order_by, + }; +} +function encodeValidatorsParams(params) { + return { + height: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.height), + page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.page), + per_page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.per_page), + }; +} +class Params { + static encodeAbciInfo(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method); + } + static encodeAbciQuery(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeAbciQueryParams(req.params)); + } + static encodeBlock(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeHeightParam(req.params)); + } + static encodeBlockchain(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeBlockchainRequestParams(req.params)); + } + static encodeBlockResults(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeHeightParam(req.params)); + } + static encodeBlockSearch(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeBlockSearchParams(req.params)); + } + static encodeBroadcastTx(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeBroadcastTxParams(req.params)); + } + static encodeCommit(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeHeightParam(req.params)); + } + static encodeGenesis(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method); + } + static encodeHealth(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method); + } + static encodeNumUnconfirmedTxs(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method); + } + static encodeStatus(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method); + } + static encodeSubscribe(req) { + const eventTag = { key: "tm.event", value: req.query.type }; + const query = requests.buildQuery({ tags: [eventTag], raw: req.query.raw }); + return (0, jsonrpc_1.createJsonRpcRequest)("subscribe", { query: query }); + } + static encodeTx(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeTxParams(req.params)); + } + // TODO: encode params for query string??? + static encodeTxSearch(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeTxSearchParams(req.params)); + } + static encodeValidators(req) { + return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeValidatorsParams(req.params)); + } +} +exports.Params = Params; +//# sourceMappingURL=requests.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/adaptor/responses.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/adaptor/responses.js ***! + \*************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Responses = exports.decodeValidatorInfo = exports.decodeValidatorGenesis = exports.decodeValidatorUpdate = exports.decodeEvent = void 0; +/* eslint-disable @typescript-eslint/naming-convention */ +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js"); +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/index.js"); +const dates_1 = __webpack_require__(/*! ../../dates */ "./node_modules/@cosmjs/tendermint-rpc/build/dates.js"); +const inthelpers_1 = __webpack_require__(/*! ../../inthelpers */ "./node_modules/@cosmjs/tendermint-rpc/build/inthelpers.js"); +const types_1 = __webpack_require__(/*! ../../types */ "./node_modules/@cosmjs/tendermint-rpc/build/types.js"); +const encodings_1 = __webpack_require__(/*! ../encodings */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/encodings.js"); +const hasher_1 = __webpack_require__(/*! ../hasher */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/hasher.js"); +function decodeAbciInfo(data) { + return { + data: data.data, + lastBlockHeight: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.last_block_height), + lastBlockAppHash: (0, encodings_1.may)(encoding_1.fromBase64, data.last_block_app_hash), + }; +} +function decodeQueryProof(data) { + return { + ops: data.ops.map((op) => ({ + type: op.type, + key: (0, encoding_1.fromBase64)(op.key), + data: (0, encoding_1.fromBase64)(op.data), + })), + }; +} +function decodeAbciQuery(data) { + return { + key: (0, encoding_1.fromBase64)((0, encodings_1.assertString)(data.key ?? "")), + value: (0, encoding_1.fromBase64)((0, encodings_1.assertString)(data.value ?? "")), + proof: (0, encodings_1.may)(decodeQueryProof, data.proofOps), + height: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.height), + code: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.code), + codespace: (0, encodings_1.assertString)(data.codespace ?? ""), + index: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.index), + log: data.log, + info: (0, encodings_1.assertString)(data.info ?? ""), + }; +} +function decodeEventAttribute(attribute) { + return { + key: (0, encodings_1.assertNotEmpty)(attribute.key), + value: attribute.value ?? "", + }; +} +function decodeAttributes(attributes) { + return (0, encodings_1.assertArray)(attributes).map(decodeEventAttribute); +} +function decodeEvent(event) { + return { + type: event.type, + attributes: event.attributes ? decodeAttributes(event.attributes) : [], + }; +} +exports.decodeEvent = decodeEvent; +function decodeEvents(events) { + return (0, encodings_1.assertArray)(events).map(decodeEvent); +} +function decodeTxData(data) { + return { + code: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNumber)(data.code ?? 0)), + codespace: data.codespace, + log: data.log, + data: (0, encodings_1.may)(encoding_1.fromBase64, data.data), + events: data.events ? decodeEvents(data.events) : [], + gasWanted: (0, inthelpers_1.apiToSmallInt)(data.gas_wanted ?? "0"), + gasUsed: (0, inthelpers_1.apiToSmallInt)(data.gas_used ?? "0"), + }; +} +function decodePubkey(data) { + if ("Sum" in data) { + // we don't need to check type because we're checking algorithm + const [[algorithm, value]] = Object.entries(data.Sum.value); + (0, utils_1.assert)(algorithm === "ed25519" || algorithm === "secp256k1", `unknown pubkey type: ${algorithm}`); + return { + algorithm, + data: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(value)), + }; + } + else { + switch (data.type) { + // go-amino special code + case "tendermint/PubKeyEd25519": + return { + algorithm: "ed25519", + data: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.value)), + }; + case "tendermint/PubKeySecp256k1": + return { + algorithm: "secp256k1", + data: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.value)), + }; + default: + throw new Error(`unknown pubkey type: ${data.type}`); + } + } +} +/** + * Note: we do not parse block.time_iota_ms for now because of this CHANGELOG entry + * + * > Add time_iota_ms to block's consensus parameters (not exposed to the application) + * https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md#v0310 + */ +function decodeBlockParams(data) { + return { + maxBytes: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.max_bytes)), + maxGas: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.max_gas)), + }; +} +function decodeEvidenceParams(data) { + return { + maxAgeNumBlocks: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.max_age_num_blocks)), + maxAgeDuration: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.max_age_duration)), + }; +} +function decodeConsensusParams(data) { + return { + block: decodeBlockParams((0, encodings_1.assertObject)(data.block)), + evidence: decodeEvidenceParams((0, encodings_1.assertObject)(data.evidence)), + }; +} +function decodeValidatorUpdate(data) { + return { + pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)), + votingPower: (0, inthelpers_1.apiToBigInt)(data.power ?? "0"), + }; +} +exports.decodeValidatorUpdate = decodeValidatorUpdate; +function decodeBlockResults(data) { + return { + height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), + results: (data.txs_results || []).map(decodeTxData), + validatorUpdates: (data.validator_updates || []).map(decodeValidatorUpdate), + consensusUpdates: (0, encodings_1.may)(decodeConsensusParams, data.consensus_param_updates), + beginBlockEvents: decodeEvents(data.begin_block_events || []), + endBlockEvents: decodeEvents(data.end_block_events || []), + }; +} +function decodeBlockId(data) { + return { + hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)), + parts: { + total: (0, encodings_1.assertNotEmpty)(data.parts.total), + hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.parts.hash)), + }, + }; +} +function decodeBlockVersion(data) { + return { + block: (0, inthelpers_1.apiToSmallInt)(data.block), + app: (0, inthelpers_1.apiToSmallInt)(data.app ?? 0), + }; +} +function decodeHeader(data) { + return { + version: decodeBlockVersion(data.version), + chainId: (0, encodings_1.assertNotEmpty)(data.chain_id), + height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), + time: (0, dates_1.fromRfc3339WithNanoseconds)((0, encodings_1.assertNotEmpty)(data.time)), + // When there is no last block ID (i.e. this block's height is 1), we get an empty structure like this: + // { hash: '', parts: { total: 0, hash: '' } } + lastBlockId: data.last_block_id.hash ? decodeBlockId(data.last_block_id) : null, + lastCommitHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.last_commit_hash)), + dataHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.data_hash)), + validatorsHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.validators_hash)), + nextValidatorsHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.next_validators_hash)), + consensusHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.consensus_hash)), + appHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.app_hash)), + lastResultsHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.last_results_hash)), + evidenceHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.evidence_hash)), + proposerAddress: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.proposer_address)), + }; +} +function decodeBlockMeta(data) { + return { + blockId: decodeBlockId(data.block_id), + blockSize: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.block_size)), + header: decodeHeader(data.header), + numTxs: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.num_txs)), + }; +} +function decodeBlockchain(data) { + return { + lastHeight: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.last_height)), + blockMetas: (0, encodings_1.assertArray)(data.block_metas).map(decodeBlockMeta), + }; +} +function decodeBroadcastTxSync(data) { + return { + ...decodeTxData(data), + hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)), + }; +} +function decodeBroadcastTxCommit(data) { + return { + height: (0, inthelpers_1.apiToSmallInt)(data.height), + hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)), + checkTx: decodeTxData((0, encodings_1.assertObject)(data.check_tx)), + deliverTx: (0, encodings_1.may)(decodeTxData, data.deliver_tx), + }; +} +function decodeBlockIdFlag(blockIdFlag) { + (0, utils_1.assert)(blockIdFlag in types_1.BlockIdFlag); + return blockIdFlag; +} +/** + * In some cases a timestamp is optional and set to the value 0 in Go. + * This can lead to strings like "0001-01-01T00:00:00Z" (see https://github.com/cosmos/cosmjs/issues/704#issuecomment-797122415). + * This decoder tries to clean up such encoding from the API and turn them + * into undefined values. + */ +function decodeOptionalTime(timestamp) { + const nonZeroTime = timestamp && !timestamp.startsWith("0001-01-01"); + return nonZeroTime ? (0, dates_1.fromRfc3339WithNanoseconds)(timestamp) : undefined; +} +function decodeCommitSignature(data) { + return { + blockIdFlag: decodeBlockIdFlag(data.block_id_flag), + validatorAddress: data.validator_address ? (0, encoding_1.fromHex)(data.validator_address) : undefined, + timestamp: decodeOptionalTime(data.timestamp), + signature: data.signature ? (0, encoding_1.fromBase64)(data.signature) : undefined, + }; +} +function decodeCommit(data) { + return { + blockId: decodeBlockId((0, encodings_1.assertObject)(data.block_id)), + height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), + round: (0, inthelpers_1.apiToSmallInt)(data.round), + signatures: (0, encodings_1.assertArray)(data.signatures).map(decodeCommitSignature), + }; +} +function decodeCommitResponse(data) { + return { + canonical: (0, encodings_1.assertBoolean)(data.canonical), + header: decodeHeader(data.signed_header.header), + commit: decodeCommit(data.signed_header.commit), + }; +} +function decodeValidatorGenesis(data) { + return { + address: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.address)), + pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)), + votingPower: (0, inthelpers_1.apiToBigInt)((0, encodings_1.assertNotEmpty)(data.power)), + }; +} +exports.decodeValidatorGenesis = decodeValidatorGenesis; +function decodeGenesis(data) { + return { + genesisTime: (0, dates_1.fromRfc3339WithNanoseconds)((0, encodings_1.assertNotEmpty)(data.genesis_time)), + chainId: (0, encodings_1.assertNotEmpty)(data.chain_id), + consensusParams: decodeConsensusParams(data.consensus_params), + validators: data.validators ? (0, encodings_1.assertArray)(data.validators).map(decodeValidatorGenesis) : [], + appHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.app_hash)), + appState: data.app_state, + }; +} +function decodeValidatorInfo(data) { + return { + pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)), + votingPower: (0, inthelpers_1.apiToBigInt)((0, encodings_1.assertNotEmpty)(data.voting_power)), + address: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.address)), + proposerPriority: data.proposer_priority ? (0, inthelpers_1.apiToSmallInt)(data.proposer_priority) : undefined, + }; +} +exports.decodeValidatorInfo = decodeValidatorInfo; +function decodeNodeInfo(data) { + return { + id: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.id)), + listenAddr: (0, encodings_1.assertNotEmpty)(data.listen_addr), + network: (0, encodings_1.assertNotEmpty)(data.network), + version: (0, encodings_1.assertString)(data.version), + channels: (0, encodings_1.assertNotEmpty)(data.channels), + moniker: (0, encodings_1.assertNotEmpty)(data.moniker), + other: (0, encodings_1.dictionaryToStringMap)(data.other), + protocolVersion: { + app: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.protocol_version.app)), + block: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.protocol_version.block)), + p2p: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.protocol_version.p2p)), + }, + }; +} +function decodeSyncInfo(data) { + return { + latestBlockHash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.latest_block_hash)), + latestAppHash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.latest_app_hash)), + latestBlockTime: (0, dates_1.fromRfc3339WithNanoseconds)((0, encodings_1.assertNotEmpty)(data.latest_block_time)), + latestBlockHeight: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.latest_block_height)), + catchingUp: (0, encodings_1.assertBoolean)(data.catching_up), + }; +} +function decodeStatus(data) { + return { + nodeInfo: decodeNodeInfo(data.node_info), + syncInfo: decodeSyncInfo(data.sync_info), + validatorInfo: decodeValidatorInfo(data.validator_info), + }; +} +function decodeTxProof(data) { + return { + data: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.data)), + rootHash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.root_hash)), + proof: { + total: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.proof.total)), + index: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.proof.index)), + leafHash: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.proof.leaf_hash)), + aunts: (0, encodings_1.assertArray)(data.proof.aunts).map(encoding_1.fromBase64), + }, + }; +} +function decodeTxResponse(data) { + return { + tx: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.tx)), + result: decodeTxData((0, encodings_1.assertObject)(data.tx_result)), + height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), + index: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNumber)(data.index)), + hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)), + proof: (0, encodings_1.may)(decodeTxProof, data.proof), + }; +} +function decodeTxSearch(data) { + return { + totalCount: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total_count)), + txs: (0, encodings_1.assertArray)(data.txs).map(decodeTxResponse), + }; +} +function decodeTxEvent(data) { + const tx = (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.tx)); + return { + tx: tx, + hash: (0, hasher_1.hashTx)(tx), + result: decodeTxData(data.result), + height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), + }; +} +function decodeValidators(data) { + return { + blockHeight: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.block_height)), + validators: (0, encodings_1.assertArray)(data.validators).map(decodeValidatorInfo), + count: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.count)), + total: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total)), + }; +} +function decodeBlock(data) { + return { + header: decodeHeader((0, encodings_1.assertObject)(data.header)), + // For the block at height 1, last commit is not set. This is represented in an empty object like this: + // { height: '0', round: 0, block_id: { hash: '', parts: [Object] }, signatures: [] } + lastCommit: data.last_commit.block_id.hash ? decodeCommit((0, encodings_1.assertObject)(data.last_commit)) : null, + txs: data.data.txs ? (0, encodings_1.assertArray)(data.data.txs).map(encoding_1.fromBase64) : [], + // Lift up .evidence.evidence to just .evidence + // See https://github.com/tendermint/tendermint/issues/7697 + evidence: data.evidence?.evidence ?? [], + }; +} +function decodeBlockResponse(data) { + return { + blockId: decodeBlockId(data.block_id), + block: decodeBlock(data.block), + }; +} +function decodeBlockSearch(data) { + return { + totalCount: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total_count)), + blocks: (0, encodings_1.assertArray)(data.blocks).map(decodeBlockResponse), + }; +} +function decodeNumUnconfirmedTxs(data) { + return { + total: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total)), + totalBytes: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total_bytes)), + }; +} +class Responses { + static decodeAbciInfo(response) { + return decodeAbciInfo((0, encodings_1.assertObject)(response.result.response)); + } + static decodeAbciQuery(response) { + return decodeAbciQuery((0, encodings_1.assertObject)(response.result.response)); + } + static decodeBlock(response) { + return decodeBlockResponse(response.result); + } + static decodeBlockResults(response) { + return decodeBlockResults(response.result); + } + static decodeBlockSearch(response) { + return decodeBlockSearch(response.result); + } + static decodeBlockchain(response) { + return decodeBlockchain(response.result); + } + static decodeBroadcastTxSync(response) { + return decodeBroadcastTxSync(response.result); + } + static decodeBroadcastTxAsync(response) { + return Responses.decodeBroadcastTxSync(response); + } + static decodeBroadcastTxCommit(response) { + return decodeBroadcastTxCommit(response.result); + } + static decodeCommit(response) { + return decodeCommitResponse(response.result); + } + static decodeGenesis(response) { + return decodeGenesis((0, encodings_1.assertObject)(response.result.genesis)); + } + static decodeHealth() { + return null; + } + static decodeNumUnconfirmedTxs(response) { + return decodeNumUnconfirmedTxs(response.result); + } + static decodeStatus(response) { + return decodeStatus(response.result); + } + static decodeNewBlockEvent(event) { + return decodeBlock(event.data.value.block); + } + static decodeNewBlockHeaderEvent(event) { + return decodeHeader(event.data.value.header); + } + static decodeTxEvent(event) { + return decodeTxEvent(event.data.value.TxResult); + } + static decodeTx(response) { + return decodeTxResponse(response.result); + } + static decodeTxSearch(response) { + return decodeTxSearch(response.result); + } + static decodeValidators(response) { + return decodeValidators(response.result); + } +} +exports.Responses = Responses; +//# sourceMappingURL=responses.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/encodings.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/encodings.js ***! + \*****************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.encodeBlockId = exports.encodeVersion = exports.encodeBytes = exports.encodeTime = exports.encodeUvarint = exports.encodeString = exports.dictionaryToStringMap = exports.may = exports.assertNotEmpty = exports.assertObject = exports.assertArray = exports.assertNumber = exports.assertString = exports.assertBoolean = exports.assertSet = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js"); +/** + * A runtime checker that ensures a given value is set (i.e. not undefined or null) + * + * This is used when you want to verify that data at runtime matches the expected type. + */ +function assertSet(value) { + if (value === undefined) { + throw new Error("Value must not be undefined"); + } + if (value === null) { + throw new Error("Value must not be null"); + } + return value; +} +exports.assertSet = assertSet; +/** + * A runtime checker that ensures a given value is a boolean + * + * This is used when you want to verify that data at runtime matches the expected type. + * This implies assertSet. + */ +function assertBoolean(value) { + assertSet(value); + if (typeof value !== "boolean") { + throw new Error("Value must be a boolean"); + } + return value; +} +exports.assertBoolean = assertBoolean; +/** + * A runtime checker that ensures a given value is a string. + * + * This is used when you want to verify that data at runtime matches the expected type. + * This implies assertSet. + */ +function assertString(value) { + assertSet(value); + if (typeof value !== "string") { + throw new Error("Value must be a string"); + } + return value; +} +exports.assertString = assertString; +/** + * A runtime checker that ensures a given value is a number + * + * This is used when you want to verify that data at runtime matches the expected type. + * This implies assertSet. + */ +function assertNumber(value) { + assertSet(value); + if (typeof value !== "number") { + throw new Error("Value must be a number"); + } + return value; +} +exports.assertNumber = assertNumber; +/** + * A runtime checker that ensures a given value is an array + * + * This is used when you want to verify that data at runtime matches the expected type. + * This implies assertSet. + */ +function assertArray(value) { + assertSet(value); + if (!Array.isArray(value)) { + throw new Error("Value must be a an array"); + } + return value; +} +exports.assertArray = assertArray; +/** + * A runtime checker that ensures a given value is an object in the sense of JSON + * (an unordered collection of key–value pairs where the keys are strings) + * + * This is used when you want to verify that data at runtime matches the expected type. + * This implies assertSet. + */ +function assertObject(value) { + assertSet(value); + if (typeof value !== "object") { + throw new Error("Value must be an object"); + } + // Exclude special kind of objects like Array, Date or Uint8Array + // Object.prototype.toString() returns a specified value: + // http://www.ecma-international.org/ecma-262/7.0/index.html#sec-object.prototype.tostring + if (Object.prototype.toString.call(value) !== "[object Object]") { + throw new Error("Value must be a simple object"); + } + return value; +} +exports.assertObject = assertObject; +/** + * Throws an error if value matches the empty value for the + * given type (array/string of length 0, number of value 0, ...) + * + * Otherwise returns the value. + * + * This implies assertSet + */ +function assertNotEmpty(value) { + assertSet(value); + if (typeof value === "number" && value === 0) { + throw new Error("must provide a non-zero value"); + } + else if (value.length === 0) { + throw new Error("must provide a non-empty value"); + } + return value; +} +exports.assertNotEmpty = assertNotEmpty; +// may will run the transform if value is defined, otherwise returns undefined +function may(transform, value) { + return value === undefined || value === null ? undefined : transform(value); +} +exports.may = may; +function dictionaryToStringMap(obj) { + const out = new Map(); + for (const key of Object.keys(obj)) { + const value = obj[key]; + if (typeof value !== "string") { + throw new Error("Found dictionary value of type other than string"); + } + out.set(key, value); + } + return out; +} +exports.dictionaryToStringMap = dictionaryToStringMap; +// Encodings needed for hashing block headers +// Several of these functions are inspired by https://github.com/nomic-io/js-tendermint/blob/tendermint-0.30/src/ +// See https://github.com/tendermint/go-amino/blob/v0.15.0/encoder.go#L193-L195 +function encodeString(s) { + const utf8 = (0, encoding_1.toUtf8)(s); + return Uint8Array.from([utf8.length, ...utf8]); +} +exports.encodeString = encodeString; +// See https://github.com/tendermint/go-amino/blob/v0.15.0/encoder.go#L79-L87 +function encodeUvarint(n) { + return n >= 0x80 + ? // eslint-disable-next-line no-bitwise + Uint8Array.from([(n & 0xff) | 0x80, ...encodeUvarint(n >> 7)]) + : // eslint-disable-next-line no-bitwise + Uint8Array.from([n & 0xff]); +} +exports.encodeUvarint = encodeUvarint; +// See https://github.com/tendermint/go-amino/blob/v0.15.0/encoder.go#L134-L178 +function encodeTime(time) { + const milliseconds = time.getTime(); + const seconds = Math.floor(milliseconds / 1000); + const secondsArray = seconds ? [0x08, ...encodeUvarint(seconds)] : new Uint8Array(); + const nanoseconds = (time.nanoseconds || 0) + (milliseconds % 1000) * 1e6; + const nanosecondsArray = nanoseconds ? [0x10, ...encodeUvarint(nanoseconds)] : new Uint8Array(); + return Uint8Array.from([...secondsArray, ...nanosecondsArray]); +} +exports.encodeTime = encodeTime; +// See https://github.com/tendermint/go-amino/blob/v0.15.0/encoder.go#L180-L187 +function encodeBytes(bytes) { + // Since we're only dealing with short byte arrays we don't need a full VarBuffer implementation yet + if (bytes.length >= 0x80) + throw new Error("Not implemented for byte arrays of length 128 or more"); + return bytes.length ? Uint8Array.from([bytes.length, ...bytes]) : new Uint8Array(); +} +exports.encodeBytes = encodeBytes; +function encodeVersion(version) { + const blockArray = version.block + ? Uint8Array.from([0x08, ...encodeUvarint(version.block)]) + : new Uint8Array(); + const appArray = version.app ? Uint8Array.from([0x10, ...encodeUvarint(version.app)]) : new Uint8Array(); + return Uint8Array.from([...blockArray, ...appArray]); +} +exports.encodeVersion = encodeVersion; +function encodeBlockId(blockId) { + return Uint8Array.from([ + 0x0a, + blockId.hash.length, + ...blockId.hash, + 0x12, + blockId.parts.hash.length + 4, + 0x08, + blockId.parts.total, + 0x12, + blockId.parts.hash.length, + ...blockId.parts.hash, + ]); +} +exports.encodeBlockId = encodeBlockId; +//# sourceMappingURL=encodings.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/hasher.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/hasher.js ***! + \**************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.hashBlock = exports.hashTx = void 0; +const crypto_1 = __webpack_require__(/*! @cosmjs/crypto */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/index.js"); +const encodings_1 = __webpack_require__(/*! ./encodings */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/encodings.js"); +// hash is sha256 +// https://github.com/tendermint/tendermint/blob/master/UPGRADING.md#v0260 +function hashTx(tx) { + return (0, crypto_1.sha256)(tx); +} +exports.hashTx = hashTx; +function getSplitPoint(n) { + if (n < 1) + throw new Error("Cannot split an empty tree"); + const largestPowerOf2 = 2 ** Math.floor(Math.log2(n)); + return largestPowerOf2 < n ? largestPowerOf2 : largestPowerOf2 / 2; +} +function hashLeaf(leaf) { + const hash = new crypto_1.Sha256(Uint8Array.from([0])); + hash.update(leaf); + return hash.digest(); +} +function hashInner(left, right) { + const hash = new crypto_1.Sha256(Uint8Array.from([1])); + hash.update(left); + hash.update(right); + return hash.digest(); +} +// See https://github.com/tendermint/tendermint/blob/v0.31.8/docs/spec/blockchain/encoding.md#merkleroot +// Note: the hashes input may not actually be hashes, especially before a recursive call +function hashTree(hashes) { + switch (hashes.length) { + case 0: + throw new Error("Cannot hash empty tree"); + case 1: + return hashLeaf(hashes[0]); + default: { + const slicePoint = getSplitPoint(hashes.length); + const left = hashTree(hashes.slice(0, slicePoint)); + const right = hashTree(hashes.slice(slicePoint)); + return hashInner(left, right); + } + } +} +function hashBlock(header) { + if (!header.lastBlockId) { + throw new Error("Hashing a block header with no last block ID (i.e. header at height 1) is not supported. If you need this, contributions are welcome. Please add documentation and test vectors for this case."); + } + const encodedFields = [ + (0, encodings_1.encodeVersion)(header.version), + (0, encodings_1.encodeString)(header.chainId), + (0, encodings_1.encodeUvarint)(header.height), + (0, encodings_1.encodeTime)(header.time), + (0, encodings_1.encodeBlockId)(header.lastBlockId), + (0, encodings_1.encodeBytes)(header.lastCommitHash), + (0, encodings_1.encodeBytes)(header.dataHash), + (0, encodings_1.encodeBytes)(header.validatorsHash), + (0, encodings_1.encodeBytes)(header.nextValidatorsHash), + (0, encodings_1.encodeBytes)(header.consensusHash), + (0, encodings_1.encodeBytes)(header.appHash), + (0, encodings_1.encodeBytes)(header.lastResultsHash), + (0, encodings_1.encodeBytes)(header.evidenceHash), + (0, encodings_1.encodeBytes)(header.proposerAddress), + ]; + return hashTree(encodedFields); +} +exports.hashBlock = hashBlock; +//# sourceMappingURL=hasher.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/index.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/index.js ***! + \*************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +// Note: all exports in this module are publicly available via +// `import { tendermint37 } from "@cosmjs/tendermint-rpc"` +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Tendermint37Client = exports.VoteType = exports.broadcastTxSyncSuccess = exports.broadcastTxCommitSuccess = exports.SubscriptionEventType = exports.Method = void 0; +var requests_1 = __webpack_require__(/*! ./requests */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/requests.js"); +Object.defineProperty(exports, "Method", ({ enumerable: true, get: function () { return requests_1.Method; } })); +Object.defineProperty(exports, "SubscriptionEventType", ({ enumerable: true, get: function () { return requests_1.SubscriptionEventType; } })); +var responses_1 = __webpack_require__(/*! ./responses */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/responses.js"); +Object.defineProperty(exports, "broadcastTxCommitSuccess", ({ enumerable: true, get: function () { return responses_1.broadcastTxCommitSuccess; } })); +Object.defineProperty(exports, "broadcastTxSyncSuccess", ({ enumerable: true, get: function () { return responses_1.broadcastTxSyncSuccess; } })); +Object.defineProperty(exports, "VoteType", ({ enumerable: true, get: function () { return responses_1.VoteType; } })); +var tendermint37client_1 = __webpack_require__(/*! ./tendermint37client */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.js"); +Object.defineProperty(exports, "Tendermint37Client", ({ enumerable: true, get: function () { return tendermint37client_1.Tendermint37Client; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/requests.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/requests.js ***! + \****************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +/* eslint-disable @typescript-eslint/naming-convention */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.buildQuery = exports.SubscriptionEventType = exports.Method = void 0; +/** + * RPC methods as documented in https://docs.tendermint.com/master/rpc/ + * + * Enum raw value must match the spelling in the "shell" example call (snake_case) + */ +var Method; +(function (Method) { + Method["AbciInfo"] = "abci_info"; + Method["AbciQuery"] = "abci_query"; + Method["Block"] = "block"; + /** Get block headers for minHeight <= height <= maxHeight. */ + Method["Blockchain"] = "blockchain"; + Method["BlockResults"] = "block_results"; + Method["BlockSearch"] = "block_search"; + Method["BroadcastTxAsync"] = "broadcast_tx_async"; + Method["BroadcastTxSync"] = "broadcast_tx_sync"; + Method["BroadcastTxCommit"] = "broadcast_tx_commit"; + Method["Commit"] = "commit"; + Method["Genesis"] = "genesis"; + Method["Health"] = "health"; + Method["NumUnconfirmedTxs"] = "num_unconfirmed_txs"; + Method["Status"] = "status"; + Method["Subscribe"] = "subscribe"; + Method["Tx"] = "tx"; + Method["TxSearch"] = "tx_search"; + Method["Validators"] = "validators"; + Method["Unsubscribe"] = "unsubscribe"; +})(Method = exports.Method || (exports.Method = {})); +/** + * Raw values must match the tendermint event name + * + * @see https://godoc.org/github.com/tendermint/tendermint/types#pkg-constants + */ +var SubscriptionEventType; +(function (SubscriptionEventType) { + SubscriptionEventType["NewBlock"] = "NewBlock"; + SubscriptionEventType["NewBlockHeader"] = "NewBlockHeader"; + SubscriptionEventType["Tx"] = "Tx"; +})(SubscriptionEventType = exports.SubscriptionEventType || (exports.SubscriptionEventType = {})); +function buildQuery(components) { + const tags = components.tags ? components.tags : []; + const tagComponents = tags.map((tag) => `${tag.key}='${tag.value}'`); + const rawComponents = components.raw ? [components.raw] : []; + return [...tagComponents, ...rawComponents].join(" AND "); +} +exports.buildQuery = buildQuery; +//# sourceMappingURL=requests.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/responses.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/responses.js ***! + \*****************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.VoteType = exports.broadcastTxCommitSuccess = exports.broadcastTxSyncSuccess = void 0; +/** + * Returns true iff transaction made it successfully into the transaction pool + */ +function broadcastTxSyncSuccess(res) { + // code must be 0 on success + return res.code === 0; +} +exports.broadcastTxSyncSuccess = broadcastTxSyncSuccess; +/** + * Returns true iff transaction made it successfully into a block + * (i.e. success in `check_tx` and `deliver_tx` field) + */ +function broadcastTxCommitSuccess(response) { + // code must be 0 on success + // deliverTx may be present but empty on failure + return response.checkTx.code === 0 && !!response.deliverTx && response.deliverTx.code === 0; +} +exports.broadcastTxCommitSuccess = broadcastTxCommitSuccess; +/** + * raw values from https://github.com/tendermint/tendermint/blob/dfa9a9a30a666132425b29454e90a472aa579a48/types/vote.go#L44 + */ +var VoteType; +(function (VoteType) { + VoteType[VoteType["PreVote"] = 1] = "PreVote"; + VoteType[VoteType["PreCommit"] = 2] = "PreCommit"; +})(VoteType = exports.VoteType || (exports.VoteType = {})); +//# sourceMappingURL=responses.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/tendermint37client.js ***! + \**************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Tendermint37Client = void 0; +const jsonrpc_1 = __webpack_require__(/*! ../jsonrpc */ "./node_modules/@cosmjs/tendermint-rpc/build/jsonrpc.js"); +const rpcclients_1 = __webpack_require__(/*! ../rpcclients */ "./node_modules/@cosmjs/tendermint-rpc/build/rpcclients/index.js"); +const adaptor_1 = __webpack_require__(/*! ./adaptor */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/adaptor/index.js"); +const requests = __importStar(__webpack_require__(/*! ./requests */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/requests.js")); +class Tendermint37Client { + /** + * Use `Tendermint37Client.connect` or `Tendermint37Client.create` to create an instance. + */ + constructor(client) { + this.client = client; + this.p = adaptor_1.adaptor37.params; + this.r = adaptor_1.adaptor37.responses; + } + /** + * Creates a new Tendermint client for the given endpoint. + * + * Uses HTTP when the URL schema is http or https. Uses WebSockets otherwise. + */ + static async connect(endpoint) { + let rpcClient; + if (typeof endpoint === "object") { + rpcClient = new rpcclients_1.HttpClient(endpoint); + } + else { + const useHttp = endpoint.startsWith("http://") || endpoint.startsWith("https://"); + rpcClient = useHttp ? new rpcclients_1.HttpClient(endpoint) : new rpcclients_1.WebsocketClient(endpoint); + } + // For some very strange reason I don't understand, tests start to fail on some systems + // (our CI) when skipping the status call before doing other queries. Sleeping a little + // while did not help. Thus we query the version as a way to say "hi" to the backend, + // even in cases where we don't use the result. + const _version = await this.detectVersion(rpcClient); + return Tendermint37Client.create(rpcClient); + } + /** + * Creates a new Tendermint client given an RPC client. + */ + static async create(rpcClient) { + return new Tendermint37Client(rpcClient); + } + static async detectVersion(client) { + const req = (0, jsonrpc_1.createJsonRpcRequest)(requests.Method.Status); + const response = await client.execute(req); + const result = response.result; + if (!result || !result.node_info) { + throw new Error("Unrecognized format for status response"); + } + const version = result.node_info.version; + if (typeof version !== "string") { + throw new Error("Unrecognized version format: must be string"); + } + return version; + } + disconnect() { + this.client.disconnect(); + } + async abciInfo() { + const query = { method: requests.Method.AbciInfo }; + return this.doCall(query, this.p.encodeAbciInfo, this.r.decodeAbciInfo); + } + async abciQuery(params) { + const query = { params: params, method: requests.Method.AbciQuery }; + return this.doCall(query, this.p.encodeAbciQuery, this.r.decodeAbciQuery); + } + async block(height) { + const query = { method: requests.Method.Block, params: { height: height } }; + return this.doCall(query, this.p.encodeBlock, this.r.decodeBlock); + } + async blockResults(height) { + const query = { + method: requests.Method.BlockResults, + params: { height: height }, + }; + return this.doCall(query, this.p.encodeBlockResults, this.r.decodeBlockResults); + } + /** + * Search for events that are in a block. + * + * NOTE + * This method will error on any node that is running a Tendermint version lower than 0.34.9. + * + * @see https://docs.tendermint.com/master/rpc/#/Info/block_search + */ + async blockSearch(params) { + const query = { params: params, method: requests.Method.BlockSearch }; + const resp = await this.doCall(query, this.p.encodeBlockSearch, this.r.decodeBlockSearch); + return { + ...resp, + // make sure we sort by height, as tendermint may be sorting by string value of the height + blocks: [...resp.blocks].sort((a, b) => a.block.header.height - b.block.header.height), + }; + } + // this should paginate through all blockSearch options to ensure it returns all results. + // starts with page 1 or whatever was provided (eg. to start on page 7) + // + // NOTE + // This method will error on any node that is running a Tendermint version lower than 0.34.9. + async blockSearchAll(params) { + let page = params.page || 1; + const blocks = []; + let done = false; + while (!done) { + const resp = await this.blockSearch({ ...params, page: page }); + blocks.push(...resp.blocks); + if (blocks.length < resp.totalCount) { + page++; + } + else { + done = true; + } + } + // make sure we sort by height, as tendermint may be sorting by string value of the height + // and the earlier items may be in a higher page than the later items + blocks.sort((a, b) => a.block.header.height - b.block.header.height); + return { + totalCount: blocks.length, + blocks: blocks, + }; + } + /** + * Queries block headers filtered by minHeight <= height <= maxHeight. + * + * @param minHeight The minimum height to be included in the result. Defaults to 0. + * @param maxHeight The maximum height to be included in the result. Defaults to infinity. + */ + async blockchain(minHeight, maxHeight) { + const query = { + method: requests.Method.Blockchain, + params: { + minHeight: minHeight, + maxHeight: maxHeight, + }, + }; + return this.doCall(query, this.p.encodeBlockchain, this.r.decodeBlockchain); + } + /** + * Broadcast transaction to mempool and wait for response + * + * @see https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_sync + */ + async broadcastTxSync(params) { + const query = { params: params, method: requests.Method.BroadcastTxSync }; + return this.doCall(query, this.p.encodeBroadcastTx, this.r.decodeBroadcastTxSync); + } + /** + * Broadcast transaction to mempool and do not wait for result + * + * @see https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_async + */ + async broadcastTxAsync(params) { + const query = { params: params, method: requests.Method.BroadcastTxAsync }; + return this.doCall(query, this.p.encodeBroadcastTx, this.r.decodeBroadcastTxAsync); + } + /** + * Broadcast transaction to mempool and wait for block + * + * @see https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_commit + */ + async broadcastTxCommit(params) { + const query = { params: params, method: requests.Method.BroadcastTxCommit }; + return this.doCall(query, this.p.encodeBroadcastTx, this.r.decodeBroadcastTxCommit); + } + async commit(height) { + const query = { method: requests.Method.Commit, params: { height: height } }; + return this.doCall(query, this.p.encodeCommit, this.r.decodeCommit); + } + async genesis() { + const query = { method: requests.Method.Genesis }; + return this.doCall(query, this.p.encodeGenesis, this.r.decodeGenesis); + } + async health() { + const query = { method: requests.Method.Health }; + return this.doCall(query, this.p.encodeHealth, this.r.decodeHealth); + } + async numUnconfirmedTxs() { + const query = { method: requests.Method.NumUnconfirmedTxs }; + return this.doCall(query, this.p.encodeNumUnconfirmedTxs, this.r.decodeNumUnconfirmedTxs); + } + async status() { + const query = { method: requests.Method.Status }; + return this.doCall(query, this.p.encodeStatus, this.r.decodeStatus); + } + subscribeNewBlock() { + const request = { + method: requests.Method.Subscribe, + query: { type: requests.SubscriptionEventType.NewBlock }, + }; + return this.subscribe(request, this.r.decodeNewBlockEvent); + } + subscribeNewBlockHeader() { + const request = { + method: requests.Method.Subscribe, + query: { type: requests.SubscriptionEventType.NewBlockHeader }, + }; + return this.subscribe(request, this.r.decodeNewBlockHeaderEvent); + } + subscribeTx(query) { + const request = { + method: requests.Method.Subscribe, + query: { + type: requests.SubscriptionEventType.Tx, + raw: query, + }, + }; + return this.subscribe(request, this.r.decodeTxEvent); + } + /** + * Get a single transaction by hash + * + * @see https://docs.tendermint.com/master/rpc/#/Info/tx + */ + async tx(params) { + const query = { params: params, method: requests.Method.Tx }; + return this.doCall(query, this.p.encodeTx, this.r.decodeTx); + } + /** + * Search for transactions that are in a block + * + * @see https://docs.tendermint.com/master/rpc/#/Info/tx_search + */ + async txSearch(params) { + const query = { params: params, method: requests.Method.TxSearch }; + return this.doCall(query, this.p.encodeTxSearch, this.r.decodeTxSearch); + } + // this should paginate through all txSearch options to ensure it returns all results. + // starts with page 1 or whatever was provided (eg. to start on page 7) + async txSearchAll(params) { + let page = params.page || 1; + const txs = []; + let done = false; + while (!done) { + const resp = await this.txSearch({ ...params, page: page }); + txs.push(...resp.txs); + if (txs.length < resp.totalCount) { + page++; + } + else { + done = true; + } + } + return { + totalCount: txs.length, + txs: txs, + }; + } + async validators(params) { + const query = { + method: requests.Method.Validators, + params: params, + }; + return this.doCall(query, this.p.encodeValidators, this.r.decodeValidators); + } + async validatorsAll(height) { + const validators = []; + let page = 1; + let done = false; + let blockHeight = height; + while (!done) { + const response = await this.validators({ + per_page: 50, + height: blockHeight, + page: page, + }); + validators.push(...response.validators); + blockHeight = blockHeight || response.blockHeight; + if (validators.length < response.total) { + page++; + } + else { + done = true; + } + } + return { + // NOTE: Default value is for type safety but this should always be set + blockHeight: blockHeight ?? 0, + count: validators.length, + total: validators.length, + validators: validators, + }; + } + // doCall is a helper to handle the encode/call/decode logic + async doCall(request, encode, decode) { + const req = encode(request); + const result = await this.client.execute(req); + return decode(result); + } + subscribe(request, decode) { + if (!(0, rpcclients_1.instanceOfRpcStreamingClient)(this.client)) { + throw new Error("This RPC client type cannot subscribe to events"); + } + const req = this.p.encodeSubscribe(request); + const eventStream = this.client.listen(req); + return eventStream.map((event) => { + return decode(event); + }); + } +} +exports.Tendermint37Client = Tendermint37Client; +//# sourceMappingURL=tendermint37client.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/tendermintclient.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/tendermintclient.js ***! + \***********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isTendermint37Client = exports.isTendermint34Client = void 0; +const tendermint34_1 = __webpack_require__(/*! ./tendermint34 */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint34/index.js"); +const tendermint37_1 = __webpack_require__(/*! ./tendermint37 */ "./node_modules/@cosmjs/tendermint-rpc/build/tendermint37/index.js"); +function isTendermint34Client(client) { + return client instanceof tendermint34_1.Tendermint34Client; +} +exports.isTendermint34Client = isTendermint34Client; +function isTendermint37Client(client) { + return client instanceof tendermint37_1.Tendermint37Client; +} +exports.isTendermint37Client = isTendermint37Client; +//# sourceMappingURL=tendermintclient.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/build/types.js": +/*!************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/build/types.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +// Types in this file are exported outside of the @cosmjs/tendermint-rpc package, +// e.g. as part of a request or response +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BlockIdFlag = void 0; +var BlockIdFlag; +(function (BlockIdFlag) { + BlockIdFlag[BlockIdFlag["Unknown"] = 0] = "Unknown"; + BlockIdFlag[BlockIdFlag["Absent"] = 1] = "Absent"; + BlockIdFlag[BlockIdFlag["Commit"] = 2] = "Commit"; + BlockIdFlag[BlockIdFlag["Nil"] = 3] = "Nil"; + BlockIdFlag[BlockIdFlag["Unrecognized"] = -1] = "Unrecognized"; +})(BlockIdFlag = exports.BlockIdFlag || (exports.BlockIdFlag = {})); +//# sourceMappingURL=types.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/bip39.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/bip39.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Bip39 = exports.EnglishMnemonic = exports.mnemonicToEntropy = exports.entropyToMnemonic = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js"); +const pbkdf2_1 = __webpack_require__(/*! ./pbkdf2 */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/pbkdf2.js"); +const sha_1 = __webpack_require__(/*! ./sha */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/sha.js"); +const wordlist = [ + "abandon", + "ability", + "able", + "about", + "above", + "absent", + "absorb", + "abstract", + "absurd", + "abuse", + "access", + "accident", + "account", + "accuse", + "achieve", + "acid", + "acoustic", + "acquire", + "across", + "act", + "action", + "actor", + "actress", + "actual", + "adapt", + "add", + "addict", + "address", + "adjust", + "admit", + "adult", + "advance", + "advice", + "aerobic", + "affair", + "afford", + "afraid", + "again", + "age", + "agent", + "agree", + "ahead", + "aim", + "air", + "airport", + "aisle", + "alarm", + "album", + "alcohol", + "alert", + "alien", + "all", + "alley", + "allow", + "almost", + "alone", + "alpha", + "already", + "also", + "alter", + "always", + "amateur", + "amazing", + "among", + "amount", + "amused", + "analyst", + "anchor", + "ancient", + "anger", + "angle", + "angry", + "animal", + "ankle", + "announce", + "annual", + "another", + "answer", + "antenna", + "antique", + "anxiety", + "any", + "apart", + "apology", + "appear", + "apple", + "approve", + "april", + "arch", + "arctic", + "area", + "arena", + "argue", + "arm", + "armed", + "armor", + "army", + "around", + "arrange", + "arrest", + "arrive", + "arrow", + "art", + "artefact", + "artist", + "artwork", + "ask", + "aspect", + "assault", + "asset", + "assist", + "assume", + "asthma", + "athlete", + "atom", + "attack", + "attend", + "attitude", + "attract", + "auction", + "audit", + "august", + "aunt", + "author", + "auto", + "autumn", + "average", + "avocado", + "avoid", + "awake", + "aware", + "away", + "awesome", + "awful", + "awkward", + "axis", + "baby", + "bachelor", + "bacon", + "badge", + "bag", + "balance", + "balcony", + "ball", + "bamboo", + "banana", + "banner", + "bar", + "barely", + "bargain", + "barrel", + "base", + "basic", + "basket", + "battle", + "beach", + "bean", + "beauty", + "because", + "become", + "beef", + "before", + "begin", + "behave", + "behind", + "believe", + "below", + "belt", + "bench", + "benefit", + "best", + "betray", + "better", + "between", + "beyond", + "bicycle", + "bid", + "bike", + "bind", + "biology", + "bird", + "birth", + "bitter", + "black", + "blade", + "blame", + "blanket", + "blast", + "bleak", + "bless", + "blind", + "blood", + "blossom", + "blouse", + "blue", + "blur", + "blush", + "board", + "boat", + "body", + "boil", + "bomb", + "bone", + "bonus", + "book", + "boost", + "border", + "boring", + "borrow", + "boss", + "bottom", + "bounce", + "box", + "boy", + "bracket", + "brain", + "brand", + "brass", + "brave", + "bread", + "breeze", + "brick", + "bridge", + "brief", + "bright", + "bring", + "brisk", + "broccoli", + "broken", + "bronze", + "broom", + "brother", + "brown", + "brush", + "bubble", + "buddy", + "budget", + "buffalo", + "build", + "bulb", + "bulk", + "bullet", + "bundle", + "bunker", + "burden", + "burger", + "burst", + "bus", + "business", + "busy", + "butter", + "buyer", + "buzz", + "cabbage", + "cabin", + "cable", + "cactus", + "cage", + "cake", + "call", + "calm", + "camera", + "camp", + "can", + "canal", + "cancel", + "candy", + "cannon", + "canoe", + "canvas", + "canyon", + "capable", + "capital", + "captain", + "car", + "carbon", + "card", + "cargo", + "carpet", + "carry", + "cart", + "case", + "cash", + "casino", + "castle", + "casual", + "cat", + "catalog", + "catch", + "category", + "cattle", + "caught", + "cause", + "caution", + "cave", + "ceiling", + "celery", + "cement", + "census", + "century", + "cereal", + "certain", + "chair", + "chalk", + "champion", + "change", + "chaos", + "chapter", + "charge", + "chase", + "chat", + "cheap", + "check", + "cheese", + "chef", + "cherry", + "chest", + "chicken", + "chief", + "child", + "chimney", + "choice", + "choose", + "chronic", + "chuckle", + "chunk", + "churn", + "cigar", + "cinnamon", + "circle", + "citizen", + "city", + "civil", + "claim", + "clap", + "clarify", + "claw", + "clay", + "clean", + "clerk", + "clever", + "click", + "client", + "cliff", + "climb", + "clinic", + "clip", + "clock", + "clog", + "close", + "cloth", + "cloud", + "clown", + "club", + "clump", + "cluster", + "clutch", + "coach", + "coast", + "coconut", + "code", + "coffee", + "coil", + "coin", + "collect", + "color", + "column", + "combine", + "come", + "comfort", + "comic", + "common", + "company", + "concert", + "conduct", + "confirm", + "congress", + "connect", + "consider", + "control", + "convince", + "cook", + "cool", + "copper", + "copy", + "coral", + "core", + "corn", + "correct", + "cost", + "cotton", + "couch", + "country", + "couple", + "course", + "cousin", + "cover", + "coyote", + "crack", + "cradle", + "craft", + "cram", + "crane", + "crash", + "crater", + "crawl", + "crazy", + "cream", + "credit", + "creek", + "crew", + "cricket", + "crime", + "crisp", + "critic", + "crop", + "cross", + "crouch", + "crowd", + "crucial", + "cruel", + "cruise", + "crumble", + "crunch", + "crush", + "cry", + "crystal", + "cube", + "culture", + "cup", + "cupboard", + "curious", + "current", + "curtain", + "curve", + "cushion", + "custom", + "cute", + "cycle", + "dad", + "damage", + "damp", + "dance", + "danger", + "daring", + "dash", + "daughter", + "dawn", + "day", + "deal", + "debate", + "debris", + "decade", + "december", + "decide", + "decline", + "decorate", + "decrease", + "deer", + "defense", + "define", + "defy", + "degree", + "delay", + "deliver", + "demand", + "demise", + "denial", + "dentist", + "deny", + "depart", + "depend", + "deposit", + "depth", + "deputy", + "derive", + "describe", + "desert", + "design", + "desk", + "despair", + "destroy", + "detail", + "detect", + "develop", + "device", + "devote", + "diagram", + "dial", + "diamond", + "diary", + "dice", + "diesel", + "diet", + "differ", + "digital", + "dignity", + "dilemma", + "dinner", + "dinosaur", + "direct", + "dirt", + "disagree", + "discover", + "disease", + "dish", + "dismiss", + "disorder", + "display", + "distance", + "divert", + "divide", + "divorce", + "dizzy", + "doctor", + "document", + "dog", + "doll", + "dolphin", + "domain", + "donate", + "donkey", + "donor", + "door", + "dose", + "double", + "dove", + "draft", + "dragon", + "drama", + "drastic", + "draw", + "dream", + "dress", + "drift", + "drill", + "drink", + "drip", + "drive", + "drop", + "drum", + "dry", + "duck", + "dumb", + "dune", + "during", + "dust", + "dutch", + "duty", + "dwarf", + "dynamic", + "eager", + "eagle", + "early", + "earn", + "earth", + "easily", + "east", + "easy", + "echo", + "ecology", + "economy", + "edge", + "edit", + "educate", + "effort", + "egg", + "eight", + "either", + "elbow", + "elder", + "electric", + "elegant", + "element", + "elephant", + "elevator", + "elite", + "else", + "embark", + "embody", + "embrace", + "emerge", + "emotion", + "employ", + "empower", + "empty", + "enable", + "enact", + "end", + "endless", + "endorse", + "enemy", + "energy", + "enforce", + "engage", + "engine", + "enhance", + "enjoy", + "enlist", + "enough", + "enrich", + "enroll", + "ensure", + "enter", + "entire", + "entry", + "envelope", + "episode", + "equal", + "equip", + "era", + "erase", + "erode", + "erosion", + "error", + "erupt", + "escape", + "essay", + "essence", + "estate", + "eternal", + "ethics", + "evidence", + "evil", + "evoke", + "evolve", + "exact", + "example", + "excess", + "exchange", + "excite", + "exclude", + "excuse", + "execute", + "exercise", + "exhaust", + "exhibit", + "exile", + "exist", + "exit", + "exotic", + "expand", + "expect", + "expire", + "explain", + "expose", + "express", + "extend", + "extra", + "eye", + "eyebrow", + "fabric", + "face", + "faculty", + "fade", + "faint", + "faith", + "fall", + "false", + "fame", + "family", + "famous", + "fan", + "fancy", + "fantasy", + "farm", + "fashion", + "fat", + "fatal", + "father", + "fatigue", + "fault", + "favorite", + "feature", + "february", + "federal", + "fee", + "feed", + "feel", + "female", + "fence", + "festival", + "fetch", + "fever", + "few", + "fiber", + "fiction", + "field", + "figure", + "file", + "film", + "filter", + "final", + "find", + "fine", + "finger", + "finish", + "fire", + "firm", + "first", + "fiscal", + "fish", + "fit", + "fitness", + "fix", + "flag", + "flame", + "flash", + "flat", + "flavor", + "flee", + "flight", + "flip", + "float", + "flock", + "floor", + "flower", + "fluid", + "flush", + "fly", + "foam", + "focus", + "fog", + "foil", + "fold", + "follow", + "food", + "foot", + "force", + "forest", + "forget", + "fork", + "fortune", + "forum", + "forward", + "fossil", + "foster", + "found", + "fox", + "fragile", + "frame", + "frequent", + "fresh", + "friend", + "fringe", + "frog", + "front", + "frost", + "frown", + "frozen", + "fruit", + "fuel", + "fun", + "funny", + "furnace", + "fury", + "future", + "gadget", + "gain", + "galaxy", + "gallery", + "game", + "gap", + "garage", + "garbage", + "garden", + "garlic", + "garment", + "gas", + "gasp", + "gate", + "gather", + "gauge", + "gaze", + "general", + "genius", + "genre", + "gentle", + "genuine", + "gesture", + "ghost", + "giant", + "gift", + "giggle", + "ginger", + "giraffe", + "girl", + "give", + "glad", + "glance", + "glare", + "glass", + "glide", + "glimpse", + "globe", + "gloom", + "glory", + "glove", + "glow", + "glue", + "goat", + "goddess", + "gold", + "good", + "goose", + "gorilla", + "gospel", + "gossip", + "govern", + "gown", + "grab", + "grace", + "grain", + "grant", + "grape", + "grass", + "gravity", + "great", + "green", + "grid", + "grief", + "grit", + "grocery", + "group", + "grow", + "grunt", + "guard", + "guess", + "guide", + "guilt", + "guitar", + "gun", + "gym", + "habit", + "hair", + "half", + "hammer", + "hamster", + "hand", + "happy", + "harbor", + "hard", + "harsh", + "harvest", + "hat", + "have", + "hawk", + "hazard", + "head", + "health", + "heart", + "heavy", + "hedgehog", + "height", + "hello", + "helmet", + "help", + "hen", + "hero", + "hidden", + "high", + "hill", + "hint", + "hip", + "hire", + "history", + "hobby", + "hockey", + "hold", + "hole", + "holiday", + "hollow", + "home", + "honey", + "hood", + "hope", + "horn", + "horror", + "horse", + "hospital", + "host", + "hotel", + "hour", + "hover", + "hub", + "huge", + "human", + "humble", + "humor", + "hundred", + "hungry", + "hunt", + "hurdle", + "hurry", + "hurt", + "husband", + "hybrid", + "ice", + "icon", + "idea", + "identify", + "idle", + "ignore", + "ill", + "illegal", + "illness", + "image", + "imitate", + "immense", + "immune", + "impact", + "impose", + "improve", + "impulse", + "inch", + "include", + "income", + "increase", + "index", + "indicate", + "indoor", + "industry", + "infant", + "inflict", + "inform", + "inhale", + "inherit", + "initial", + "inject", + "injury", + "inmate", + "inner", + "innocent", + "input", + "inquiry", + "insane", + "insect", + "inside", + "inspire", + "install", + "intact", + "interest", + "into", + "invest", + "invite", + "involve", + "iron", + "island", + "isolate", + "issue", + "item", + "ivory", + "jacket", + "jaguar", + "jar", + "jazz", + "jealous", + "jeans", + "jelly", + "jewel", + "job", + "join", + "joke", + "journey", + "joy", + "judge", + "juice", + "jump", + "jungle", + "junior", + "junk", + "just", + "kangaroo", + "keen", + "keep", + "ketchup", + "key", + "kick", + "kid", + "kidney", + "kind", + "kingdom", + "kiss", + "kit", + "kitchen", + "kite", + "kitten", + "kiwi", + "knee", + "knife", + "knock", + "know", + "lab", + "label", + "labor", + "ladder", + "lady", + "lake", + "lamp", + "language", + "laptop", + "large", + "later", + "latin", + "laugh", + "laundry", + "lava", + "law", + "lawn", + "lawsuit", + "layer", + "lazy", + "leader", + "leaf", + "learn", + "leave", + "lecture", + "left", + "leg", + "legal", + "legend", + "leisure", + "lemon", + "lend", + "length", + "lens", + "leopard", + "lesson", + "letter", + "level", + "liar", + "liberty", + "library", + "license", + "life", + "lift", + "light", + "like", + "limb", + "limit", + "link", + "lion", + "liquid", + "list", + "little", + "live", + "lizard", + "load", + "loan", + "lobster", + "local", + "lock", + "logic", + "lonely", + "long", + "loop", + "lottery", + "loud", + "lounge", + "love", + "loyal", + "lucky", + "luggage", + "lumber", + "lunar", + "lunch", + "luxury", + "lyrics", + "machine", + "mad", + "magic", + "magnet", + "maid", + "mail", + "main", + "major", + "make", + "mammal", + "man", + "manage", + "mandate", + "mango", + "mansion", + "manual", + "maple", + "marble", + "march", + "margin", + "marine", + "market", + "marriage", + "mask", + "mass", + "master", + "match", + "material", + "math", + "matrix", + "matter", + "maximum", + "maze", + "meadow", + "mean", + "measure", + "meat", + "mechanic", + "medal", + "media", + "melody", + "melt", + "member", + "memory", + "mention", + "menu", + "mercy", + "merge", + "merit", + "merry", + "mesh", + "message", + "metal", + "method", + "middle", + "midnight", + "milk", + "million", + "mimic", + "mind", + "minimum", + "minor", + "minute", + "miracle", + "mirror", + "misery", + "miss", + "mistake", + "mix", + "mixed", + "mixture", + "mobile", + "model", + "modify", + "mom", + "moment", + "monitor", + "monkey", + "monster", + "month", + "moon", + "moral", + "more", + "morning", + "mosquito", + "mother", + "motion", + "motor", + "mountain", + "mouse", + "move", + "movie", + "much", + "muffin", + "mule", + "multiply", + "muscle", + "museum", + "mushroom", + "music", + "must", + "mutual", + "myself", + "mystery", + "myth", + "naive", + "name", + "napkin", + "narrow", + "nasty", + "nation", + "nature", + "near", + "neck", + "need", + "negative", + "neglect", + "neither", + "nephew", + "nerve", + "nest", + "net", + "network", + "neutral", + "never", + "news", + "next", + "nice", + "night", + "noble", + "noise", + "nominee", + "noodle", + "normal", + "north", + "nose", + "notable", + "note", + "nothing", + "notice", + "novel", + "now", + "nuclear", + "number", + "nurse", + "nut", + "oak", + "obey", + "object", + "oblige", + "obscure", + "observe", + "obtain", + "obvious", + "occur", + "ocean", + "october", + "odor", + "off", + "offer", + "office", + "often", + "oil", + "okay", + "old", + "olive", + "olympic", + "omit", + "once", + "one", + "onion", + "online", + "only", + "open", + "opera", + "opinion", + "oppose", + "option", + "orange", + "orbit", + "orchard", + "order", + "ordinary", + "organ", + "orient", + "original", + "orphan", + "ostrich", + "other", + "outdoor", + "outer", + "output", + "outside", + "oval", + "oven", + "over", + "own", + "owner", + "oxygen", + "oyster", + "ozone", + "pact", + "paddle", + "page", + "pair", + "palace", + "palm", + "panda", + "panel", + "panic", + "panther", + "paper", + "parade", + "parent", + "park", + "parrot", + "party", + "pass", + "patch", + "path", + "patient", + "patrol", + "pattern", + "pause", + "pave", + "payment", + "peace", + "peanut", + "pear", + "peasant", + "pelican", + "pen", + "penalty", + "pencil", + "people", + "pepper", + "perfect", + "permit", + "person", + "pet", + "phone", + "photo", + "phrase", + "physical", + "piano", + "picnic", + "picture", + "piece", + "pig", + "pigeon", + "pill", + "pilot", + "pink", + "pioneer", + "pipe", + "pistol", + "pitch", + "pizza", + "place", + "planet", + "plastic", + "plate", + "play", + "please", + "pledge", + "pluck", + "plug", + "plunge", + "poem", + "poet", + "point", + "polar", + "pole", + "police", + "pond", + "pony", + "pool", + "popular", + "portion", + "position", + "possible", + "post", + "potato", + "pottery", + "poverty", + "powder", + "power", + "practice", + "praise", + "predict", + "prefer", + "prepare", + "present", + "pretty", + "prevent", + "price", + "pride", + "primary", + "print", + "priority", + "prison", + "private", + "prize", + "problem", + "process", + "produce", + "profit", + "program", + "project", + "promote", + "proof", + "property", + "prosper", + "protect", + "proud", + "provide", + "public", + "pudding", + "pull", + "pulp", + "pulse", + "pumpkin", + "punch", + "pupil", + "puppy", + "purchase", + "purity", + "purpose", + "purse", + "push", + "put", + "puzzle", + "pyramid", + "quality", + "quantum", + "quarter", + "question", + "quick", + "quit", + "quiz", + "quote", + "rabbit", + "raccoon", + "race", + "rack", + "radar", + "radio", + "rail", + "rain", + "raise", + "rally", + "ramp", + "ranch", + "random", + "range", + "rapid", + "rare", + "rate", + "rather", + "raven", + "raw", + "razor", + "ready", + "real", + "reason", + "rebel", + "rebuild", + "recall", + "receive", + "recipe", + "record", + "recycle", + "reduce", + "reflect", + "reform", + "refuse", + "region", + "regret", + "regular", + "reject", + "relax", + "release", + "relief", + "rely", + "remain", + "remember", + "remind", + "remove", + "render", + "renew", + "rent", + "reopen", + "repair", + "repeat", + "replace", + "report", + "require", + "rescue", + "resemble", + "resist", + "resource", + "response", + "result", + "retire", + "retreat", + "return", + "reunion", + "reveal", + "review", + "reward", + "rhythm", + "rib", + "ribbon", + "rice", + "rich", + "ride", + "ridge", + "rifle", + "right", + "rigid", + "ring", + "riot", + "ripple", + "risk", + "ritual", + "rival", + "river", + "road", + "roast", + "robot", + "robust", + "rocket", + "romance", + "roof", + "rookie", + "room", + "rose", + "rotate", + "rough", + "round", + "route", + "royal", + "rubber", + "rude", + "rug", + "rule", + "run", + "runway", + "rural", + "sad", + "saddle", + "sadness", + "safe", + "sail", + "salad", + "salmon", + "salon", + "salt", + "salute", + "same", + "sample", + "sand", + "satisfy", + "satoshi", + "sauce", + "sausage", + "save", + "say", + "scale", + "scan", + "scare", + "scatter", + "scene", + "scheme", + "school", + "science", + "scissors", + "scorpion", + "scout", + "scrap", + "screen", + "script", + "scrub", + "sea", + "search", + "season", + "seat", + "second", + "secret", + "section", + "security", + "seed", + "seek", + "segment", + "select", + "sell", + "seminar", + "senior", + "sense", + "sentence", + "series", + "service", + "session", + "settle", + "setup", + "seven", + "shadow", + "shaft", + "shallow", + "share", + "shed", + "shell", + "sheriff", + "shield", + "shift", + "shine", + "ship", + "shiver", + "shock", + "shoe", + "shoot", + "shop", + "short", + "shoulder", + "shove", + "shrimp", + "shrug", + "shuffle", + "shy", + "sibling", + "sick", + "side", + "siege", + "sight", + "sign", + "silent", + "silk", + "silly", + "silver", + "similar", + "simple", + "since", + "sing", + "siren", + "sister", + "situate", + "six", + "size", + "skate", + "sketch", + "ski", + "skill", + "skin", + "skirt", + "skull", + "slab", + "slam", + "sleep", + "slender", + "slice", + "slide", + "slight", + "slim", + "slogan", + "slot", + "slow", + "slush", + "small", + "smart", + "smile", + "smoke", + "smooth", + "snack", + "snake", + "snap", + "sniff", + "snow", + "soap", + "soccer", + "social", + "sock", + "soda", + "soft", + "solar", + "soldier", + "solid", + "solution", + "solve", + "someone", + "song", + "soon", + "sorry", + "sort", + "soul", + "sound", + "soup", + "source", + "south", + "space", + "spare", + "spatial", + "spawn", + "speak", + "special", + "speed", + "spell", + "spend", + "sphere", + "spice", + "spider", + "spike", + "spin", + "spirit", + "split", + "spoil", + "sponsor", + "spoon", + "sport", + "spot", + "spray", + "spread", + "spring", + "spy", + "square", + "squeeze", + "squirrel", + "stable", + "stadium", + "staff", + "stage", + "stairs", + "stamp", + "stand", + "start", + "state", + "stay", + "steak", + "steel", + "stem", + "step", + "stereo", + "stick", + "still", + "sting", + "stock", + "stomach", + "stone", + "stool", + "story", + "stove", + "strategy", + "street", + "strike", + "strong", + "struggle", + "student", + "stuff", + "stumble", + "style", + "subject", + "submit", + "subway", + "success", + "such", + "sudden", + "suffer", + "sugar", + "suggest", + "suit", + "summer", + "sun", + "sunny", + "sunset", + "super", + "supply", + "supreme", + "sure", + "surface", + "surge", + "surprise", + "surround", + "survey", + "suspect", + "sustain", + "swallow", + "swamp", + "swap", + "swarm", + "swear", + "sweet", + "swift", + "swim", + "swing", + "switch", + "sword", + "symbol", + "symptom", + "syrup", + "system", + "table", + "tackle", + "tag", + "tail", + "talent", + "talk", + "tank", + "tape", + "target", + "task", + "taste", + "tattoo", + "taxi", + "teach", + "team", + "tell", + "ten", + "tenant", + "tennis", + "tent", + "term", + "test", + "text", + "thank", + "that", + "theme", + "then", + "theory", + "there", + "they", + "thing", + "this", + "thought", + "three", + "thrive", + "throw", + "thumb", + "thunder", + "ticket", + "tide", + "tiger", + "tilt", + "timber", + "time", + "tiny", + "tip", + "tired", + "tissue", + "title", + "toast", + "tobacco", + "today", + "toddler", + "toe", + "together", + "toilet", + "token", + "tomato", + "tomorrow", + "tone", + "tongue", + "tonight", + "tool", + "tooth", + "top", + "topic", + "topple", + "torch", + "tornado", + "tortoise", + "toss", + "total", + "tourist", + "toward", + "tower", + "town", + "toy", + "track", + "trade", + "traffic", + "tragic", + "train", + "transfer", + "trap", + "trash", + "travel", + "tray", + "treat", + "tree", + "trend", + "trial", + "tribe", + "trick", + "trigger", + "trim", + "trip", + "trophy", + "trouble", + "truck", + "true", + "truly", + "trumpet", + "trust", + "truth", + "try", + "tube", + "tuition", + "tumble", + "tuna", + "tunnel", + "turkey", + "turn", + "turtle", + "twelve", + "twenty", + "twice", + "twin", + "twist", + "two", + "type", + "typical", + "ugly", + "umbrella", + "unable", + "unaware", + "uncle", + "uncover", + "under", + "undo", + "unfair", + "unfold", + "unhappy", + "uniform", + "unique", + "unit", + "universe", + "unknown", + "unlock", + "until", + "unusual", + "unveil", + "update", + "upgrade", + "uphold", + "upon", + "upper", + "upset", + "urban", + "urge", + "usage", + "use", + "used", + "useful", + "useless", + "usual", + "utility", + "vacant", + "vacuum", + "vague", + "valid", + "valley", + "valve", + "van", + "vanish", + "vapor", + "various", + "vast", + "vault", + "vehicle", + "velvet", + "vendor", + "venture", + "venue", + "verb", + "verify", + "version", + "very", + "vessel", + "veteran", + "viable", + "vibrant", + "vicious", + "victory", + "video", + "view", + "village", + "vintage", + "violin", + "virtual", + "virus", + "visa", + "visit", + "visual", + "vital", + "vivid", + "vocal", + "voice", + "void", + "volcano", + "volume", + "vote", + "voyage", + "wage", + "wagon", + "wait", + "walk", + "wall", + "walnut", + "want", + "warfare", + "warm", + "warrior", + "wash", + "wasp", + "waste", + "water", + "wave", + "way", + "wealth", + "weapon", + "wear", + "weasel", + "weather", + "web", + "wedding", + "weekend", + "weird", + "welcome", + "west", + "wet", + "whale", + "what", + "wheat", + "wheel", + "when", + "where", + "whip", + "whisper", + "wide", + "width", + "wife", + "wild", + "will", + "win", + "window", + "wine", + "wing", + "wink", + "winner", + "winter", + "wire", + "wisdom", + "wise", + "wish", + "witness", + "wolf", + "woman", + "wonder", + "wood", + "wool", + "word", + "work", + "world", + "worry", + "worth", + "wrap", + "wreck", + "wrestle", + "wrist", + "write", + "wrong", + "yard", + "year", + "yellow", + "you", + "young", + "youth", + "zebra", + "zero", + "zone", + "zoo", +]; +function bytesToBitstring(bytes) { + return Array.from(bytes) + .map((byte) => byte.toString(2).padStart(8, "0")) + .join(""); +} +function deriveChecksumBits(entropy) { + const entropyLengthBits = entropy.length * 8; // "ENT" (in bits) + const checksumLengthBits = entropyLengthBits / 32; // "CS" (in bits) + const hash = (0, sha_1.sha256)(entropy); + return bytesToBitstring(hash).slice(0, checksumLengthBits); +} +function bitstringToByte(bin) { + return parseInt(bin, 2); +} +const allowedEntropyLengths = [16, 20, 24, 28, 32]; +const allowedWordLengths = [12, 15, 18, 21, 24]; +function entropyToMnemonic(entropy) { + if (allowedEntropyLengths.indexOf(entropy.length) === -1) { + throw new Error("invalid input length"); + } + const entropyBits = bytesToBitstring(entropy); + const checksumBits = deriveChecksumBits(entropy); + const bits = entropyBits + checksumBits; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const chunks = bits.match(/(.{11})/g); + const words = chunks.map((binary) => { + const index = bitstringToByte(binary); + return wordlist[index]; + }); + return words.join(" "); +} +exports.entropyToMnemonic = entropyToMnemonic; +const invalidNumberOfWorks = "Invalid number of words"; +const wordNotInWordlist = "Found word that is not in the wordlist"; +const invalidEntropy = "Invalid entropy"; +const invalidChecksum = "Invalid mnemonic checksum"; +function normalize(str) { + return str.normalize("NFKD"); +} +function mnemonicToEntropy(mnemonic) { + const words = normalize(mnemonic).split(" "); + if (!allowedWordLengths.includes(words.length)) { + throw new Error(invalidNumberOfWorks); + } + // convert word indices to 11 bit binary strings + const bits = words + .map((word) => { + const index = wordlist.indexOf(word); + if (index === -1) { + throw new Error(wordNotInWordlist); + } + return index.toString(2).padStart(11, "0"); + }) + .join(""); + // split the binary string into ENT/CS + const dividerIndex = Math.floor(bits.length / 33) * 32; + const entropyBits = bits.slice(0, dividerIndex); + const checksumBits = bits.slice(dividerIndex); + // calculate the checksum and compare + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const entropyBytes = entropyBits.match(/(.{1,8})/g).map(bitstringToByte); + if (entropyBytes.length < 16 || entropyBytes.length > 32 || entropyBytes.length % 4 !== 0) { + throw new Error(invalidEntropy); + } + const entropy = Uint8Array.from(entropyBytes); + const newChecksum = deriveChecksumBits(entropy); + if (newChecksum !== checksumBits) { + throw new Error(invalidChecksum); + } + return entropy; +} +exports.mnemonicToEntropy = mnemonicToEntropy; +class EnglishMnemonic { + constructor(mnemonic) { + if (!EnglishMnemonic.mnemonicMatcher.test(mnemonic)) { + throw new Error("Invalid mnemonic format"); + } + const words = mnemonic.split(" "); + const allowedWordsLengths = [12, 15, 18, 21, 24]; + if (allowedWordsLengths.indexOf(words.length) === -1) { + throw new Error(`Invalid word count in mnemonic (allowed: ${allowedWordsLengths} got: ${words.length})`); + } + for (const word of words) { + if (EnglishMnemonic.wordlist.indexOf(word) === -1) { + throw new Error("Mnemonic contains invalid word"); + } + } + // Throws with informative error message if mnemonic is not valid + mnemonicToEntropy(mnemonic); + this.data = mnemonic; + } + toString() { + return this.data; + } +} +exports.EnglishMnemonic = EnglishMnemonic; +EnglishMnemonic.wordlist = wordlist; +// list of space separated lower case words (1 or more) +EnglishMnemonic.mnemonicMatcher = /^[a-z]+( [a-z]+)*$/; +class Bip39 { + /** + * Encodes raw entropy of length 16, 20, 24, 28 or 32 bytes as an English mnemonic between 12 and 24 words. + * + * | Entropy | Words | + * |--------------------|-------| + * | 128 bit (16 bytes) | 12 | + * | 160 bit (20 bytes) | 15 | + * | 192 bit (24 bytes) | 18 | + * | 224 bit (28 bytes) | 21 | + * | 256 bit (32 bytes) | 24 | + * + * + * @see https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#generating-the-mnemonic + * @param entropy The entropy to be encoded. This must be cryptographically secure. + */ + static encode(entropy) { + return new EnglishMnemonic(entropyToMnemonic(entropy)); + } + static decode(mnemonic) { + return mnemonicToEntropy(mnemonic.toString()); + } + static async mnemonicToSeed(mnemonic, password) { + const mnemonicBytes = (0, encoding_1.toUtf8)(normalize(mnemonic.toString())); + const salt = "mnemonic" + (password ? normalize(password) : ""); + const saltBytes = (0, encoding_1.toUtf8)(salt); + return (0, pbkdf2_1.pbkdf2Sha512)(mnemonicBytes, saltBytes, 2048, 64); + } +} +exports.Bip39 = Bip39; +//# sourceMappingURL=bip39.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/hmac.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/hmac.js ***! + \***************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Hmac = void 0; +class Hmac { + constructor(hashFunctionConstructor, originalKey) { + // This implementation is based on https://en.wikipedia.org/wiki/HMAC#Implementation + // with the addition of incremental hashing support. Thus part of the algorithm + // is in the constructor and the rest in digest(). + const blockSize = new hashFunctionConstructor().blockSize; + this.hash = (data) => new hashFunctionConstructor().update(data).digest(); + let key = originalKey; + if (key.length > blockSize) { + key = this.hash(key); + } + if (key.length < blockSize) { + const zeroPadding = new Uint8Array(blockSize - key.length); + key = new Uint8Array([...key, ...zeroPadding]); + } + // eslint-disable-next-line no-bitwise + this.oKeyPad = key.map((keyByte) => keyByte ^ 0x5c); + // eslint-disable-next-line no-bitwise + this.iKeyPad = key.map((keyByte) => keyByte ^ 0x36); + this.messageHasher = new hashFunctionConstructor(); + this.blockSize = blockSize; + this.update(this.iKeyPad); + } + update(data) { + this.messageHasher.update(data); + return this; + } + digest() { + const innerHash = this.messageHasher.digest(); + return this.hash(new Uint8Array([...this.oKeyPad, ...innerHash])); + } +} +exports.Hmac = Hmac; +//# sourceMappingURL=hmac.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/index.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/index.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.stringToPath = exports.Slip10RawIndex = exports.slip10CurveFromString = exports.Slip10Curve = exports.Slip10 = exports.pathToString = exports.sha512 = exports.Sha512 = exports.sha256 = exports.Sha256 = exports.Secp256k1Signature = exports.ExtendedSecp256k1Signature = exports.Secp256k1 = exports.ripemd160 = exports.Ripemd160 = exports.Random = exports.Xchacha20poly1305Ietf = exports.xchacha20NonceLength = exports.isArgon2idOptions = exports.Ed25519Keypair = exports.Ed25519 = exports.Argon2id = exports.keccak256 = exports.Keccak256 = exports.Hmac = exports.EnglishMnemonic = exports.Bip39 = void 0; +var bip39_1 = __webpack_require__(/*! ./bip39 */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/bip39.js"); +Object.defineProperty(exports, "Bip39", ({ enumerable: true, get: function () { return bip39_1.Bip39; } })); +Object.defineProperty(exports, "EnglishMnemonic", ({ enumerable: true, get: function () { return bip39_1.EnglishMnemonic; } })); +var hmac_1 = __webpack_require__(/*! ./hmac */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/hmac.js"); +Object.defineProperty(exports, "Hmac", ({ enumerable: true, get: function () { return hmac_1.Hmac; } })); +var keccak_1 = __webpack_require__(/*! ./keccak */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/keccak.js"); +Object.defineProperty(exports, "Keccak256", ({ enumerable: true, get: function () { return keccak_1.Keccak256; } })); +Object.defineProperty(exports, "keccak256", ({ enumerable: true, get: function () { return keccak_1.keccak256; } })); +var libsodium_1 = __webpack_require__(/*! ./libsodium */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/libsodium.js"); +Object.defineProperty(exports, "Argon2id", ({ enumerable: true, get: function () { return libsodium_1.Argon2id; } })); +Object.defineProperty(exports, "Ed25519", ({ enumerable: true, get: function () { return libsodium_1.Ed25519; } })); +Object.defineProperty(exports, "Ed25519Keypair", ({ enumerable: true, get: function () { return libsodium_1.Ed25519Keypair; } })); +Object.defineProperty(exports, "isArgon2idOptions", ({ enumerable: true, get: function () { return libsodium_1.isArgon2idOptions; } })); +Object.defineProperty(exports, "xchacha20NonceLength", ({ enumerable: true, get: function () { return libsodium_1.xchacha20NonceLength; } })); +Object.defineProperty(exports, "Xchacha20poly1305Ietf", ({ enumerable: true, get: function () { return libsodium_1.Xchacha20poly1305Ietf; } })); +var random_1 = __webpack_require__(/*! ./random */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/random.js"); +Object.defineProperty(exports, "Random", ({ enumerable: true, get: function () { return random_1.Random; } })); +var ripemd_1 = __webpack_require__(/*! ./ripemd */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/ripemd.js"); +Object.defineProperty(exports, "Ripemd160", ({ enumerable: true, get: function () { return ripemd_1.Ripemd160; } })); +Object.defineProperty(exports, "ripemd160", ({ enumerable: true, get: function () { return ripemd_1.ripemd160; } })); +var secp256k1_1 = __webpack_require__(/*! ./secp256k1 */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/secp256k1.js"); +Object.defineProperty(exports, "Secp256k1", ({ enumerable: true, get: function () { return secp256k1_1.Secp256k1; } })); +var secp256k1signature_1 = __webpack_require__(/*! ./secp256k1signature */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/secp256k1signature.js"); +Object.defineProperty(exports, "ExtendedSecp256k1Signature", ({ enumerable: true, get: function () { return secp256k1signature_1.ExtendedSecp256k1Signature; } })); +Object.defineProperty(exports, "Secp256k1Signature", ({ enumerable: true, get: function () { return secp256k1signature_1.Secp256k1Signature; } })); +var sha_1 = __webpack_require__(/*! ./sha */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/sha.js"); +Object.defineProperty(exports, "Sha256", ({ enumerable: true, get: function () { return sha_1.Sha256; } })); +Object.defineProperty(exports, "sha256", ({ enumerable: true, get: function () { return sha_1.sha256; } })); +Object.defineProperty(exports, "Sha512", ({ enumerable: true, get: function () { return sha_1.Sha512; } })); +Object.defineProperty(exports, "sha512", ({ enumerable: true, get: function () { return sha_1.sha512; } })); +var slip10_1 = __webpack_require__(/*! ./slip10 */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/slip10.js"); +Object.defineProperty(exports, "pathToString", ({ enumerable: true, get: function () { return slip10_1.pathToString; } })); +Object.defineProperty(exports, "Slip10", ({ enumerable: true, get: function () { return slip10_1.Slip10; } })); +Object.defineProperty(exports, "Slip10Curve", ({ enumerable: true, get: function () { return slip10_1.Slip10Curve; } })); +Object.defineProperty(exports, "slip10CurveFromString", ({ enumerable: true, get: function () { return slip10_1.slip10CurveFromString; } })); +Object.defineProperty(exports, "Slip10RawIndex", ({ enumerable: true, get: function () { return slip10_1.Slip10RawIndex; } })); +Object.defineProperty(exports, "stringToPath", ({ enumerable: true, get: function () { return slip10_1.stringToPath; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/keccak.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/keccak.js ***! + \*****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.keccak256 = exports.Keccak256 = void 0; +const sha3_1 = __webpack_require__(/*! @noble/hashes/sha3 */ "./node_modules/@noble/hashes/sha3.js"); +const utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/utils.js"); +class Keccak256 { + constructor(firstData) { + this.blockSize = 512 / 8; + this.impl = sha3_1.keccak_256.create(); + if (firstData) { + this.update(firstData); + } + } + update(data) { + this.impl.update((0, utils_1.toRealUint8Array)(data)); + return this; + } + digest() { + return this.impl.digest(); + } +} +exports.Keccak256 = Keccak256; +/** Convenience function equivalent to `new Keccak256(data).digest()` */ +function keccak256(data) { + return new Keccak256(data).digest(); +} +exports.keccak256 = keccak256; +//# sourceMappingURL=keccak.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/libsodium.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/libsodium.js ***! + \********************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +// Keep all classes requiring libsodium-js in one file as having multiple +// requiring of the libsodium-wrappers module currently crashes browsers +// +// libsodium.js API: https://gist.github.com/webmaster128/b2dbe6d54d36dd168c9fabf441b9b09c +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Xchacha20poly1305Ietf = exports.xchacha20NonceLength = exports.Ed25519 = exports.Ed25519Keypair = exports.Argon2id = exports.isArgon2idOptions = void 0; +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/index.js"); +const libsodium_wrappers_1 = __importDefault(__webpack_require__(/*! libsodium-wrappers */ "./node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js")); +function isArgon2idOptions(thing) { + if (!(0, utils_1.isNonNullObject)(thing)) + return false; + if (typeof thing.outputLength !== "number") + return false; + if (typeof thing.opsLimit !== "number") + return false; + if (typeof thing.memLimitKib !== "number") + return false; + return true; +} +exports.isArgon2idOptions = isArgon2idOptions; +class Argon2id { + static async execute(password, salt, options) { + await libsodium_wrappers_1.default.ready; + return libsodium_wrappers_1.default.crypto_pwhash(options.outputLength, password, salt, // libsodium only supports 16 byte salts and will throw when you don't respect that + options.opsLimit, options.memLimitKib * 1024, libsodium_wrappers_1.default.crypto_pwhash_ALG_ARGON2ID13); + } +} +exports.Argon2id = Argon2id; +class Ed25519Keypair { + constructor(privkey, pubkey) { + this.privkey = privkey; + this.pubkey = pubkey; + } + // a libsodium privkey has the format ` + ` + static fromLibsodiumPrivkey(libsodiumPrivkey) { + if (libsodiumPrivkey.length !== 64) { + throw new Error(`Unexpected key length ${libsodiumPrivkey.length}. Must be 64.`); + } + return new Ed25519Keypair(libsodiumPrivkey.slice(0, 32), libsodiumPrivkey.slice(32, 64)); + } + toLibsodiumPrivkey() { + return new Uint8Array([...this.privkey, ...this.pubkey]); + } +} +exports.Ed25519Keypair = Ed25519Keypair; +class Ed25519 { + /** + * Generates a keypair deterministically from a given 32 bytes seed. + * + * This seed equals the Ed25519 private key. + * For implementation details see crypto_sign_seed_keypair in + * https://download.libsodium.org/doc/public-key_cryptography/public-key_signatures.html + * and diagram on https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/ + */ + static async makeKeypair(seed) { + await libsodium_wrappers_1.default.ready; + const keypair = libsodium_wrappers_1.default.crypto_sign_seed_keypair(seed); + return Ed25519Keypair.fromLibsodiumPrivkey(keypair.privateKey); + } + static async createSignature(message, keyPair) { + await libsodium_wrappers_1.default.ready; + return libsodium_wrappers_1.default.crypto_sign_detached(message, keyPair.toLibsodiumPrivkey()); + } + static async verifySignature(signature, message, pubkey) { + await libsodium_wrappers_1.default.ready; + return libsodium_wrappers_1.default.crypto_sign_verify_detached(signature, message, pubkey); + } +} +exports.Ed25519 = Ed25519; +/** + * Nonce length in bytes for all flavours of XChaCha20. + * + * @see https://libsodium.gitbook.io/doc/advanced/stream_ciphers/xchacha20#notes + */ +exports.xchacha20NonceLength = 24; +class Xchacha20poly1305Ietf { + static async encrypt(message, key, nonce) { + await libsodium_wrappers_1.default.ready; + const additionalData = null; + return libsodium_wrappers_1.default.crypto_aead_xchacha20poly1305_ietf_encrypt(message, additionalData, null, // secret nonce: unused and should be null (https://download.libsodium.org/doc/secret-key_cryptography/aead/chacha20-poly1305/xchacha20-poly1305_construction) + nonce, key); + } + static async decrypt(ciphertext, key, nonce) { + await libsodium_wrappers_1.default.ready; + const additionalData = null; + return libsodium_wrappers_1.default.crypto_aead_xchacha20poly1305_ietf_decrypt(null, // secret nonce: unused and should be null (https://download.libsodium.org/doc/secret-key_cryptography/aead/chacha20-poly1305/xchacha20-poly1305_construction) + ciphertext, additionalData, nonce, key); + } +} +exports.Xchacha20poly1305Ietf = Xchacha20poly1305Ietf; +//# sourceMappingURL=libsodium.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/pbkdf2.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/pbkdf2.js ***! + \*****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pbkdf2Sha512 = exports.pbkdf2Sha512Noble = exports.pbkdf2Sha512NodeCrypto = exports.pbkdf2Sha512Subtle = exports.getSubtle = exports.getNodeCrypto = void 0; +const utils_1 = __webpack_require__(/*! @cosmjs/utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/index.js"); +const pbkdf2_1 = __webpack_require__(/*! @noble/hashes/pbkdf2 */ "./node_modules/@noble/hashes/pbkdf2.js"); +const sha512_1 = __webpack_require__(/*! @noble/hashes/sha512 */ "./node_modules/@noble/hashes/sha512.js"); +/** + * Returns the Node.js crypto module when available and `undefined` + * otherwise. + * + * Detects an unimplemented fallback module from Webpack 5 and returns + * `undefined` in that case. + */ +async function getNodeCrypto() { + try { + const nodeCrypto = await Promise.resolve().then(() => __importStar(__webpack_require__(/*! crypto */ "./node_modules/crypto-browserify/index.js"))); + // We get `Object{default: Object{}}` as a fallback when using + // `crypto: false` in Webpack 5, which we interprete as unavailable. + if (typeof nodeCrypto === "object" && Object.keys(nodeCrypto).length <= 1) { + return undefined; + } + return nodeCrypto; + } + catch { + return undefined; + } +} +exports.getNodeCrypto = getNodeCrypto; +async function getSubtle() { + // From Node.js 15 onwards, webcrypto is available in globalThis. + // In version 15 and 16 this was stored under the webcrypto key. + // With Node.js 17 it was moved to the same locations where browsers + // make it available. + // Loading `require("crypto")` here seems unnecessary since it only + // causes issues with bundlers and does not increase compatibility. + // Browsers and Node.js 17+ + let subtle = globalThis?.crypto?.subtle; + // Node.js 15+ + if (!subtle) + subtle = globalThis?.crypto?.webcrypto?.subtle; + return subtle; +} +exports.getSubtle = getSubtle; +async function pbkdf2Sha512Subtle( +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +subtle, secret, salt, iterations, keylen) { + (0, utils_1.assert)(subtle, "Argument subtle is falsy"); + (0, utils_1.assert)(typeof subtle === "object", "Argument subtle is not of type object"); + (0, utils_1.assert)(typeof subtle.importKey === "function", "subtle.importKey is not a function"); + (0, utils_1.assert)(typeof subtle.deriveBits === "function", "subtle.deriveBits is not a function"); + return subtle.importKey("raw", secret, { name: "PBKDF2" }, false, ["deriveBits"]).then((key) => subtle + .deriveBits({ + name: "PBKDF2", + salt: salt, + iterations: iterations, + hash: { name: "SHA-512" }, + }, key, keylen * 8) + .then((buffer) => new Uint8Array(buffer))); +} +exports.pbkdf2Sha512Subtle = pbkdf2Sha512Subtle; +/** + * Implements pbkdf2-sha512 using the Node.js crypro module (`import "crypto"`). + * This does not use subtle from [Crypto](https://developer.mozilla.org/en-US/docs/Web/API/Crypto). + */ +async function pbkdf2Sha512NodeCrypto( +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +nodeCrypto, secret, salt, iterations, keylen) { + (0, utils_1.assert)(nodeCrypto, "Argument nodeCrypto is falsy"); + (0, utils_1.assert)(typeof nodeCrypto === "object", "Argument nodeCrypto is not of type object"); + (0, utils_1.assert)(typeof nodeCrypto.pbkdf2 === "function", "nodeCrypto.pbkdf2 is not a function"); + return new Promise((resolve, reject) => { + nodeCrypto.pbkdf2(secret, salt, iterations, keylen, "sha512", (error, result) => { + if (error) { + reject(error); + } + else { + resolve(Uint8Array.from(result)); + } + }); + }); +} +exports.pbkdf2Sha512NodeCrypto = pbkdf2Sha512NodeCrypto; +async function pbkdf2Sha512Noble(secret, salt, iterations, keylen) { + return (0, pbkdf2_1.pbkdf2Async)(sha512_1.sha512, secret, salt, { c: iterations, dkLen: keylen }); +} +exports.pbkdf2Sha512Noble = pbkdf2Sha512Noble; +/** + * A pbkdf2 implementation for BIP39. This is not exported at package level and thus a private API. + */ +async function pbkdf2Sha512(secret, salt, iterations, keylen) { + const subtle = await getSubtle(); + if (subtle) { + return pbkdf2Sha512Subtle(subtle, secret, salt, iterations, keylen); + } + else { + const nodeCrypto = await getNodeCrypto(); + if (nodeCrypto) { + return pbkdf2Sha512NodeCrypto(nodeCrypto, secret, salt, iterations, keylen); + } + else { + return pbkdf2Sha512Noble(secret, salt, iterations, keylen); + } + } +} +exports.pbkdf2Sha512 = pbkdf2Sha512; +//# sourceMappingURL=pbkdf2.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/random.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/random.js ***! + \*****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Random = void 0; +class Random { + /** + * Returns `count` cryptographically secure random bytes + */ + static getBytes(count) { + try { + const globalObject = typeof window === "object" ? window : self; + const cryptoApi = typeof globalObject.crypto !== "undefined" ? globalObject.crypto : globalObject.msCrypto; + const out = new Uint8Array(count); + cryptoApi.getRandomValues(out); + return out; + } + catch { + try { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const crypto = __webpack_require__(/*! crypto */ "./node_modules/crypto-browserify/index.js"); + return new Uint8Array([...crypto.randomBytes(count)]); + } + catch { + throw new Error("No secure random number generator found"); + } + } + } +} +exports.Random = Random; +//# sourceMappingURL=random.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/ripemd.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/ripemd.js ***! + \*****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ripemd160 = exports.Ripemd160 = void 0; +const ripemd160_1 = __webpack_require__(/*! @noble/hashes/ripemd160 */ "./node_modules/@noble/hashes/ripemd160.js"); +const utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/utils.js"); +class Ripemd160 { + constructor(firstData) { + this.blockSize = 512 / 8; + this.impl = ripemd160_1.ripemd160.create(); + if (firstData) { + this.update(firstData); + } + } + update(data) { + this.impl.update((0, utils_1.toRealUint8Array)(data)); + return this; + } + digest() { + return this.impl.digest(); + } +} +exports.Ripemd160 = Ripemd160; +/** Convenience function equivalent to `new Ripemd160(data).digest()` */ +function ripemd160(data) { + return new Ripemd160(data).digest(); +} +exports.ripemd160 = ripemd160; +//# sourceMappingURL=ripemd.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/secp256k1.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/secp256k1.js ***! + \********************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Secp256k1 = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js"); +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +const elliptic_1 = __importDefault(__webpack_require__(/*! elliptic */ "./node_modules/elliptic/lib/elliptic.js")); +const secp256k1signature_1 = __webpack_require__(/*! ./secp256k1signature */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/secp256k1signature.js"); +const secp256k1 = new elliptic_1.default.ec("secp256k1"); +const secp256k1N = new bn_js_1.default("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", "hex"); +class Secp256k1 { + /** + * Takes a 32 byte private key and returns a privkey/pubkey pair. + * + * The resulting pubkey is uncompressed. For the use in Cosmos it should + * be compressed first using `Secp256k1.compressPubkey`. + */ + static async makeKeypair(privkey) { + if (privkey.length !== 32) { + // is this check missing in secp256k1.validatePrivateKey? + // https://github.com/bitjson/bitcoin-ts/issues/4 + throw new Error("input data is not a valid secp256k1 private key"); + } + const keypair = secp256k1.keyFromPrivate(privkey); + if (keypair.validate().result !== true) { + throw new Error("input data is not a valid secp256k1 private key"); + } + // range test that is not part of the elliptic implementation + const privkeyAsBigInteger = new bn_js_1.default(privkey); + if (privkeyAsBigInteger.gte(secp256k1N)) { + // not strictly smaller than N + throw new Error("input data is not a valid secp256k1 private key"); + } + const out = { + privkey: (0, encoding_1.fromHex)(keypair.getPrivate("hex")), + // encodes uncompressed as + // - 1-byte prefix "04" + // - 32-byte x coordinate + // - 32-byte y coordinate + pubkey: Uint8Array.from(keypair.getPublic("array")), + }; + return out; + } + /** + * Creates a signature that is + * - deterministic (RFC 6979) + * - lowS signature + * - DER encoded + */ + static async createSignature(messageHash, privkey) { + if (messageHash.length === 0) { + throw new Error("Message hash must not be empty"); + } + if (messageHash.length > 32) { + throw new Error("Message hash length must not exceed 32 bytes"); + } + const keypair = secp256k1.keyFromPrivate(privkey); + // the `canonical` option ensures creation of lowS signature representations + const { r, s, recoveryParam } = keypair.sign(messageHash, { canonical: true }); + if (typeof recoveryParam !== "number") + throw new Error("Recovery param missing"); + return new secp256k1signature_1.ExtendedSecp256k1Signature(Uint8Array.from(r.toArray()), Uint8Array.from(s.toArray()), recoveryParam); + } + static async verifySignature(signature, messageHash, pubkey) { + if (messageHash.length === 0) { + throw new Error("Message hash must not be empty"); + } + if (messageHash.length > 32) { + throw new Error("Message hash length must not exceed 32 bytes"); + } + const keypair = secp256k1.keyFromPublic(pubkey); + // From https://github.com/indutny/elliptic: + // + // Sign the message's hash (input must be an array, or a hex-string) + // + // Signature MUST be either: + // 1) DER-encoded signature as hex-string; or + // 2) DER-encoded signature as buffer; or + // 3) object with two hex-string properties (r and s); or + // 4) object with two buffer properties (r and s) + // + // Uint8Array is not a Buffer, but elliptic seems to be happy with the interface + // common to both types. Uint8Array is not an array of ints but the interface is + // similar + try { + return keypair.verify(messageHash, signature.toDer()); + } + catch (error) { + return false; + } + } + static recoverPubkey(signature, messageHash) { + const signatureForElliptic = { r: (0, encoding_1.toHex)(signature.r()), s: (0, encoding_1.toHex)(signature.s()) }; + const point = secp256k1.recoverPubKey(messageHash, signatureForElliptic, signature.recovery); + const keypair = secp256k1.keyFromPublic(point); + return (0, encoding_1.fromHex)(keypair.getPublic(false, "hex")); + } + /** + * Takes a compressed or uncompressed pubkey and return a compressed one. + * + * This function is idempotent. + */ + static compressPubkey(pubkey) { + switch (pubkey.length) { + case 33: + return pubkey; + case 65: + return Uint8Array.from(secp256k1.keyFromPublic(pubkey).getPublic(true, "array")); + default: + throw new Error("Invalid pubkey length"); + } + } + /** + * Takes a compressed or uncompressed pubkey and returns an uncompressed one. + * + * This function is idempotent. + */ + static uncompressPubkey(pubkey) { + switch (pubkey.length) { + case 33: + return Uint8Array.from(secp256k1.keyFromPublic(pubkey).getPublic(false, "array")); + case 65: + return pubkey; + default: + throw new Error("Invalid pubkey length"); + } + } + static trimRecoveryByte(signature) { + switch (signature.length) { + case 64: + return signature; + case 65: + return signature.slice(0, 64); + default: + throw new Error("Invalid signature length"); + } + } +} +exports.Secp256k1 = Secp256k1; +//# sourceMappingURL=secp256k1.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/secp256k1signature.js": +/*!*****************************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/secp256k1signature.js ***! + \*****************************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ExtendedSecp256k1Signature = exports.Secp256k1Signature = void 0; +function trimLeadingNullBytes(inData) { + let numberOfLeadingNullBytes = 0; + for (const byte of inData) { + if (byte === 0x00) { + numberOfLeadingNullBytes++; + } + else { + break; + } + } + return inData.slice(numberOfLeadingNullBytes); +} +const derTagInteger = 0x02; +class Secp256k1Signature { + constructor(r, s) { + if (r.length > 32 || r.length === 0 || r[0] === 0x00) { + throw new Error("Unsigned integer r must be encoded as unpadded big endian."); + } + if (s.length > 32 || s.length === 0 || s[0] === 0x00) { + throw new Error("Unsigned integer s must be encoded as unpadded big endian."); + } + this.data = { + r: r, + s: s, + }; + } + /** + * Takes the pair of integers (r, s) as 2x32 byte of binary data. + * + * Note: This is the format Cosmos SDK uses natively. + * + * @param data a 64 byte value containing integers r and s. + */ + static fromFixedLength(data) { + if (data.length !== 64) { + throw new Error(`Got invalid data length: ${data.length}. Expected 2x 32 bytes for the pair (r, s)`); + } + return new Secp256k1Signature(trimLeadingNullBytes(data.slice(0, 32)), trimLeadingNullBytes(data.slice(32, 64))); + } + static fromDer(data) { + let pos = 0; + if (data[pos++] !== 0x30) { + throw new Error("Prefix 0x30 expected"); + } + const bodyLength = data[pos++]; + if (data.length - pos !== bodyLength) { + throw new Error("Data length mismatch detected"); + } + // r + const rTag = data[pos++]; + if (rTag !== derTagInteger) { + throw new Error("INTEGER tag expected"); + } + const rLength = data[pos++]; + if (rLength >= 0x80) { + throw new Error("Decoding length values above 127 not supported"); + } + const rData = data.slice(pos, pos + rLength); + pos += rLength; + // s + const sTag = data[pos++]; + if (sTag !== derTagInteger) { + throw new Error("INTEGER tag expected"); + } + const sLength = data[pos++]; + if (sLength >= 0x80) { + throw new Error("Decoding length values above 127 not supported"); + } + const sData = data.slice(pos, pos + sLength); + pos += sLength; + return new Secp256k1Signature( + // r/s data can contain leading 0 bytes to express integers being non-negative in DER + trimLeadingNullBytes(rData), trimLeadingNullBytes(sData)); + } + r(length) { + if (length === undefined) { + return this.data.r; + } + else { + const paddingLength = length - this.data.r.length; + if (paddingLength < 0) { + throw new Error("Length too small to hold parameter r"); + } + const padding = new Uint8Array(paddingLength); + return new Uint8Array([...padding, ...this.data.r]); + } + } + s(length) { + if (length === undefined) { + return this.data.s; + } + else { + const paddingLength = length - this.data.s.length; + if (paddingLength < 0) { + throw new Error("Length too small to hold parameter s"); + } + const padding = new Uint8Array(paddingLength); + return new Uint8Array([...padding, ...this.data.s]); + } + } + toFixedLength() { + return new Uint8Array([...this.r(32), ...this.s(32)]); + } + toDer() { + // DER supports negative integers but our data is unsigned. Thus we need to prepend + // a leading 0 byte when the higest bit is set to differentiate nagative values + const rEncoded = this.data.r[0] >= 0x80 ? new Uint8Array([0, ...this.data.r]) : this.data.r; + const sEncoded = this.data.s[0] >= 0x80 ? new Uint8Array([0, ...this.data.s]) : this.data.s; + const rLength = rEncoded.length; + const sLength = sEncoded.length; + const data = new Uint8Array([derTagInteger, rLength, ...rEncoded, derTagInteger, sLength, ...sEncoded]); + return new Uint8Array([0x30, data.length, ...data]); + } +} +exports.Secp256k1Signature = Secp256k1Signature; +/** + * A Secp256k1Signature plus the recovery parameter + */ +class ExtendedSecp256k1Signature extends Secp256k1Signature { + constructor(r, s, recovery) { + super(r, s); + if (!Number.isInteger(recovery)) { + throw new Error("The recovery parameter must be an integer."); + } + if (recovery < 0 || recovery > 4) { + throw new Error("The recovery parameter must be one of 0, 1, 2, 3."); + } + this.recovery = recovery; + } + /** + * Decode extended signature from the simple fixed length encoding + * described in toFixedLength(). + */ + static fromFixedLength(data) { + if (data.length !== 65) { + throw new Error(`Got invalid data length ${data.length}. Expected 32 + 32 + 1`); + } + return new ExtendedSecp256k1Signature(trimLeadingNullBytes(data.slice(0, 32)), trimLeadingNullBytes(data.slice(32, 64)), data[64]); + } + /** + * A simple custom encoding that encodes the extended signature as + * r (32 bytes) | s (32 bytes) | recovery param (1 byte) + * where | denotes concatenation of bonary data. + */ + toFixedLength() { + return new Uint8Array([...this.r(32), ...this.s(32), this.recovery]); + } +} +exports.ExtendedSecp256k1Signature = ExtendedSecp256k1Signature; +//# sourceMappingURL=secp256k1signature.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/sha.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/sha.js ***! + \**************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.sha512 = exports.Sha512 = exports.sha256 = exports.Sha256 = void 0; +const sha256_1 = __webpack_require__(/*! @noble/hashes/sha256 */ "./node_modules/@noble/hashes/sha256.js"); +const sha512_1 = __webpack_require__(/*! @noble/hashes/sha512 */ "./node_modules/@noble/hashes/sha512.js"); +const utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/utils.js"); +class Sha256 { + constructor(firstData) { + this.blockSize = 512 / 8; + this.impl = sha256_1.sha256.create(); + if (firstData) { + this.update(firstData); + } + } + update(data) { + this.impl.update((0, utils_1.toRealUint8Array)(data)); + return this; + } + digest() { + return this.impl.digest(); + } +} +exports.Sha256 = Sha256; +/** Convenience function equivalent to `new Sha256(data).digest()` */ +function sha256(data) { + return new Sha256(data).digest(); +} +exports.sha256 = sha256; +class Sha512 { + constructor(firstData) { + this.blockSize = 1024 / 8; + this.impl = sha512_1.sha512.create(); + if (firstData) { + this.update(firstData); + } + } + update(data) { + this.impl.update((0, utils_1.toRealUint8Array)(data)); + return this; + } + digest() { + return this.impl.digest(); + } +} +exports.Sha512 = Sha512; +/** Convenience function equivalent to `new Sha512(data).digest()` */ +function sha512(data) { + return new Sha512(data).digest(); +} +exports.sha512 = sha512; +//# sourceMappingURL=sha.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/slip10.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/slip10.js ***! + \*****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.stringToPath = exports.pathToString = exports.Slip10 = exports.Slip10RawIndex = exports.slip10CurveFromString = exports.Slip10Curve = void 0; +const encoding_1 = __webpack_require__(/*! @cosmjs/encoding */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js"); +const math_1 = __webpack_require__(/*! @cosmjs/math */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/math/build/index.js"); +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +const elliptic_1 = __importDefault(__webpack_require__(/*! elliptic */ "./node_modules/elliptic/lib/elliptic.js")); +const hmac_1 = __webpack_require__(/*! ./hmac */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/hmac.js"); +const sha_1 = __webpack_require__(/*! ./sha */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/sha.js"); +/** + * Raw values must match the curve string in SLIP-0010 master key generation + * + * @see https://github.com/satoshilabs/slips/blob/master/slip-0010.md#master-key-generation + */ +var Slip10Curve; +(function (Slip10Curve) { + Slip10Curve["Secp256k1"] = "Bitcoin seed"; + Slip10Curve["Ed25519"] = "ed25519 seed"; +})(Slip10Curve = exports.Slip10Curve || (exports.Slip10Curve = {})); +/** + * Reverse mapping of Slip10Curve + */ +function slip10CurveFromString(curveString) { + switch (curveString) { + case Slip10Curve.Ed25519: + return Slip10Curve.Ed25519; + case Slip10Curve.Secp256k1: + return Slip10Curve.Secp256k1; + default: + throw new Error(`Unknown curve string: '${curveString}'`); + } +} +exports.slip10CurveFromString = slip10CurveFromString; +class Slip10RawIndex extends math_1.Uint32 { + static hardened(hardenedIndex) { + return new Slip10RawIndex(hardenedIndex + 2 ** 31); + } + static normal(normalIndex) { + return new Slip10RawIndex(normalIndex); + } + isHardened() { + return this.data >= 2 ** 31; + } +} +exports.Slip10RawIndex = Slip10RawIndex; +const secp256k1 = new elliptic_1.default.ec("secp256k1"); +// Universal private key derivation accoring to +// https://github.com/satoshilabs/slips/blob/master/slip-0010.md +class Slip10 { + static derivePath(curve, seed, path) { + let result = this.master(curve, seed); + for (const rawIndex of path) { + result = this.child(curve, result.privkey, result.chainCode, rawIndex); + } + return result; + } + static master(curve, seed) { + const i = new hmac_1.Hmac(sha_1.Sha512, (0, encoding_1.toAscii)(curve)).update(seed).digest(); + const il = i.slice(0, 32); + const ir = i.slice(32, 64); + if (curve !== Slip10Curve.Ed25519 && (this.isZero(il) || this.isGteN(curve, il))) { + return this.master(curve, i); + } + return { + chainCode: ir, + privkey: il, + }; + } + static child(curve, parentPrivkey, parentChainCode, rawIndex) { + let i; + if (rawIndex.isHardened()) { + const payload = new Uint8Array([0x00, ...parentPrivkey, ...rawIndex.toBytesBigEndian()]); + i = new hmac_1.Hmac(sha_1.Sha512, parentChainCode).update(payload).digest(); + } + else { + if (curve === Slip10Curve.Ed25519) { + throw new Error("Normal keys are not allowed with ed25519"); + } + else { + // Step 1 of https://github.com/satoshilabs/slips/blob/master/slip-0010.md#private-parent-key--private-child-key + // Calculate I = HMAC-SHA512(Key = c_par, Data = ser_P(point(k_par)) || ser_32(i)). + // where the functions point() and ser_p() are defined in BIP-0032 + const data = new Uint8Array([ + ...Slip10.serializedPoint(curve, new bn_js_1.default(parentPrivkey)), + ...rawIndex.toBytesBigEndian(), + ]); + i = new hmac_1.Hmac(sha_1.Sha512, parentChainCode).update(data).digest(); + } + } + return this.childImpl(curve, parentPrivkey, parentChainCode, rawIndex, i); + } + /** + * Implementation of ser_P(point(k_par)) from BIP-0032 + * + * @see https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki + */ + static serializedPoint(curve, p) { + switch (curve) { + case Slip10Curve.Secp256k1: + return (0, encoding_1.fromHex)(secp256k1.g.mul(p).encodeCompressed("hex")); + default: + throw new Error("curve not supported"); + } + } + static childImpl(curve, parentPrivkey, parentChainCode, rawIndex, i) { + // step 2 (of the Private parent key → private child key algorithm) + const il = i.slice(0, 32); + const ir = i.slice(32, 64); + // step 3 + const returnChainCode = ir; + // step 4 + if (curve === Slip10Curve.Ed25519) { + return { + chainCode: returnChainCode, + privkey: il, + }; + } + // step 5 + const n = this.n(curve); + const returnChildKeyAsNumber = new bn_js_1.default(il).add(new bn_js_1.default(parentPrivkey)).mod(n); + const returnChildKey = Uint8Array.from(returnChildKeyAsNumber.toArray("be", 32)); + // step 6 + if (this.isGteN(curve, il) || this.isZero(returnChildKey)) { + const newI = new hmac_1.Hmac(sha_1.Sha512, parentChainCode) + .update(new Uint8Array([0x01, ...ir, ...rawIndex.toBytesBigEndian()])) + .digest(); + return this.childImpl(curve, parentPrivkey, parentChainCode, rawIndex, newI); + } + // step 7 + return { + chainCode: returnChainCode, + privkey: returnChildKey, + }; + } + static isZero(privkey) { + return privkey.every((byte) => byte === 0); + } + static isGteN(curve, privkey) { + const keyAsNumber = new bn_js_1.default(privkey); + return keyAsNumber.gte(this.n(curve)); + } + static n(curve) { + switch (curve) { + case Slip10Curve.Secp256k1: + return new bn_js_1.default("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", 16); + default: + throw new Error("curve not supported"); + } + } +} +exports.Slip10 = Slip10; +function pathToString(path) { + return path.reduce((current, component) => { + const componentString = component.isHardened() + ? `${component.toNumber() - 2 ** 31}'` + : component.toString(); + return current + "/" + componentString; + }, "m"); +} +exports.pathToString = pathToString; +function stringToPath(input) { + if (!input.startsWith("m")) + throw new Error("Path string must start with 'm'"); + let rest = input.slice(1); + const out = new Array(); + while (rest) { + const match = rest.match(/^\/([0-9]+)('?)/); + if (!match) + throw new Error("Syntax error while reading path component"); + const [fullMatch, numberString, apostrophe] = match; + const value = math_1.Uint53.fromString(numberString).toNumber(); + if (value >= 2 ** 31) + throw new Error("Component value too high. Must not exceed 2**31-1."); + if (apostrophe) + out.push(Slip10RawIndex.hardened(value)); + else + out.push(Slip10RawIndex.normal(value)); + rest = rest.slice(fullMatch.length); + } + return out; +} +exports.stringToPath = stringToPath; +//# sourceMappingURL=slip10.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/utils.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/crypto/build/utils.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toRealUint8Array = void 0; +// See https://github.com/paulmillr/noble-hashes/issues/25 for why this is needed +function toRealUint8Array(data) { + if (data instanceof Uint8Array) + return data; + else + return Uint8Array.from(data); +} +exports.toRealUint8Array = toRealUint8Array; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/ascii.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/ascii.js ***! + \******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromAscii = exports.toAscii = void 0; +function toAscii(input) { + const toNums = (str) => str.split("").map((x) => { + const charCode = x.charCodeAt(0); + // 0x00–0x1F control characters + // 0x20–0x7E printable characters + // 0x7F delete character + // 0x80–0xFF out of 7 bit ascii range + if (charCode < 0x20 || charCode > 0x7e) { + throw new Error("Cannot encode character that is out of printable ASCII range: " + charCode); + } + return charCode; + }); + return Uint8Array.from(toNums(input)); +} +exports.toAscii = toAscii; +function fromAscii(data) { + const fromNums = (listOfNumbers) => listOfNumbers.map((x) => { + // 0x00–0x1F control characters + // 0x20–0x7E printable characters + // 0x7F delete character + // 0x80–0xFF out of 7 bit ascii range + if (x < 0x20 || x > 0x7e) { + throw new Error("Cannot decode character that is out of printable ASCII range: " + x); + } + return String.fromCharCode(x); + }); + return fromNums(Array.from(data)).join(""); +} +exports.fromAscii = fromAscii; +//# sourceMappingURL=ascii.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/base64.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/base64.js ***! + \*******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromBase64 = exports.toBase64 = void 0; +const base64js = __importStar(__webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")); +function toBase64(data) { + return base64js.fromByteArray(data); +} +exports.toBase64 = toBase64; +function fromBase64(base64String) { + if (!base64String.match(/^[a-zA-Z0-9+/]*={0,2}$/)) { + throw new Error("Invalid base64 string format"); + } + return base64js.toByteArray(base64String); +} +exports.fromBase64 = fromBase64; +//# sourceMappingURL=base64.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/bech32.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/bech32.js ***! + \*******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.normalizeBech32 = exports.fromBech32 = exports.toBech32 = void 0; +const bech32 = __importStar(__webpack_require__(/*! bech32 */ "./node_modules/bech32/index.js")); +function toBech32(prefix, data, limit) { + const address = bech32.encode(prefix, bech32.toWords(data), limit); + return address; +} +exports.toBech32 = toBech32; +function fromBech32(address, limit = Infinity) { + const decodedAddress = bech32.decode(address, limit); + return { + prefix: decodedAddress.prefix, + data: new Uint8Array(bech32.fromWords(decodedAddress.words)), + }; +} +exports.fromBech32 = fromBech32; +/** + * Takes a bech32 address and returns a normalized (i.e. lower case) representation of it. + * + * The input is validated along the way, which makes this significantly safer than + * using `address.toLowerCase()`. + */ +function normalizeBech32(address) { + const { prefix, data } = fromBech32(address); + return toBech32(prefix, data); +} +exports.normalizeBech32 = normalizeBech32; +//# sourceMappingURL=bech32.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/hex.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/hex.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromHex = exports.toHex = void 0; +function toHex(data) { + let out = ""; + for (const byte of data) { + out += ("0" + byte.toString(16)).slice(-2); + } + return out; +} +exports.toHex = toHex; +function fromHex(hexstring) { + if (hexstring.length % 2 !== 0) { + throw new Error("hex string length must be a multiple of 2"); + } + const out = new Uint8Array(hexstring.length / 2); + for (let i = 0; i < out.length; i++) { + const j = 2 * i; + const hexByteAsString = hexstring.slice(j, j + 2); + if (!hexByteAsString.match(/[0-9a-f]{2}/i)) { + throw new Error("hex string contains invalid characters"); + } + out[i] = parseInt(hexByteAsString, 16); + } + return out; +} +exports.fromHex = fromHex; +//# sourceMappingURL=hex.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/index.js ***! + \******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toUtf8 = exports.fromUtf8 = exports.toRfc3339 = exports.fromRfc3339 = exports.toHex = exports.fromHex = exports.toBech32 = exports.normalizeBech32 = exports.fromBech32 = exports.toBase64 = exports.fromBase64 = exports.toAscii = exports.fromAscii = void 0; +var ascii_1 = __webpack_require__(/*! ./ascii */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/ascii.js"); +Object.defineProperty(exports, "fromAscii", ({ enumerable: true, get: function () { return ascii_1.fromAscii; } })); +Object.defineProperty(exports, "toAscii", ({ enumerable: true, get: function () { return ascii_1.toAscii; } })); +var base64_1 = __webpack_require__(/*! ./base64 */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/base64.js"); +Object.defineProperty(exports, "fromBase64", ({ enumerable: true, get: function () { return base64_1.fromBase64; } })); +Object.defineProperty(exports, "toBase64", ({ enumerable: true, get: function () { return base64_1.toBase64; } })); +var bech32_1 = __webpack_require__(/*! ./bech32 */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/bech32.js"); +Object.defineProperty(exports, "fromBech32", ({ enumerable: true, get: function () { return bech32_1.fromBech32; } })); +Object.defineProperty(exports, "normalizeBech32", ({ enumerable: true, get: function () { return bech32_1.normalizeBech32; } })); +Object.defineProperty(exports, "toBech32", ({ enumerable: true, get: function () { return bech32_1.toBech32; } })); +var hex_1 = __webpack_require__(/*! ./hex */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/hex.js"); +Object.defineProperty(exports, "fromHex", ({ enumerable: true, get: function () { return hex_1.fromHex; } })); +Object.defineProperty(exports, "toHex", ({ enumerable: true, get: function () { return hex_1.toHex; } })); +var rfc3339_1 = __webpack_require__(/*! ./rfc3339 */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/rfc3339.js"); +Object.defineProperty(exports, "fromRfc3339", ({ enumerable: true, get: function () { return rfc3339_1.fromRfc3339; } })); +Object.defineProperty(exports, "toRfc3339", ({ enumerable: true, get: function () { return rfc3339_1.toRfc3339; } })); +var utf8_1 = __webpack_require__(/*! ./utf8 */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/utf8.js"); +Object.defineProperty(exports, "fromUtf8", ({ enumerable: true, get: function () { return utf8_1.fromUtf8; } })); +Object.defineProperty(exports, "toUtf8", ({ enumerable: true, get: function () { return utf8_1.toUtf8; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/rfc3339.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/rfc3339.js ***! + \********************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toRfc3339 = exports.fromRfc3339 = void 0; +const rfc3339Matcher = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?((?:[+-]\d{2}:\d{2})|Z)$/; +function padded(integer, length = 2) { + return integer.toString().padStart(length, "0"); +} +function fromRfc3339(str) { + const matches = rfc3339Matcher.exec(str); + if (!matches) { + throw new Error("Date string is not in RFC3339 format"); + } + const year = +matches[1]; + const month = +matches[2]; + const day = +matches[3]; + const hour = +matches[4]; + const minute = +matches[5]; + const second = +matches[6]; + // fractional seconds match either undefined or a string like ".1", ".123456789" + const milliSeconds = matches[7] ? Math.floor(+matches[7] * 1000) : 0; + let tzOffsetSign; + let tzOffsetHours; + let tzOffsetMinutes; + // if timezone is undefined, it must be Z or nothing (otherwise the group would have captured). + if (matches[8] === "Z") { + tzOffsetSign = 1; + tzOffsetHours = 0; + tzOffsetMinutes = 0; + } + else { + tzOffsetSign = matches[8].substring(0, 1) === "-" ? -1 : 1; + tzOffsetHours = +matches[8].substring(1, 3); + tzOffsetMinutes = +matches[8].substring(4, 6); + } + const tzOffset = tzOffsetSign * (tzOffsetHours * 60 + tzOffsetMinutes) * 60; // seconds + const timestamp = Date.UTC(year, month - 1, day, hour, minute, second, milliSeconds) - tzOffset * 1000; + return new Date(timestamp); +} +exports.fromRfc3339 = fromRfc3339; +function toRfc3339(date) { + const year = date.getUTCFullYear(); + const month = padded(date.getUTCMonth() + 1); + const day = padded(date.getUTCDate()); + const hour = padded(date.getUTCHours()); + const minute = padded(date.getUTCMinutes()); + const second = padded(date.getUTCSeconds()); + const ms = padded(date.getUTCMilliseconds(), 3); + return `${year}-${month}-${day}T${hour}:${minute}:${second}.${ms}Z`; +} +exports.toRfc3339 = toRfc3339; +//# sourceMappingURL=rfc3339.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/utf8.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/encoding/build/utf8.js ***! + \*****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromUtf8 = exports.toUtf8 = void 0; +function toUtf8(str) { + return new TextEncoder().encode(str); +} +exports.toUtf8 = toUtf8; +/** + * Takes UTF-8 data and decodes it to a string. + * + * In lossy mode, the replacement character � is used to substitude invalid + * encodings. By default lossy mode is off and invalid data will lead to exceptions. + */ +function fromUtf8(data, lossy = false) { + const fatal = !lossy; + return new TextDecoder("utf-8", { fatal }).decode(data); +} +exports.fromUtf8 = fromUtf8; +//# sourceMappingURL=utf8.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/math/build/decimal.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/math/build/decimal.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Decimal = void 0; +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +// Too large values lead to massive memory usage. Limit to something sensible. +// The largest value we need is 18 (Ether). +const maxFractionalDigits = 100; +/** + * A type for arbitrary precision, non-negative decimals. + * + * Instances of this class are immutable. + */ +class Decimal { + constructor(atomics, fractionalDigits) { + if (!atomics.match(/^[0-9]+$/)) { + throw new Error("Invalid string format. Only non-negative integers in decimal representation supported."); + } + this.data = { + atomics: new bn_js_1.default(atomics), + fractionalDigits: fractionalDigits, + }; + } + static fromUserInput(input, fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + const badCharacter = input.match(/[^0-9.]/); + if (badCharacter) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + throw new Error(`Invalid character at position ${badCharacter.index + 1}`); + } + let whole; + let fractional; + if (input === "") { + whole = "0"; + fractional = ""; + } + else if (input.search(/\./) === -1) { + // integer format, no separator + whole = input; + fractional = ""; + } + else { + const parts = input.split("."); + switch (parts.length) { + case 0: + case 1: + throw new Error("Fewer than two elements in split result. This must not happen here."); + case 2: + if (!parts[1]) + throw new Error("Fractional part missing"); + whole = parts[0]; + fractional = parts[1].replace(/0+$/, ""); + break; + default: + throw new Error("More than one separator found"); + } + } + if (fractional.length > fractionalDigits) { + throw new Error("Got more fractional digits than supported"); + } + const quantity = `${whole}${fractional.padEnd(fractionalDigits, "0")}`; + return new Decimal(quantity, fractionalDigits); + } + static fromAtomics(atomics, fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal(atomics, fractionalDigits); + } + /** + * Creates a Decimal with value 0.0 and the given number of fractial digits. + * + * Fractional digits are not relevant for the value but needed to be able + * to perform arithmetic operations with other decimals. + */ + static zero(fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal("0", fractionalDigits); + } + /** + * Creates a Decimal with value 1.0 and the given number of fractial digits. + * + * Fractional digits are not relevant for the value but needed to be able + * to perform arithmetic operations with other decimals. + */ + static one(fractionalDigits) { + Decimal.verifyFractionalDigits(fractionalDigits); + return new Decimal("1" + "0".repeat(fractionalDigits), fractionalDigits); + } + static verifyFractionalDigits(fractionalDigits) { + if (!Number.isInteger(fractionalDigits)) + throw new Error("Fractional digits is not an integer"); + if (fractionalDigits < 0) + throw new Error("Fractional digits must not be negative"); + if (fractionalDigits > maxFractionalDigits) { + throw new Error(`Fractional digits must not exceed ${maxFractionalDigits}`); + } + } + static compare(a, b) { + if (a.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + return a.data.atomics.cmp(new bn_js_1.default(b.atomics)); + } + get atomics() { + return this.data.atomics.toString(); + } + get fractionalDigits() { + return this.data.fractionalDigits; + } + /** Creates a new instance with the same value */ + clone() { + return new Decimal(this.atomics, this.fractionalDigits); + } + /** Returns the greatest decimal <= this which has no fractional part (rounding down) */ + floor() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return this.clone(); + } + else { + return Decimal.fromAtomics(whole.mul(factor).toString(), this.fractionalDigits); + } + } + /** Returns the smallest decimal >= this which has no fractional part (rounding up) */ + ceil() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return this.clone(); + } + else { + return Decimal.fromAtomics(whole.addn(1).mul(factor).toString(), this.fractionalDigits); + } + } + toString() { + const factor = new bn_js_1.default(10).pow(new bn_js_1.default(this.data.fractionalDigits)); + const whole = this.data.atomics.div(factor); + const fractional = this.data.atomics.mod(factor); + if (fractional.isZero()) { + return whole.toString(); + } + else { + const fullFractionalPart = fractional.toString().padStart(this.data.fractionalDigits, "0"); + const trimmedFractionalPart = fullFractionalPart.replace(/0+$/, ""); + return `${whole.toString()}.${trimmedFractionalPart}`; + } + } + /** + * Returns an approximation as a float type. Only use this if no + * exact calculation is required. + */ + toFloatApproximation() { + const out = Number(this.toString()); + if (Number.isNaN(out)) + throw new Error("Conversion to number failed"); + return out; + } + /** + * a.plus(b) returns a+b. + * + * Both values need to have the same fractional digits. + */ + plus(b) { + if (this.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + const sum = this.data.atomics.add(new bn_js_1.default(b.atomics)); + return new Decimal(sum.toString(), this.fractionalDigits); + } + /** + * a.minus(b) returns a-b. + * + * Both values need to have the same fractional digits. + * The resulting difference needs to be non-negative. + */ + minus(b) { + if (this.fractionalDigits !== b.fractionalDigits) + throw new Error("Fractional digits do not match"); + const difference = this.data.atomics.sub(new bn_js_1.default(b.atomics)); + if (difference.ltn(0)) + throw new Error("Difference must not be negative"); + return new Decimal(difference.toString(), this.fractionalDigits); + } + /** + * a.multiply(b) returns a*b. + * + * We only allow multiplication by unsigned integers to avoid rounding errors. + */ + multiply(b) { + const product = this.data.atomics.mul(new bn_js_1.default(b.toString())); + return new Decimal(product.toString(), this.fractionalDigits); + } + equals(b) { + return Decimal.compare(this, b) === 0; + } + isLessThan(b) { + return Decimal.compare(this, b) < 0; + } + isLessThanOrEqual(b) { + return Decimal.compare(this, b) <= 0; + } + isGreaterThan(b) { + return Decimal.compare(this, b) > 0; + } + isGreaterThanOrEqual(b) { + return Decimal.compare(this, b) >= 0; + } +} +exports.Decimal = Decimal; +//# sourceMappingURL=decimal.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/math/build/index.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/math/build/index.js ***! + \**************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Uint64 = exports.Uint53 = exports.Uint32 = exports.Int53 = exports.Decimal = void 0; +var decimal_1 = __webpack_require__(/*! ./decimal */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/math/build/decimal.js"); +Object.defineProperty(exports, "Decimal", ({ enumerable: true, get: function () { return decimal_1.Decimal; } })); +var integers_1 = __webpack_require__(/*! ./integers */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/math/build/integers.js"); +Object.defineProperty(exports, "Int53", ({ enumerable: true, get: function () { return integers_1.Int53; } })); +Object.defineProperty(exports, "Uint32", ({ enumerable: true, get: function () { return integers_1.Uint32; } })); +Object.defineProperty(exports, "Uint53", ({ enumerable: true, get: function () { return integers_1.Uint53; } })); +Object.defineProperty(exports, "Uint64", ({ enumerable: true, get: function () { return integers_1.Uint64; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/math/build/integers.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/math/build/integers.js ***! + \*****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Uint64 = exports.Uint53 = exports.Int53 = exports.Uint32 = void 0; +/* eslint-disable no-bitwise */ +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js")); +const uint64MaxValue = new bn_js_1.default("18446744073709551615", 10, "be"); +class Uint32 { + constructor(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + if (input < 0 || input > 4294967295) { + throw new Error("Input not in uint32 range: " + input.toString()); + } + this.data = input; + } + /** @deprecated use Uint32.fromBytes */ + static fromBigEndianBytes(bytes) { + return Uint32.fromBytes(bytes); + } + /** + * Creates a Uint32 from a fixed length byte array. + * + * @param bytes a list of exactly 4 bytes + * @param endianess defaults to big endian + */ + static fromBytes(bytes, endianess = "be") { + if (bytes.length !== 4) { + throw new Error("Invalid input length. Expected 4 bytes."); + } + for (let i = 0; i < bytes.length; ++i) { + if (!Number.isInteger(bytes[i]) || bytes[i] > 255 || bytes[i] < 0) { + throw new Error("Invalid value in byte. Found: " + bytes[i]); + } + } + const beBytes = endianess === "be" ? bytes : Array.from(bytes).reverse(); + // Use mulitiplication instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint32(beBytes[0] * 2 ** 24 + beBytes[1] * 2 ** 16 + beBytes[2] * 2 ** 8 + beBytes[3]); + } + static fromString(str) { + if (!str.match(/^[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Uint32(Number.parseInt(str, 10)); + } + toBytesBigEndian() { + // Use division instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint8Array([ + Math.floor(this.data / 2 ** 24) & 0xff, + Math.floor(this.data / 2 ** 16) & 0xff, + Math.floor(this.data / 2 ** 8) & 0xff, + Math.floor(this.data / 2 ** 0) & 0xff, + ]); + } + toBytesLittleEndian() { + // Use division instead of shifting since bitwise operators are defined + // on SIGNED int32 in JavaScript and we don't want to risk surprises + return new Uint8Array([ + Math.floor(this.data / 2 ** 0) & 0xff, + Math.floor(this.data / 2 ** 8) & 0xff, + Math.floor(this.data / 2 ** 16) & 0xff, + Math.floor(this.data / 2 ** 24) & 0xff, + ]); + } + toNumber() { + return this.data; + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Uint32 = Uint32; +class Int53 { + constructor(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + if (input < Number.MIN_SAFE_INTEGER || input > Number.MAX_SAFE_INTEGER) { + throw new Error("Input not in int53 range: " + input.toString()); + } + this.data = input; + } + static fromString(str) { + if (!str.match(/^-?[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Int53(Number.parseInt(str, 10)); + } + toNumber() { + return this.data; + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Int53 = Int53; +class Uint53 { + constructor(input) { + const signed = new Int53(input); + if (signed.toNumber() < 0) { + throw new Error("Input is negative"); + } + this.data = signed; + } + static fromString(str) { + const signed = Int53.fromString(str); + return new Uint53(signed.toNumber()); + } + toNumber() { + return this.data.toNumber(); + } + toBigInt() { + return BigInt(this.toNumber()); + } + toString() { + return this.data.toString(); + } +} +exports.Uint53 = Uint53; +class Uint64 { + constructor(data) { + if (data.isNeg()) { + throw new Error("Input is negative"); + } + if (data.gt(uint64MaxValue)) { + throw new Error("Input exceeds uint64 range"); + } + this.data = data; + } + /** @deprecated use Uint64.fromBytes */ + static fromBytesBigEndian(bytes) { + return Uint64.fromBytes(bytes); + } + /** + * Creates a Uint64 from a fixed length byte array. + * + * @param bytes a list of exactly 8 bytes + * @param endianess defaults to big endian + */ + static fromBytes(bytes, endianess = "be") { + if (bytes.length !== 8) { + throw new Error("Invalid input length. Expected 8 bytes."); + } + for (let i = 0; i < bytes.length; ++i) { + if (!Number.isInteger(bytes[i]) || bytes[i] > 255 || bytes[i] < 0) { + throw new Error("Invalid value in byte. Found: " + bytes[i]); + } + } + const beBytes = endianess === "be" ? Array.from(bytes) : Array.from(bytes).reverse(); + return new Uint64(new bn_js_1.default(beBytes)); + } + static fromString(str) { + if (!str.match(/^[0-9]+$/)) { + throw new Error("Invalid string format"); + } + return new Uint64(new bn_js_1.default(str, 10, "be")); + } + static fromNumber(input) { + if (Number.isNaN(input)) { + throw new Error("Input is not a number"); + } + if (!Number.isInteger(input)) { + throw new Error("Input is not an integer"); + } + let bigint; + try { + bigint = new bn_js_1.default(input); + } + catch { + throw new Error("Input is not a safe integer"); + } + return new Uint64(bigint); + } + toBytesBigEndian() { + return Uint8Array.from(this.data.toArray("be", 8)); + } + toBytesLittleEndian() { + return Uint8Array.from(this.data.toArray("le", 8)); + } + toString() { + return this.data.toString(10); + } + toBigInt() { + return BigInt(this.toString()); + } + toNumber() { + return this.data.toNumber(); + } +} +exports.Uint64 = Uint64; +// Assign classes to unused variables in order to verify static interface conformance at compile time. +// Workaround for https://github.com/microsoft/TypeScript/issues/33892 +const _int53Class = Int53; +const _uint53Class = Uint53; +const _uint32Class = Uint32; +const _uint64Class = Uint64; +//# sourceMappingURL=integers.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/concat.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/concat.js ***! + \*****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.concat = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +/** + * An implementation of concat that buffers all source stream events + * + * Marble diagram: + * + * ```text + * --1--2---3---4-| + * -a--b-c--d-| + * --------X---------Y---------Z- + * concat + * --1--2---3---4-abcdXY-------Z- + * ``` + * + * This is inspired by RxJS's concat as documented at http://rxmarbles.com/#concat and behaves + * differently than xstream's concat as discussed in https://github.com/staltz/xstream/issues/170. + * + */ +function concat(...streams) { + const subscriptions = new Array(); + const queues = new Array(); // one queue per stream + const completedStreams = new Set(); + let activeStreamIndex = 0; + function reset() { + while (subscriptions.length > 0) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const subscription = subscriptions.shift(); + subscription.unsubscribe(); + } + queues.length = 0; + completedStreams.clear(); + activeStreamIndex = 0; + } + const producer = { + start: (listener) => { + streams.forEach((_) => queues.push([])); + function emitAllQueuesEvents(streamIndex) { + // eslint-disable-next-line no-constant-condition + while (true) { + const element = queues[streamIndex].shift(); + if (element === undefined) { + return; + } + listener.next(element); + } + } + function isDone() { + return activeStreamIndex >= streams.length; + } + if (isDone()) { + listener.complete(); + return; + } + streams.forEach((stream, index) => { + subscriptions.push(stream.subscribe({ + next: (value) => { + if (index === activeStreamIndex) { + listener.next(value); + } + else { + queues[index].push(value); + } + }, + complete: () => { + completedStreams.add(index); + while (completedStreams.has(activeStreamIndex)) { + // this stream completed: emit all and move on + emitAllQueuesEvents(activeStreamIndex); + activeStreamIndex++; + } + if (isDone()) { + listener.complete(); + } + else { + // now active stream can have some events queued but did not yet complete + emitAllQueuesEvents(activeStreamIndex); + } + }, + error: (error) => { + listener.error(error); + reset(); + }, + })); + }); + }, + stop: () => { + reset(); + }, + }; + return xstream_1.Stream.create(producer); +} +exports.concat = concat; +//# sourceMappingURL=concat.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/defaultvalueproducer.js": +/*!*******************************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/defaultvalueproducer.js ***! + \*******************************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DefaultValueProducer = void 0; +// allows pre-producing values before anyone is listening +class DefaultValueProducer { + constructor(value, callbacks) { + this.callbacks = callbacks; + this.internalValue = value; + } + get value() { + return this.internalValue; + } + /** + * Update the current value. + * + * If producer is active (i.e. someone is listening), this emits an event. + * If not, just the current value is updated. + */ + update(value) { + this.internalValue = value; + if (this.listener) { + this.listener.next(value); + } + } + /** + * Produce an error + */ + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + error(error) { + if (this.listener) { + this.listener.error(error); + } + } + /** + * Called by the stream. Do not call this directly. + */ + start(listener) { + this.listener = listener; + listener.next(this.internalValue); + if (this.callbacks) { + this.callbacks.onStarted(); + } + } + /** + * Called by the stream. Do not call this directly. + */ + stop() { + if (this.callbacks) { + this.callbacks.onStop(); + } + this.listener = undefined; + } +} +exports.DefaultValueProducer = DefaultValueProducer; +//# sourceMappingURL=defaultvalueproducer.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/dropduplicates.js": +/*!*************************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/dropduplicates.js ***! + \*************************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.dropDuplicates = void 0; +/** + * Drops duplicate values in a stream. + * + * Marble diagram: + * + * ```text + * -1-1-1-2-4-3-3-4-- + * dropDuplicates + * -1-----2-4-3------ + * ``` + * + * Each value must be uniquely identified by a string given by + * valueToKey(value). + * + * Internally this maintains a set of keys that have been processed already, + * i.e. memory consumption and Set lookup times should be considered when + * using this function. + */ +function dropDuplicates(valueToKey) { + const operand = (instream) => { + const emittedKeys = new Set(); + const deduplicatedStream = instream + .filter((value) => !emittedKeys.has(valueToKey(value))) + .debug((value) => emittedKeys.add(valueToKey(value))); + return deduplicatedStream; + }; + return operand; +} +exports.dropDuplicates = dropDuplicates; +//# sourceMappingURL=dropduplicates.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/index.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/index.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ValueAndUpdates = exports.toListPromise = exports.fromListPromise = exports.firstEvent = exports.dropDuplicates = exports.DefaultValueProducer = exports.concat = void 0; +var concat_1 = __webpack_require__(/*! ./concat */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/concat.js"); +Object.defineProperty(exports, "concat", ({ enumerable: true, get: function () { return concat_1.concat; } })); +var defaultvalueproducer_1 = __webpack_require__(/*! ./defaultvalueproducer */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/defaultvalueproducer.js"); +Object.defineProperty(exports, "DefaultValueProducer", ({ enumerable: true, get: function () { return defaultvalueproducer_1.DefaultValueProducer; } })); +var dropduplicates_1 = __webpack_require__(/*! ./dropduplicates */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/dropduplicates.js"); +Object.defineProperty(exports, "dropDuplicates", ({ enumerable: true, get: function () { return dropduplicates_1.dropDuplicates; } })); +var promise_1 = __webpack_require__(/*! ./promise */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/promise.js"); +Object.defineProperty(exports, "firstEvent", ({ enumerable: true, get: function () { return promise_1.firstEvent; } })); +Object.defineProperty(exports, "fromListPromise", ({ enumerable: true, get: function () { return promise_1.fromListPromise; } })); +Object.defineProperty(exports, "toListPromise", ({ enumerable: true, get: function () { return promise_1.toListPromise; } })); +__exportStar(__webpack_require__(/*! ./reducer */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/reducer.js"), exports); +var valueandupdates_1 = __webpack_require__(/*! ./valueandupdates */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/valueandupdates.js"); +Object.defineProperty(exports, "ValueAndUpdates", ({ enumerable: true, get: function () { return valueandupdates_1.ValueAndUpdates; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/promise.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/promise.js ***! + \******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.firstEvent = exports.toListPromise = exports.fromListPromise = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +/** + * Emits one event for each list element as soon as the promise resolves + */ +function fromListPromise(promise) { + const producer = { + start: (listener) => { + // the code in `start` runs as soon as anyone listens to the stream + promise + .then((iterable) => { + for (const element of iterable) { + listener.next(element); + } + listener.complete(); + }) + .catch((error) => listener.error(error)); + }, + // eslint-disable-next-line @typescript-eslint/no-empty-function + stop: () => { }, + }; + return xstream_1.Stream.create(producer); +} +exports.fromListPromise = fromListPromise; +/** + * Listens to stream and collects events. When `count` events are collected, + * the promise resolves with an array of events. + * + * Rejects if stream completes before `count` events are collected. + */ +async function toListPromise(stream, count) { + return new Promise((resolve, reject) => { + if (count === 0) { + resolve([]); + return; + } + const events = new Array(); + // take() unsubscribes from source stream automatically + stream.take(count).subscribe({ + next: (event) => { + events.push(event); + if (events.length === count) { + resolve(events); + } + }, + complete: () => { + reject(`Stream completed before all events could be collected. ` + + `Collected ${events.length}, expected ${count}`); + }, + error: (error) => reject(error), + }); + }); +} +exports.toListPromise = toListPromise; +/** + * Listens to stream, collects one event and revolves. + * + * Rejects if stream completes before one event was fired. + */ +async function firstEvent(stream) { + return (await toListPromise(stream, 1))[0]; +} +exports.firstEvent = firstEvent; +//# sourceMappingURL=promise.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/reducer.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/reducer.js ***! + \******************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.lastValue = exports.asArray = exports.countStream = exports.Reducer = void 0; +// Reducer takes a stream of events T and a ReducerFunc, that +// materializes a state of type U. +class Reducer { + constructor(stream, reducer, initState) { + this.stream = stream; + this.reducer = reducer; + this.state = initState; + this.completed = new Promise((resolve, reject) => { + const subscription = this.stream.subscribe({ + next: (evt) => { + this.state = this.reducer(this.state, evt); + }, + complete: () => { + resolve(); + // this must happen after resolve, to ensure stream.subscribe() has finished + subscription.unsubscribe(); + }, + error: (err) => { + reject(err); + // the stream already closed on error, but unsubscribe to be safe + subscription.unsubscribe(); + }, + }); + }); + } + // value returns current materialized state + value() { + return this.state; + } + // finished resolves on completed stream, rejects on stream error + async finished() { + return this.completed; + } +} +exports.Reducer = Reducer; +function increment(sum, _) { + return sum + 1; +} +// countStream returns a reducer that contains current count +// of events on the stream +function countStream(stream) { + return new Reducer(stream, increment, 0); +} +exports.countStream = countStream; +function append(list, evt) { + return [...list, evt]; +} +// asArray maintains an array containing all events that have +// occurred on the stream +function asArray(stream) { + return new Reducer(stream, append, []); +} +exports.asArray = asArray; +function last(_, event) { + return event; +} +// lastValue returns the last value read from the stream, or undefined if no values sent +function lastValue(stream) { + return new Reducer(stream, last, undefined); +} +exports.lastValue = lastValue; +//# sourceMappingURL=reducer.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/valueandupdates.js": +/*!**************************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/stream/build/valueandupdates.js ***! + \**************************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ValueAndUpdates = void 0; +const xstream_1 = __webpack_require__(/*! xstream */ "./node_modules/xstream/index.js"); +/** + * A read only wrapper around DefaultValueProducer that allows + * to synchronously get the current value using the .value property + * and listen to to updates by suscribing to the .updates stream + */ +class ValueAndUpdates { + constructor(producer) { + this.producer = producer; + this.updates = xstream_1.MemoryStream.createWithMemory(this.producer); + } + get value() { + return this.producer.value; + } + /** + * Resolves as soon as search value is found. + * + * @param search either a value or a function that must return true when found + * @returns the value of the update that caused the search match + */ + async waitFor(search) { + const searchImplementation = typeof search === "function" ? search : (value) => value === search; + return new Promise((resolve, reject) => { + const subscription = this.updates.subscribe({ + next: (newValue) => { + if (searchImplementation(newValue)) { + resolve(newValue); + // MemoryStream.subscribe() calls next with the last value. + // Make async to ensure the subscription exists + setTimeout(() => subscription.unsubscribe(), 0); + } + }, + complete: () => { + subscription.unsubscribe(); + reject("Update stream completed without expected value"); + }, + error: (error) => { + reject(error); + }, + }); + }); + } +} +exports.ValueAndUpdates = ValueAndUpdates; +//# sourceMappingURL=valueandupdates.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/arrays.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/arrays.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.arrayContentStartsWith = exports.arrayContentEquals = void 0; +/** + * Compares the content of two arrays-like objects for equality. + * + * Equality is defined as having equal length and element values, where element equality means `===` returning `true`. + * + * This allows you to compare the content of a Buffer, Uint8Array or number[], ignoring the specific type. + * As a consequence, this returns different results than Jasmine's `toEqual`, which ensures elements have the same type. + */ +function arrayContentEquals(a, b) { + if (a.length !== b.length) + return false; + for (let i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; +} +exports.arrayContentEquals = arrayContentEquals; +/** + * Checks if `a` starts with the contents of `b`. + * + * This requires equality of the element values, where element equality means `===` returning `true`. + * + * This allows you to compare the content of a Buffer, Uint8Array or number[], ignoring the specific type. + * As a consequence, this returns different results than Jasmine's `toEqual`, which ensures elements have the same type. + */ +function arrayContentStartsWith(a, b) { + if (a.length < b.length) + return false; + for (let i = 0; i < b.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; +} +exports.arrayContentStartsWith = arrayContentStartsWith; +//# sourceMappingURL=arrays.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/assert.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/assert.js ***! + \****************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.assertDefinedAndNotNull = exports.assertDefined = exports.assert = void 0; +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function assert(condition, msg) { + if (!condition) { + throw new Error(msg || "condition is not truthy"); + } +} +exports.assert = assert; +function assertDefined(value, msg) { + if (value === undefined) { + throw new Error(msg ?? "value is undefined"); + } +} +exports.assertDefined = assertDefined; +function assertDefinedAndNotNull(value, msg) { + if (value === undefined || value === null) { + throw new Error(msg ?? "value is undefined or null"); + } +} +exports.assertDefinedAndNotNull = assertDefinedAndNotNull; +//# sourceMappingURL=assert.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/index.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/index.js ***! + \***************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isUint8Array = exports.isNonNullObject = exports.isDefined = exports.sleep = exports.assertDefinedAndNotNull = exports.assertDefined = exports.assert = exports.arrayContentStartsWith = exports.arrayContentEquals = void 0; +var arrays_1 = __webpack_require__(/*! ./arrays */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/arrays.js"); +Object.defineProperty(exports, "arrayContentEquals", ({ enumerable: true, get: function () { return arrays_1.arrayContentEquals; } })); +Object.defineProperty(exports, "arrayContentStartsWith", ({ enumerable: true, get: function () { return arrays_1.arrayContentStartsWith; } })); +var assert_1 = __webpack_require__(/*! ./assert */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/assert.js"); +Object.defineProperty(exports, "assert", ({ enumerable: true, get: function () { return assert_1.assert; } })); +Object.defineProperty(exports, "assertDefined", ({ enumerable: true, get: function () { return assert_1.assertDefined; } })); +Object.defineProperty(exports, "assertDefinedAndNotNull", ({ enumerable: true, get: function () { return assert_1.assertDefinedAndNotNull; } })); +var sleep_1 = __webpack_require__(/*! ./sleep */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/sleep.js"); +Object.defineProperty(exports, "sleep", ({ enumerable: true, get: function () { return sleep_1.sleep; } })); +var typechecks_1 = __webpack_require__(/*! ./typechecks */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/typechecks.js"); +Object.defineProperty(exports, "isDefined", ({ enumerable: true, get: function () { return typechecks_1.isDefined; } })); +Object.defineProperty(exports, "isNonNullObject", ({ enumerable: true, get: function () { return typechecks_1.isNonNullObject; } })); +Object.defineProperty(exports, "isUint8Array", ({ enumerable: true, get: function () { return typechecks_1.isUint8Array; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/sleep.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/sleep.js ***! + \***************************************************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.sleep = void 0; +async function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} +exports.sleep = sleep; +//# sourceMappingURL=sleep.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/typechecks.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/@cosmjs/utils/build/typechecks.js ***! + \********************************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isDefined = exports.isUint8Array = exports.isNonNullObject = void 0; +/** + * Checks if data is a non-null object (i.e. matches the TypeScript object type). + * + * Note: this returns true for arrays, which are objects in JavaScript + * even though array and object are different types in JSON. + * + * @see https://www.typescriptlang.org/docs/handbook/basic-types.html#object + */ +// eslint-disable-next-line @typescript-eslint/ban-types +function isNonNullObject(data) { + return typeof data === "object" && data !== null; +} +exports.isNonNullObject = isNonNullObject; +/** + * Checks if data is an Uint8Array. Note: Buffer is treated as not a Uint8Array + */ +function isUint8Array(data) { + if (!isNonNullObject(data)) + return false; + // Avoid instanceof check which is unreliable in some JS environments + // https://medium.com/@simonwarta/limitations-of-the-instanceof-operator-f4bcdbe7a400 + // Use check that was discussed in https://github.com/crypto-browserify/pbkdf2/pull/81 + if (Object.prototype.toString.call(data) !== "[object Uint8Array]") + return false; + if (typeof Buffer !== "undefined" && typeof Buffer.isBuffer !== "undefined") { + // Buffer.isBuffer is available at runtime + if (Buffer.isBuffer(data)) + return false; + } + return true; +} +exports.isUint8Array = isUint8Array; +/** + * Checks if input is not undefined in a TypeScript-friendly way. + * + * This is convenient to use in e.g. `Array.filter` as it will convert + * the type of a `Array` to `Array`. + */ +function isDefined(value) { + return value !== undefined; +} +exports.isDefined = isDefined; +//# sourceMappingURL=typechecks.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/index.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/index.js ***! + \*************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/axios.js"); + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/adapters/xhr.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/adapters/xhr.js ***! + \************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); +var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/settle.js"); +var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/cookies.js"); +var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/buildURL.js"); +var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/buildFullPath.js"); +var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/parseHeaders.js"); +var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/isURLSameOrigin.js"); +var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/createError.js"); + +module.exports = function xhrAdapter(config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + var requestData = config.data; + var requestHeaders = config.headers; + var responseType = config.responseType; + + if (utils.isFormData(requestData)) { + delete requestHeaders['Content-Type']; // Let the browser set it + } + + var request = new XMLHttpRequest(); + + // HTTP basic authentication + if (config.auth) { + var username = config.auth.username || ''; + var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; + requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); + } + + var fullPath = buildFullPath(config.baseURL, config.url); + request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); + + // Set the request timeout in MS + request.timeout = config.timeout; + + function onloadend() { + if (!request) { + return; + } + // Prepare the response + var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; + var responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; + + settle(resolve, reject, response); + + // Clean up request + request = null; + } + + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(createError('Request aborted', config, 'ECONNABORTED', request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(createError('Network Error', config, null, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(createError( + timeoutErrorMessage, + config, + config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED', + request)); + + // Clean up request + request = null; + }; + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + if (utils.isStandardBrowserEnv()) { + // Add xsrf header + var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? + cookies.read(config.xsrfCookieName) : + undefined; + + if (xsrfValue) { + requestHeaders[config.xsrfHeaderName] = xsrfValue; + } + } + + // Add headers to the request + if ('setRequestHeader' in request) { + utils.forEach(requestHeaders, function setRequestHeader(val, key) { + if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { + // Remove Content-Type if data is undefined + delete requestHeaders[key]; + } else { + // Otherwise add header to the request + request.setRequestHeader(key, val); + } + }); + } + + // Add withCredentials to request if needed + if (!utils.isUndefined(config.withCredentials)) { + request.withCredentials = !!config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = config.responseType; + } + + // Handle progress if needed + if (typeof config.onDownloadProgress === 'function') { + request.addEventListener('progress', config.onDownloadProgress); + } + + // Not all browsers support upload events + if (typeof config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', config.onUploadProgress); + } + + if (config.cancelToken) { + // Handle cancellation + config.cancelToken.promise.then(function onCanceled(cancel) { + if (!request) { + return; + } + + request.abort(); + reject(cancel); + // Clean up request + request = null; + }); + } + + if (!requestData) { + requestData = null; + } + + // Send the request + request.send(requestData); + }); +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/axios.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/axios.js ***! + \*****************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); +var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/bind.js"); +var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/Axios.js"); +var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/mergeConfig.js"); +var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/defaults.js"); + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * @return {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + var context = new Axios(defaultConfig); + var instance = bind(Axios.prototype.request, context); + + // Copy axios.prototype to instance + utils.extend(instance, Axios.prototype, context); + + // Copy context to instance + utils.extend(instance, context); + + return instance; +} + +// Create the default instance to be exported +var axios = createInstance(defaults); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios; + +// Factory for creating new instances +axios.create = function create(instanceConfig) { + return createInstance(mergeConfig(axios.defaults, instanceConfig)); +}; + +// Expose Cancel & CancelToken +axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/cancel/Cancel.js"); +axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/cancel/CancelToken.js"); +axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/cancel/isCancel.js"); + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; +axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/spread.js"); + +// Expose isAxiosError +axios.isAxiosError = __webpack_require__(/*! ./helpers/isAxiosError */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/isAxiosError.js"); + +module.exports = axios; + +// Allow use of default import syntax in TypeScript +module.exports["default"] = axios; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/cancel/Cancel.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/cancel/Cancel.js ***! + \*************************************************************************************/ +/***/ (function(module) { + +"use strict"; + + +/** + * A `Cancel` is an object that is thrown when an operation is canceled. + * + * @class + * @param {string=} message The message. + */ +function Cancel(message) { + this.message = message; +} + +Cancel.prototype.toString = function toString() { + return 'Cancel' + (this.message ? ': ' + this.message : ''); +}; + +Cancel.prototype.__CANCEL__ = true; + +module.exports = Cancel; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/cancel/CancelToken.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/cancel/CancelToken.js ***! + \******************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/cancel/Cancel.js"); + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @class + * @param {Function} executor The executor function. + */ +function CancelToken(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + var resolvePromise; + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + var token = this; + executor(function cancel(message) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new Cancel(message); + resolvePromise(token.reason); + }); +} + +/** + * Throws a `Cancel` if cancellation has been requested. + */ +CancelToken.prototype.throwIfRequested = function throwIfRequested() { + if (this.reason) { + throw this.reason; + } +}; + +/** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ +CancelToken.source = function source() { + var cancel; + var token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token: token, + cancel: cancel + }; +}; + +module.exports = CancelToken; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/cancel/isCancel.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/cancel/isCancel.js ***! + \***************************************************************************************/ +/***/ (function(module) { + +"use strict"; + + +module.exports = function isCancel(value) { + return !!(value && value.__CANCEL__); +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/Axios.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/Axios.js ***! + \**********************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); +var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/buildURL.js"); +var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/InterceptorManager.js"); +var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/dispatchRequest.js"); +var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/mergeConfig.js"); +var validator = __webpack_require__(/*! ../helpers/validator */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/validator.js"); + +var validators = validator.validators; +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + */ +function Axios(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager(), + response: new InterceptorManager() + }; +} + +/** + * Dispatch a request + * + * @param {Object} config The config specific for this request (merged with this.defaults) + */ +Axios.prototype.request = function request(config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof config === 'string') { + config = arguments[1] || {}; + config.url = arguments[0]; + } else { + config = config || {}; + } + + config = mergeConfig(this.defaults, config); + + // Set config.method + if (config.method) { + config.method = config.method.toLowerCase(); + } else if (this.defaults.method) { + config.method = this.defaults.method.toLowerCase(); + } else { + config.method = 'get'; + } + + var transitional = config.transitional; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'), + forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'), + clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0') + }, false); + } + + // filter out skipped interceptors + var requestInterceptorChain = []; + var synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + var responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + var promise; + + if (!synchronousRequestInterceptors) { + var chain = [dispatchRequest, undefined]; + + Array.prototype.unshift.apply(chain, requestInterceptorChain); + chain = chain.concat(responseInterceptorChain); + + promise = Promise.resolve(config); + while (chain.length) { + promise = promise.then(chain.shift(), chain.shift()); + } + + return promise; + } + + + var newConfig = config; + while (requestInterceptorChain.length) { + var onFulfilled = requestInterceptorChain.shift(); + var onRejected = requestInterceptorChain.shift(); + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected(error); + break; + } + } + + try { + promise = dispatchRequest(newConfig); + } catch (error) { + return Promise.reject(error); + } + + while (responseInterceptorChain.length) { + promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift()); + } + + return promise; +}; + +Axios.prototype.getUri = function getUri(config) { + config = mergeConfig(this.defaults, config); + return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); +}; + +// Provide aliases for supported request methods +utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method: method, + url: url, + data: (config || {}).data + })); + }; +}); + +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, data, config) { + return this.request(mergeConfig(config || {}, { + method: method, + url: url, + data: data + })); + }; +}); + +module.exports = Axios; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/InterceptorManager.js": +/*!***********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/InterceptorManager.js ***! + \***********************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); + +function InterceptorManager() { + this.handlers = []; +} + +/** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ +InterceptorManager.prototype.use = function use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled: fulfilled, + rejected: rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; +}; + +/** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + */ +InterceptorManager.prototype.eject = function eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } +}; + +/** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + */ +InterceptorManager.prototype.forEach = function forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); +}; + +module.exports = InterceptorManager; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/buildFullPath.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/buildFullPath.js ***! + \******************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/isAbsoluteURL.js"); +var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/combineURLs.js"); + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * @returns {string} The combined full path + */ +module.exports = function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/createError.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/createError.js ***! + \****************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/enhanceError.js"); + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {Object} config The config. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The created error. + */ +module.exports = function createError(message, config, code, request, response) { + var error = new Error(message); + return enhanceError(error, config, code, request, response); +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/dispatchRequest.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/dispatchRequest.js ***! + \********************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); +var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/transformData.js"); +var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/cancel/isCancel.js"); +var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/defaults.js"); + +/** + * Throws a `Cancel` if cancellation has been requested. + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * @returns {Promise} The Promise to be fulfilled + */ +module.exports = function dispatchRequest(config) { + throwIfCancellationRequested(config); + + // Ensure headers exist + config.headers = config.headers || {}; + + // Transform request data + config.data = transformData.call( + config, + config.data, + config.headers, + config.transformRequest + ); + + // Flatten headers + config.headers = utils.merge( + config.headers.common || {}, + config.headers[config.method] || {}, + config.headers + ); + + utils.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + function cleanHeaderConfig(method) { + delete config.headers[method]; + } + ); + + var adapter = config.adapter || defaults.adapter; + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + response.data, + response.headers, + config.transformResponse + ); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + reason.response.data, + reason.response.headers, + config.transformResponse + ); + } + } + + return Promise.reject(reason); + }); +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/enhanceError.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/enhanceError.js ***! + \*****************************************************************************************/ +/***/ (function(module) { + +"use strict"; + + +/** + * Update an Error with the specified config, error code, and response. + * + * @param {Error} error The error to update. + * @param {Object} config The config. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The error. + */ +module.exports = function enhanceError(error, config, code, request, response) { + error.config = config; + if (code) { + error.code = code; + } + + error.request = request; + error.response = response; + error.isAxiosError = true; + + error.toJSON = function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: this.config, + code: this.code + }; + }; + return error; +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/mergeConfig.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/mergeConfig.js ***! + \****************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * @returns {Object} New object resulting from merging config2 to config1 + */ +module.exports = function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + var config = {}; + + var valueFromConfig2Keys = ['url', 'method', 'data']; + var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; + var defaultToConfig2Keys = [ + 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', + 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', + 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', + 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', + 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' + ]; + var directMergeKeys = ['validateStatus']; + + function getMergedValue(target, source) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge(target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); + } + return source; + } + + function mergeDeepProperties(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(config1[prop], config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + config[prop] = getMergedValue(undefined, config1[prop]); + } + } + + utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(undefined, config2[prop]); + } + }); + + utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); + + utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(undefined, config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + config[prop] = getMergedValue(undefined, config1[prop]); + } + }); + + utils.forEach(directMergeKeys, function merge(prop) { + if (prop in config2) { + config[prop] = getMergedValue(config1[prop], config2[prop]); + } else if (prop in config1) { + config[prop] = getMergedValue(undefined, config1[prop]); + } + }); + + var axiosKeys = valueFromConfig2Keys + .concat(mergeDeepPropertiesKeys) + .concat(defaultToConfig2Keys) + .concat(directMergeKeys); + + var otherKeys = Object + .keys(config1) + .concat(Object.keys(config2)) + .filter(function filterAxiosKeys(key) { + return axiosKeys.indexOf(key) === -1; + }); + + utils.forEach(otherKeys, mergeDeepProperties); + + return config; +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/settle.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/settle.js ***! + \***********************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var createError = __webpack_require__(/*! ./createError */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/createError.js"); + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + */ +module.exports = function settle(resolve, reject, response) { + var validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(createError( + 'Request failed with status code ' + response.status, + response.config, + null, + response.request, + response + )); + } +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/transformData.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/transformData.js ***! + \******************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); +var defaults = __webpack_require__(/*! ./../defaults */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/defaults.js"); + +/** + * Transform the data for a request or a response + * + * @param {Object|String} data The data to be transformed + * @param {Array} headers The headers for the request or response + * @param {Array|Function} fns A single function or Array of functions + * @returns {*} The resulting transformed data + */ +module.exports = function transformData(data, headers, fns) { + var context = this || defaults; + /*eslint no-param-reassign:0*/ + utils.forEach(fns, function transform(fn) { + data = fn.call(context, data, headers); + }); + + return data; +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/defaults.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/defaults.js ***! + \********************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); +var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/normalizeHeaderName.js"); +var enhanceError = __webpack_require__(/*! ./core/enhanceError */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/core/enhanceError.js"); + +var DEFAULT_CONTENT_TYPE = { + 'Content-Type': 'application/x-www-form-urlencoded' +}; + +function setContentTypeIfUnset(headers, value) { + if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { + headers['Content-Type'] = value; + } +} + +function getDefaultAdapter() { + var adapter; + if (typeof XMLHttpRequest !== 'undefined') { + // For browsers use XHR adapter + adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/adapters/xhr.js"); + } else if ( true && Object.prototype.toString.call(({"env":{"NODE_ENV":"production"}})) === '[object process]') { + // For node use HTTP adapter + adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/adapters/xhr.js"); + } + return adapter; +} + +function stringifySafely(rawValue, parser, encoder) { + if (utils.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); +} + +var defaults = { + + transitional: { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false + }, + + adapter: getDefaultAdapter(), + + transformRequest: [function transformRequest(data, headers) { + normalizeHeaderName(headers, 'Accept'); + normalizeHeaderName(headers, 'Content-Type'); + + if (utils.isFormData(data) || + utils.isArrayBuffer(data) || + utils.isBuffer(data) || + utils.isStream(data) || + utils.isFile(data) || + utils.isBlob(data) + ) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); + return data.toString(); + } + if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) { + setContentTypeIfUnset(headers, 'application/json'); + return stringifySafely(data); + } + return data; + }], + + transformResponse: [function transformResponse(data) { + var transitional = this.transitional; + var silentJSONParsing = transitional && transitional.silentJSONParsing; + var forcedJSONParsing = transitional && transitional.forcedJSONParsing; + var strictJSONParsing = !silentJSONParsing && this.responseType === 'json'; + + if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) { + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw enhanceError(e, this, 'E_JSON_PARSE'); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + } +}; + +defaults.headers = { + common: { + 'Accept': 'application/json, text/plain, */*' + } +}; + +utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { + defaults.headers[method] = {}; +}); + +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); +}); + +module.exports = defaults; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/bind.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/bind.js ***! + \************************************************************************************/ +/***/ (function(module) { + +"use strict"; + + +module.exports = function bind(fn, thisArg) { + return function wrap() { + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + return fn.apply(thisArg, args); + }; +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/buildURL.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/buildURL.js ***! + \****************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); + +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @returns {string} The formatted url + */ +module.exports = function buildURL(url, params, paramsSerializer) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + var serializedParams; + if (paramsSerializer) { + serializedParams = paramsSerializer(params); + } else if (utils.isURLSearchParams(params)) { + serializedParams = params.toString(); + } else { + var parts = []; + + utils.forEach(params, function serialize(val, key) { + if (val === null || typeof val === 'undefined') { + return; + } + + if (utils.isArray(val)) { + key = key + '[]'; + } else { + val = [val]; + } + + utils.forEach(val, function parseValue(v) { + if (utils.isDate(v)) { + v = v.toISOString(); + } else if (utils.isObject(v)) { + v = JSON.stringify(v); + } + parts.push(encode(key) + '=' + encode(v)); + }); + }); + + serializedParams = parts.join('&'); + } + + if (serializedParams) { + var hashmarkIndex = url.indexOf('#'); + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/combineURLs.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/combineURLs.js ***! + \*******************************************************************************************/ +/***/ (function(module) { + +"use strict"; + + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * @returns {string} The combined URL + */ +module.exports = function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/cookies.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/cookies.js ***! + \***************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); + +module.exports = ( + utils.isStandardBrowserEnv() ? + + // Standard browser envs support document.cookie + (function standardBrowserEnv() { + return { + write: function write(name, value, expires, path, domain, secure) { + var cookie = []; + cookie.push(name + '=' + encodeURIComponent(value)); + + if (utils.isNumber(expires)) { + cookie.push('expires=' + new Date(expires).toGMTString()); + } + + if (utils.isString(path)) { + cookie.push('path=' + path); + } + + if (utils.isString(domain)) { + cookie.push('domain=' + domain); + } + + if (secure === true) { + cookie.push('secure'); + } + + document.cookie = cookie.join('; '); + }, + + read: function read(name) { + var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove: function remove(name) { + this.write(name, '', Date.now() - 86400000); + } + }; + })() : + + // Non standard browser env (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return { + write: function write() {}, + read: function read() { return null; }, + remove: function remove() {} + }; + })() +); + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/isAbsoluteURL.js": +/*!*********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/isAbsoluteURL.js ***! + \*********************************************************************************************/ +/***/ (function(module) { + +"use strict"; + + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +module.exports = function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/isAxiosError.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/isAxiosError.js ***! + \********************************************************************************************/ +/***/ (function(module) { + +"use strict"; + + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +module.exports = function isAxiosError(payload) { + return (typeof payload === 'object') && (payload.isAxiosError === true); +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/isURLSameOrigin.js": +/*!***********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/isURLSameOrigin.js ***! + \***********************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); + +module.exports = ( + utils.isStandardBrowserEnv() ? + + // Standard browser envs have full support of the APIs needed to test + // whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + var msie = /(msie|trident)/i.test(navigator.userAgent); + var urlParsingNode = document.createElement('a'); + var originURL; + + /** + * Parse a URL to discover it's components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + var href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })() +); + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/normalizeHeaderName.js": +/*!***************************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/normalizeHeaderName.js ***! + \***************************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); + +module.exports = function normalizeHeaderName(headers, normalizedName) { + utils.forEach(headers, function processHeader(value, name) { + if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { + headers[normalizedName] = value; + delete headers[name]; + } + }); +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/parseHeaders.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/parseHeaders.js ***! + \********************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js"); + +// Headers whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +var ignoreDuplicateOf = [ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]; + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} headers Headers needing to be parsed + * @returns {Object} Headers parsed into an object + */ +module.exports = function parseHeaders(headers) { + var parsed = {}; + var key; + var val; + var i; + + if (!headers) { return parsed; } + + utils.forEach(headers.split('\n'), function parser(line) { + i = line.indexOf(':'); + key = utils.trim(line.substr(0, i)).toLowerCase(); + val = utils.trim(line.substr(i + 1)); + + if (key) { + if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { + return; + } + if (key === 'set-cookie') { + parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + } + }); + + return parsed; +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/spread.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/spread.js ***! + \**************************************************************************************/ +/***/ (function(module) { + +"use strict"; + + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * @returns {Function} + */ +module.exports = function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/validator.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/validator.js ***! + \*****************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var pkg = __webpack_require__(/*! ./../../package.json */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/package.json"); + +var validators = {}; + +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) { + validators[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); + +var deprecatedWarnings = {}; +var currentVerArr = pkg.version.split('.'); + +/** + * Compare package versions + * @param {string} version + * @param {string?} thanVersion + * @returns {boolean} + */ +function isOlderVersion(version, thanVersion) { + var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr; + var destVer = version.split('.'); + for (var i = 0; i < 3; i++) { + if (pkgVersionArr[i] > destVer[i]) { + return true; + } else if (pkgVersionArr[i] < destVer[i]) { + return false; + } + } + return false; +} + +/** + * Transitional option validator + * @param {function|boolean?} validator + * @param {string?} version + * @param {string} message + * @returns {function} + */ +validators.transitional = function transitional(validator, version, message) { + var isDeprecated = version && isOlderVersion(version); + + function formatMessage(opt, desc) { + return '[Axios v' + pkg.version + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return function(value, opt, opts) { + if (validator === false) { + throw new Error(formatMessage(opt, ' has been removed in ' + version)); + } + + if (isDeprecated && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; +}; + +/** + * Assert object's properties type + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + */ + +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new TypeError('options must be an object'); + } + var keys = Object.keys(options); + var i = keys.length; + while (i-- > 0) { + var opt = keys[i]; + var validator = schema[opt]; + if (validator) { + var value = options[opt]; + var result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new TypeError('option ' + opt + ' must be ' + result); + } + continue; + } + if (allowUnknown !== true) { + throw Error('Unknown option ' + opt); + } + } +} + +module.exports = { + isOlderVersion: isOlderVersion, + assertOptions: assertOptions, + validators: validators +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/utils.js ***! + \*****************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/@cosmjs/tendermint-rpc/node_modules/axios/lib/helpers/bind.js"); + +// utils is a library of generic helper functions non-specific to axios + +var toString = Object.prototype.toString; + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Array, otherwise false + */ +function isArray(val) { + return toString.call(val) === '[object Array]'; +} + +/** + * Determine if a value is undefined + * + * @param {Object} val The value to test + * @returns {boolean} True if the value is undefined, otherwise false + */ +function isUndefined(val) { + return typeof val === 'undefined'; +} + +/** + * Determine if a value is a Buffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +function isArrayBuffer(val) { + return toString.call(val) === '[object ArrayBuffer]'; +} + +/** + * Determine if a value is a FormData + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an FormData, otherwise false + */ +function isFormData(val) { + return (typeof FormData !== 'undefined') && (val instanceof FormData); +} + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + var result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a String, otherwise false + */ +function isString(val) { + return typeof val === 'string'; +} + +/** + * Determine if a value is a Number + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Number, otherwise false + */ +function isNumber(val) { + return typeof val === 'number'; +} + +/** + * Determine if a value is an Object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Object, otherwise false + */ +function isObject(val) { + return val !== null && typeof val === 'object'; +} + +/** + * Determine if a value is a plain Object + * + * @param {Object} val The value to test + * @return {boolean} True if value is a plain Object, otherwise false + */ +function isPlainObject(val) { + if (toString.call(val) !== '[object Object]') { + return false; + } + + var prototype = Object.getPrototypeOf(val); + return prototype === null || prototype === Object.prototype; +} + +/** + * Determine if a value is a Date + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Date, otherwise false + */ +function isDate(val) { + return toString.call(val) === '[object Date]'; +} + +/** + * Determine if a value is a File + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a File, otherwise false + */ +function isFile(val) { + return toString.call(val) === '[object File]'; +} + +/** + * Determine if a value is a Blob + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Blob, otherwise false + */ +function isBlob(val) { + return toString.call(val) === '[object Blob]'; +} + +/** + * Determine if a value is a Function + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +function isFunction(val) { + return toString.call(val) === '[object Function]'; +} + +/** + * Determine if a value is a Stream + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Stream, otherwise false + */ +function isStream(val) { + return isObject(val) && isFunction(val.pipe); +} + +/** + * Determine if a value is a URLSearchParams object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +function isURLSearchParams(val) { + return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; +} + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * @returns {String} The String freed of excess whitespace + */ +function trim(str) { + return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); +} + +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + */ +function isStandardBrowserEnv() { + if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || + navigator.product === 'NativeScript' || + navigator.product === 'NS')) { + return false; + } + return ( + typeof window !== 'undefined' && + typeof document !== 'undefined' + ); +} + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + */ +function forEach(obj, fn) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (var i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + fn.call(null, obj[key], key, obj); + } + } + } +} + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + var result = {}; + function assignValue(val, key) { + if (isPlainObject(result[key]) && isPlainObject(val)) { + result[key] = merge(result[key], val); + } else if (isPlainObject(val)) { + result[key] = merge({}, val); + } else if (isArray(val)) { + result[key] = val.slice(); + } else { + result[key] = val; + } + } + + for (var i = 0, l = arguments.length; i < l; i++) { + forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * @return {Object} The resulting value of object a + */ +function extend(a, b, thisArg) { + forEach(b, function assignValue(val, key) { + if (thisArg && typeof val === 'function') { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }); + return a; +} + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * @return {string} content value without BOM + */ +function stripBOM(content) { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +} + +module.exports = { + isArray: isArray, + isArrayBuffer: isArrayBuffer, + isBuffer: isBuffer, + isFormData: isFormData, + isArrayBufferView: isArrayBufferView, + isString: isString, + isNumber: isNumber, + isObject: isObject, + isPlainObject: isPlainObject, + isUndefined: isUndefined, + isDate: isDate, + isFile: isFile, + isBlob: isBlob, + isFunction: isFunction, + isStream: isStream, + isURLSearchParams: isURLSearchParams, + isStandardBrowserEnv: isStandardBrowserEnv, + forEach: forEach, + merge: merge, + extend: extend, + trim: trim, + stripBOM: stripBOM +}; + + +/***/ }), + +/***/ "./node_modules/@cosmjs/utils/build/arrays.js": +/*!****************************************************!*\ + !*** ./node_modules/@cosmjs/utils/build/arrays.js ***! + \****************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.arrayContentStartsWith = exports.arrayContentEquals = void 0; +/** + * Compares the content of two arrays-like objects for equality. + * + * Equality is defined as having equal length and element values, where element equality means `===` returning `true`. + * + * This allows you to compare the content of a Buffer, Uint8Array or number[], ignoring the specific type. + * As a consequence, this returns different results than Jasmine's `toEqual`, which ensures elements have the same type. + */ +function arrayContentEquals(a, b) { + if (a.length !== b.length) + return false; + for (let i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; +} +exports.arrayContentEquals = arrayContentEquals; +/** + * Checks if `a` starts with the contents of `b`. + * + * This requires equality of the element values, where element equality means `===` returning `true`. + * + * This allows you to compare the content of a Buffer, Uint8Array or number[], ignoring the specific type. + * As a consequence, this returns different results than Jasmine's `toEqual`, which ensures elements have the same type. + */ +function arrayContentStartsWith(a, b) { + if (a.length < b.length) + return false; + for (let i = 0; i < b.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; +} +exports.arrayContentStartsWith = arrayContentStartsWith; +//# sourceMappingURL=arrays.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/utils/build/assert.js": +/*!****************************************************!*\ + !*** ./node_modules/@cosmjs/utils/build/assert.js ***! + \****************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.assertDefinedAndNotNull = exports.assertDefined = exports.assert = void 0; +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function assert(condition, msg) { + if (!condition) { + throw new Error(msg || "condition is not truthy"); + } +} +exports.assert = assert; +function assertDefined(value, msg) { + if (value === undefined) { + throw new Error(msg !== null && msg !== void 0 ? msg : "value is undefined"); + } +} +exports.assertDefined = assertDefined; +function assertDefinedAndNotNull(value, msg) { + if (value === undefined || value === null) { + throw new Error(msg !== null && msg !== void 0 ? msg : "value is undefined or null"); + } +} +exports.assertDefinedAndNotNull = assertDefinedAndNotNull; +//# sourceMappingURL=assert.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/utils/build/index.js": +/*!***************************************************!*\ + !*** ./node_modules/@cosmjs/utils/build/index.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isUint8Array = exports.isNonNullObject = exports.isDefined = exports.sleep = exports.assertDefinedAndNotNull = exports.assertDefined = exports.assert = exports.arrayContentStartsWith = exports.arrayContentEquals = void 0; +var arrays_1 = __webpack_require__(/*! ./arrays */ "./node_modules/@cosmjs/utils/build/arrays.js"); +Object.defineProperty(exports, "arrayContentEquals", ({ enumerable: true, get: function () { return arrays_1.arrayContentEquals; } })); +Object.defineProperty(exports, "arrayContentStartsWith", ({ enumerable: true, get: function () { return arrays_1.arrayContentStartsWith; } })); +var assert_1 = __webpack_require__(/*! ./assert */ "./node_modules/@cosmjs/utils/build/assert.js"); +Object.defineProperty(exports, "assert", ({ enumerable: true, get: function () { return assert_1.assert; } })); +Object.defineProperty(exports, "assertDefined", ({ enumerable: true, get: function () { return assert_1.assertDefined; } })); +Object.defineProperty(exports, "assertDefinedAndNotNull", ({ enumerable: true, get: function () { return assert_1.assertDefinedAndNotNull; } })); +var sleep_1 = __webpack_require__(/*! ./sleep */ "./node_modules/@cosmjs/utils/build/sleep.js"); +Object.defineProperty(exports, "sleep", ({ enumerable: true, get: function () { return sleep_1.sleep; } })); +var typechecks_1 = __webpack_require__(/*! ./typechecks */ "./node_modules/@cosmjs/utils/build/typechecks.js"); +Object.defineProperty(exports, "isDefined", ({ enumerable: true, get: function () { return typechecks_1.isDefined; } })); +Object.defineProperty(exports, "isNonNullObject", ({ enumerable: true, get: function () { return typechecks_1.isNonNullObject; } })); +Object.defineProperty(exports, "isUint8Array", ({ enumerable: true, get: function () { return typechecks_1.isUint8Array; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/utils/build/sleep.js": +/*!***************************************************!*\ + !*** ./node_modules/@cosmjs/utils/build/sleep.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.sleep = void 0; +async function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} +exports.sleep = sleep; +//# sourceMappingURL=sleep.js.map + +/***/ }), + +/***/ "./node_modules/@cosmjs/utils/build/typechecks.js": +/*!********************************************************!*\ + !*** ./node_modules/@cosmjs/utils/build/typechecks.js ***! + \********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isDefined = exports.isUint8Array = exports.isNonNullObject = void 0; +/** + * Checks if data is a non-null object (i.e. matches the TypeScript object type). + * + * Note: this returns true for arrays, which are objects in JavaScript + * even though array and object are different types in JSON. + * + * @see https://www.typescriptlang.org/docs/handbook/basic-types.html#object + */ +// eslint-disable-next-line @typescript-eslint/ban-types +function isNonNullObject(data) { + return typeof data === "object" && data !== null; +} +exports.isNonNullObject = isNonNullObject; +/** + * Checks if data is an Uint8Array. Note: Buffer is treated as not a Uint8Array + */ +function isUint8Array(data) { + if (!isNonNullObject(data)) + return false; + // Avoid instanceof check which is unreliable in some JS environments + // https://medium.com/@simonwarta/limitations-of-the-instanceof-operator-f4bcdbe7a400 + // Use check that was discussed in https://github.com/crypto-browserify/pbkdf2/pull/81 + if (Object.prototype.toString.call(data) !== "[object Uint8Array]") + return false; + if (typeof Buffer !== "undefined" && typeof Buffer.isBuffer !== "undefined") { + // Buffer.isBuffer is available at runtime + if (Buffer.isBuffer(data)) + return false; + } + return true; +} +exports.isUint8Array = isUint8Array; +/** + * Checks if input is not undefined in a TypeScript-friendly way. + * + * This is convenient to use in e.g. `Array.filter` as it will convert + * the type of a `Array` to `Array`. + */ +function isDefined(value) { + return value !== undefined; +} +exports.isDefined = isDefined; +//# sourceMappingURL=typechecks.js.map + +/***/ }), + +/***/ "./node_modules/@noble/curves/_shortw_utils.js": +/*!*****************************************************!*\ + !*** ./node_modules/@noble/curves/_shortw_utils.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createCurve = exports.getHash = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const hmac_1 = __webpack_require__(/*! @noble/hashes/hmac */ "./node_modules/@noble/hashes/hmac.js"); +const utils_1 = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js"); +const weierstrass_js_1 = __webpack_require__(/*! ./abstract/weierstrass.js */ "./node_modules/@noble/curves/abstract/weierstrass.js"); +// connects noble-curves to noble-hashes +function getHash(hash) { + return { + hash, + hmac: (key, ...msgs) => (0, hmac_1.hmac)(hash, key, (0, utils_1.concatBytes)(...msgs)), + randomBytes: utils_1.randomBytes, + }; +} +exports.getHash = getHash; +function createCurve(curveDef, defHash) { + const create = (hash) => (0, weierstrass_js_1.weierstrass)({ ...curveDef, ...getHash(hash) }); + return Object.freeze({ ...create(defHash), create }); +} +exports.createCurve = createCurve; +//# sourceMappingURL=_shortw_utils.js.map + +/***/ }), + +/***/ "./node_modules/@noble/curves/abstract/curve.js": +/*!******************************************************!*\ + !*** ./node_modules/@noble/curves/abstract/curve.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.validateBasic = exports.wNAF = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Abelian group utilities +const modular_js_1 = __webpack_require__(/*! ./modular.js */ "./node_modules/@noble/curves/abstract/modular.js"); +const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/curves/abstract/utils.js"); +const _0n = BigInt(0); +const _1n = BigInt(1); +// Elliptic curve multiplication of Point by scalar. Fragile. +// Scalars should always be less than curve order: this should be checked inside of a curve itself. +// Creates precomputation tables for fast multiplication: +// - private scalar is split by fixed size windows of W bits +// - every window point is collected from window's table & added to accumulator +// - since windows are different, same point inside tables won't be accessed more than once per calc +// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar) +// - +1 window is neccessary for wNAF +// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication +// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow +// windows to be in different memory locations +function wNAF(c, bits) { + const constTimeNegate = (condition, item) => { + const neg = item.negate(); + return condition ? neg : item; + }; + const opts = (W) => { + const windows = Math.ceil(bits / W) + 1; // +1, because + const windowSize = 2 ** (W - 1); // -1 because we skip zero + return { windows, windowSize }; + }; + return { + constTimeNegate, + // non-const time multiplication ladder + unsafeLadder(elm, n) { + let p = c.ZERO; + let d = elm; + while (n > _0n) { + if (n & _1n) + p = p.add(d); + d = d.double(); + n >>= _1n; + } + return p; + }, + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(elm, W) { + const { windows, windowSize } = opts(W); + const points = []; + let p = elm; + let base = p; + for (let window = 0; window < windows; window++) { + base = p; + points.push(base); + // =1, because we skip zero + for (let i = 1; i < windowSize; i++) { + base = base.add(p); + points.push(base); + } + p = base.double(); + } + return points; + }, + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @returns real and fake (for const-time) points + */ + wNAF(W, precomputes, n) { + // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise + // But need to carefully remove other checks before wNAF. ORDER == bits here + const { windows, windowSize } = opts(W); + let p = c.ZERO; + let f = c.BASE; + const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc. + const maxNumber = 2 ** W; + const shiftBy = BigInt(W); + for (let window = 0; window < windows; window++) { + const offset = window * windowSize; + // Extract W bits. + let wbits = Number(n & mask); + // Shift number by W bits. + n >>= shiftBy; + // If the bits are bigger than max size, we'll split those. + // +224 => 256 - 32 + if (wbits > windowSize) { + wbits -= maxNumber; + n += _1n; + } + // This code was first written with assumption that 'f' and 'p' will never be infinity point: + // since each addition is multiplied by 2 ** W, it cannot cancel each other. However, + // there is negate now: it is possible that negated element from low value + // would be the same as high element, which will create carry into next window. + // It's not obvious how this can fail, but still worth investigating later. + // Check if we're onto Zero point. + // Add random point inside current window to f. + const offset1 = offset; + const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero + const cond1 = window % 2 !== 0; + const cond2 = wbits < 0; + if (wbits === 0) { + // The most important part for const-time getPublicKey + f = f.add(constTimeNegate(cond1, precomputes[offset1])); + } + else { + p = p.add(constTimeNegate(cond2, precomputes[offset2])); + } + } + // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ() + // Even if the variable is still unused, there are some checks which will + // throw an exception, so compiler needs to prove they won't happen, which is hard. + // At this point there is a way to F be infinity-point even if p is not, + // which makes it less const-time: around 1 bigint multiply. + return { p, f }; + }, + wNAFCached(P, precomputesMap, n, transform) { + // @ts-ignore + const W = P._WINDOW_SIZE || 1; + // Calculate precomputes on a first run, reuse them after + let comp = precomputesMap.get(P); + if (!comp) { + comp = this.precomputeWindow(P, W); + if (W !== 1) { + precomputesMap.set(P, transform(comp)); + } + } + return this.wNAF(W, comp, n); + }, + }; +} +exports.wNAF = wNAF; +function validateBasic(curve) { + (0, modular_js_1.validateField)(curve.Fp); + (0, utils_js_1.validateObject)(curve, { + n: 'bigint', + h: 'bigint', + Gx: 'field', + Gy: 'field', + }, { + nBitLength: 'isSafeInteger', + nByteLength: 'isSafeInteger', + }); + // Set defaults + return Object.freeze({ + ...(0, modular_js_1.nLength)(curve.n, curve.nBitLength), + ...curve, + ...{ p: curve.Fp.ORDER }, + }); +} +exports.validateBasic = validateBasic; +//# sourceMappingURL=curve.js.map + +/***/ }), + +/***/ "./node_modules/@noble/curves/abstract/hash-to-curve.js": +/*!**************************************************************!*\ + !*** ./node_modules/@noble/curves/abstract/hash-to-curve.js ***! + \**************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createHasher = exports.isogenyMap = exports.hash_to_field = exports.expand_message_xof = exports.expand_message_xmd = void 0; +const modular_js_1 = __webpack_require__(/*! ./modular.js */ "./node_modules/@noble/curves/abstract/modular.js"); +const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/curves/abstract/utils.js"); +function validateDST(dst) { + if (dst instanceof Uint8Array) + return dst; + if (typeof dst === 'string') + return (0, utils_js_1.utf8ToBytes)(dst); + throw new Error('DST must be Uint8Array or string'); +} +// Octet Stream to Integer. "spec" implementation of os2ip is 2.5x slower vs bytesToNumberBE. +const os2ip = utils_js_1.bytesToNumberBE; +// Integer to Octet Stream (numberToBytesBE) +function i2osp(value, length) { + if (value < 0 || value >= 1 << (8 * length)) { + throw new Error(`bad I2OSP call: value=${value} length=${length}`); + } + const res = Array.from({ length }).fill(0); + for (let i = length - 1; i >= 0; i--) { + res[i] = value & 0xff; + value >>>= 8; + } + return new Uint8Array(res); +} +function strxor(a, b) { + const arr = new Uint8Array(a.length); + for (let i = 0; i < a.length; i++) { + arr[i] = a[i] ^ b[i]; + } + return arr; +} +function isBytes(item) { + if (!(item instanceof Uint8Array)) + throw new Error('Uint8Array expected'); +} +function isNum(item) { + if (!Number.isSafeInteger(item)) + throw new Error('number expected'); +} +// Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits +// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-11#section-5.4.1 +function expand_message_xmd(msg, DST, lenInBytes, H) { + isBytes(msg); + isBytes(DST); + isNum(lenInBytes); + // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-16#section-5.3.3 + if (DST.length > 255) + DST = H((0, utils_js_1.concatBytes)((0, utils_js_1.utf8ToBytes)('H2C-OVERSIZE-DST-'), DST)); + const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; + const ell = Math.ceil(lenInBytes / b_in_bytes); + if (ell > 255) + throw new Error('Invalid xmd length'); + const DST_prime = (0, utils_js_1.concatBytes)(DST, i2osp(DST.length, 1)); + const Z_pad = i2osp(0, r_in_bytes); + const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str + const b = new Array(ell); + const b_0 = H((0, utils_js_1.concatBytes)(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); + b[0] = H((0, utils_js_1.concatBytes)(b_0, i2osp(1, 1), DST_prime)); + for (let i = 1; i <= ell; i++) { + const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime]; + b[i] = H((0, utils_js_1.concatBytes)(...args)); + } + const pseudo_random_bytes = (0, utils_js_1.concatBytes)(...b); + return pseudo_random_bytes.slice(0, lenInBytes); +} +exports.expand_message_xmd = expand_message_xmd; +function expand_message_xof(msg, DST, lenInBytes, k, H) { + isBytes(msg); + isBytes(DST); + isNum(lenInBytes); + // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-16#section-5.3.3 + // DST = H('H2C-OVERSIZE-DST-' || a_very_long_DST, Math.ceil((lenInBytes * k) / 8)); + if (DST.length > 255) { + const dkLen = Math.ceil((2 * k) / 8); + DST = H.create({ dkLen }).update((0, utils_js_1.utf8ToBytes)('H2C-OVERSIZE-DST-')).update(DST).digest(); + } + if (lenInBytes > 65535 || DST.length > 255) + throw new Error('expand_message_xof: invalid lenInBytes'); + return (H.create({ dkLen: lenInBytes }) + .update(msg) + .update(i2osp(lenInBytes, 2)) + // 2. DST_prime = DST || I2OSP(len(DST), 1) + .update(DST) + .update(i2osp(DST.length, 1)) + .digest()); +} +exports.expand_message_xof = expand_message_xof; +/** + * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F + * https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-11#section-5.3 + * @param msg a byte string containing the message to hash + * @param count the number of elements of F to output + * @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above + * @returns [u_0, ..., u_(count - 1)], a list of field elements. + */ +function hash_to_field(msg, count, options) { + (0, utils_js_1.validateObject)(options, { + DST: 'string', + p: 'bigint', + m: 'isSafeInteger', + k: 'isSafeInteger', + hash: 'hash', + }); + const { p, k, m, hash, expand, DST: _DST } = options; + isBytes(msg); + isNum(count); + const DST = validateDST(_DST); + const log2p = p.toString(2).length; + const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above + const len_in_bytes = count * m * L; + let prb; // pseudo_random_bytes + if (expand === 'xmd') { + prb = expand_message_xmd(msg, DST, len_in_bytes, hash); + } + else if (expand === 'xof') { + prb = expand_message_xof(msg, DST, len_in_bytes, k, hash); + } + else if (expand === '_internal_pass') { + // for internal tests only + prb = msg; + } + else { + throw new Error('expand must be "xmd" or "xof"'); + } + const u = new Array(count); + for (let i = 0; i < count; i++) { + const e = new Array(m); + for (let j = 0; j < m; j++) { + const elm_offset = L * (j + i * m); + const tv = prb.subarray(elm_offset, elm_offset + L); + e[j] = (0, modular_js_1.mod)(os2ip(tv), p); + } + u[i] = e; + } + return u; +} +exports.hash_to_field = hash_to_field; +function isogenyMap(field, map) { + // Make same order as in spec + const COEFF = map.map((i) => Array.from(i).reverse()); + return (x, y) => { + const [xNum, xDen, yNum, yDen] = COEFF.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i))); + x = field.div(xNum, xDen); // xNum / xDen + y = field.mul(y, field.div(yNum, yDen)); // y * (yNum / yDev) + return { x, y }; + }; +} +exports.isogenyMap = isogenyMap; +function createHasher(Point, mapToCurve, def) { + if (typeof mapToCurve !== 'function') + throw new Error('mapToCurve() must be defined'); + return { + // Encodes byte string to elliptic curve + // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-16#section-3 + hashToCurve(msg, options) { + const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options }); + const u0 = Point.fromAffine(mapToCurve(u[0])); + const u1 = Point.fromAffine(mapToCurve(u[1])); + const P = u0.add(u1).clearCofactor(); + P.assertValidity(); + return P; + }, + // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-16#section-3 + encodeToCurve(msg, options) { + const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options }); + const P = Point.fromAffine(mapToCurve(u[0])).clearCofactor(); + P.assertValidity(); + return P; + }, + }; +} +exports.createHasher = createHasher; +//# sourceMappingURL=hash-to-curve.js.map + +/***/ }), + +/***/ "./node_modules/@noble/curves/abstract/modular.js": +/*!********************************************************!*\ + !*** ./node_modules/@noble/curves/abstract/modular.js ***! + \********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.hashToPrivateScalar = exports.FpSqrtEven = exports.FpSqrtOdd = exports.Field = exports.nLength = exports.FpIsSquare = exports.FpDiv = exports.FpInvertBatch = exports.FpPow = exports.validateField = exports.isNegativeLE = exports.FpSqrt = exports.tonelliShanks = exports.invert = exports.pow2 = exports.pow = exports.mod = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Utilities for modular arithmetics and finite fields +const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/curves/abstract/utils.js"); +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3); +// prettier-ignore +const _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8); +// prettier-ignore +const _9n = BigInt(9), _16n = BigInt(16); +// Calculates a modulo b +function mod(a, b) { + const result = a % b; + return result >= _0n ? result : b + result; +} +exports.mod = mod; +/** + * Efficiently exponentiate num to power and do modular division. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + * @example + * powMod(2n, 6n, 11n) // 64n % 11n == 9n + */ +// TODO: use field version && remove +function pow(num, power, modulo) { + if (modulo <= _0n || power < _0n) + throw new Error('Expected power/modulo > 0'); + if (modulo === _1n) + return _0n; + let res = _1n; + while (power > _0n) { + if (power & _1n) + res = (res * num) % modulo; + num = (num * num) % modulo; + power >>= _1n; + } + return res; +} +exports.pow = pow; +// Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4) +function pow2(x, power, modulo) { + let res = x; + while (power-- > _0n) { + res *= res; + res %= modulo; + } + return res; +} +exports.pow2 = pow2; +// Inverses number over modulo +function invert(number, modulo) { + if (number === _0n || modulo <= _0n) { + throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`); + } + // Eucledian GCD https://brilliant.org/wiki/extended-euclidean-algorithm/ + // Fermat's little theorem "CT-like" version inv(n) = n^(m-2) mod m is 30x slower. + let a = mod(number, modulo); + let b = modulo; + // prettier-ignore + let x = _0n, y = _1n, u = _1n, v = _0n; + while (a !== _0n) { + // JIT applies optimization if those two lines follow each other + const q = b / a; + const r = b % a; + const m = x - u * q; + const n = y - v * q; + // prettier-ignore + b = a, a = r, x = u, y = v, u = m, v = n; + } + const gcd = b; + if (gcd !== _1n) + throw new Error('invert: does not exist'); + return mod(x, modulo); +} +exports.invert = invert; +// Tonelli-Shanks algorithm +// Paper 1: https://eprint.iacr.org/2012/685.pdf (page 12) +// Paper 2: Square Roots from 1; 24, 51, 10 to Dan Shanks +function tonelliShanks(P) { + // Legendre constant: used to calculate Legendre symbol (a | p), + // which denotes the value of a^((p-1)/2) (mod p). + // (a | p) ≡ 1 if a is a square (mod p) + // (a | p) ≡ -1 if a is not a square (mod p) + // (a | p) ≡ 0 if a ≡ 0 (mod p) + const legendreC = (P - _1n) / _2n; + let Q, S, Z; + // Step 1: By factoring out powers of 2 from p - 1, + // find q and s such that p - 1 = q*(2^s) with q odd + for (Q = P - _1n, S = 0; Q % _2n === _0n; Q /= _2n, S++) + ; + // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq + for (Z = _2n; Z < P && pow(Z, legendreC, P) !== P - _1n; Z++) + ; + // Fast-path + if (S === 1) { + const p1div4 = (P + _1n) / _4n; + return function tonelliFast(Fp, n) { + const root = Fp.pow(n, p1div4); + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Slow-path + const Q1div2 = (Q + _1n) / _2n; + return function tonelliSlow(Fp, n) { + // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1 + if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE)) + throw new Error('Cannot find square root'); + let r = S; + // TODO: will fail at Fp2/etc + let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b + let x = Fp.pow(n, Q1div2); // first guess at the square root + let b = Fp.pow(n, Q); // first guess at the fudge factor + while (!Fp.eql(b, Fp.ONE)) { + if (Fp.eql(b, Fp.ZERO)) + return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0) + // Find m such b^(2^m)==1 + let m = 1; + for (let t2 = Fp.sqr(b); m < r; m++) { + if (Fp.eql(t2, Fp.ONE)) + break; + t2 = Fp.sqr(t2); // t2 *= t2 + } + // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow + const ge = Fp.pow(g, _1n << BigInt(r - m - 1)); // ge = 2^(r-m-1) + g = Fp.sqr(ge); // g = ge * ge + x = Fp.mul(x, ge); // x *= ge + b = Fp.mul(b, g); // b *= g + r = m; + } + return x; + }; +} +exports.tonelliShanks = tonelliShanks; +function FpSqrt(P) { + // NOTE: different algorithms can give different roots, it is up to user to decide which one they want. + // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve). + // P ≡ 3 (mod 4) + // √n = n^((P+1)/4) + if (P % _4n === _3n) { + // Not all roots possible! + // const ORDER = + // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn; + // const NUM = 72057594037927816n; + const p1div4 = (P + _1n) / _4n; + return function sqrt3mod4(Fp, n) { + const root = Fp.pow(n, p1div4); + // Throw if root**2 != n + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10) + if (P % _8n === _5n) { + const c1 = (P - _5n) / _8n; + return function sqrt5mod8(Fp, n) { + const n2 = Fp.mul(n, _2n); + const v = Fp.pow(n2, c1); + const nv = Fp.mul(n, v); + const i = Fp.mul(Fp.mul(nv, _2n), v); + const root = Fp.mul(nv, Fp.sub(i, Fp.ONE)); + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // P ≡ 9 (mod 16) + if (P % _16n === _9n) { + // NOTE: tonelli is too slow for bls-Fp2 calculations even on start + // Means we cannot use sqrt for constants at all! + // + // const c1 = Fp.sqrt(Fp.negate(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F + // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F + // const c3 = Fp.sqrt(Fp.negate(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F + // const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic + // sqrt = (x) => { + // let tv1 = Fp.pow(x, c4); // 1. tv1 = x^c4 + // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1 + // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1 + // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1 + // const e1 = Fp.equals(Fp.square(tv2), x); // 5. e1 = (tv2^2) == x + // const e2 = Fp.equals(Fp.square(tv3), x); // 6. e2 = (tv3^2) == x + // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x + // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x + // const e3 = Fp.equals(Fp.square(tv2), x); // 9. e3 = (tv2^2) == x + // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2 + // } + } + // Other cases: Tonelli-Shanks algorithm + return tonelliShanks(P); +} +exports.FpSqrt = FpSqrt; +// Little-endian check for first LE bit (last BE bit); +const isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n; +exports.isNegativeLE = isNegativeLE; +// prettier-ignore +const FIELD_FIELDS = [ + 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr', + 'eql', 'add', 'sub', 'mul', 'pow', 'div', + 'addN', 'subN', 'mulN', 'sqrN' +]; +function validateField(field) { + const initial = { + ORDER: 'bigint', + MASK: 'bigint', + BYTES: 'isSafeInteger', + BITS: 'isSafeInteger', + }; + const opts = FIELD_FIELDS.reduce((map, val) => { + map[val] = 'function'; + return map; + }, initial); + return (0, utils_js_1.validateObject)(field, opts); +} +exports.validateField = validateField; +// Generic field functions +function FpPow(f, num, power) { + // Should have same speed as pow for bigints + // TODO: benchmark! + if (power < _0n) + throw new Error('Expected power > 0'); + if (power === _0n) + return f.ONE; + if (power === _1n) + return num; + let p = f.ONE; + let d = num; + while (power > _0n) { + if (power & _1n) + p = f.mul(p, d); + d = f.sqr(d); + power >>= _1n; + } + return p; +} +exports.FpPow = FpPow; +// 0 is non-invertible: non-batched version will throw on 0 +function FpInvertBatch(f, nums) { + const tmp = new Array(nums.length); + // Walk from first to last, multiply them by each other MOD p + const lastMultiplied = nums.reduce((acc, num, i) => { + if (f.is0(num)) + return acc; + tmp[i] = acc; + return f.mul(acc, num); + }, f.ONE); + // Invert last element + const inverted = f.inv(lastMultiplied); + // Walk from last to first, multiply them by inverted each other MOD p + nums.reduceRight((acc, num, i) => { + if (f.is0(num)) + return acc; + tmp[i] = f.mul(acc, tmp[i]); + return f.mul(acc, num); + }, inverted); + return tmp; +} +exports.FpInvertBatch = FpInvertBatch; +function FpDiv(f, lhs, rhs) { + return f.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, f.ORDER) : f.inv(rhs)); +} +exports.FpDiv = FpDiv; +// This function returns True whenever the value x is a square in the field F. +function FpIsSquare(f) { + const legendreConst = (f.ORDER - _1n) / _2n; // Integer arithmetic + return (x) => { + const p = f.pow(x, legendreConst); + return f.eql(p, f.ZERO) || f.eql(p, f.ONE); + }; +} +exports.FpIsSquare = FpIsSquare; +// CURVE.n lengths +function nLength(n, nBitLength) { + // Bit size, byte size of CURVE.n + const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length; + const nByteLength = Math.ceil(_nBitLength / 8); + return { nBitLength: _nBitLength, nByteLength }; +} +exports.nLength = nLength; +/** + * Initializes a galois field over prime. Non-primes are not supported for now. + * Do not init in loop: slow. Very fragile: always run a benchmark on change. + * Major performance gains: + * a) non-normalized operations like mulN instead of mul + * b) `Object.freeze` + * c) Same object shape: never add or remove keys + * @param ORDER prime positive bigint + * @param bitLen how many bits the field consumes + * @param isLE (def: false) if encoding / decoding should be in little-endian + * @param redef optional faster redefinitions of sqrt and other methods + */ +function Field(ORDER, bitLen, isLE = false, redef = {}) { + if (ORDER <= _0n) + throw new Error(`Expected Fp ORDER > 0, got ${ORDER}`); + const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen); + if (BYTES > 2048) + throw new Error('Field lengths over 2048 bytes are not supported'); + const sqrtP = FpSqrt(ORDER); + const f = Object.freeze({ + ORDER, + BITS, + BYTES, + MASK: (0, utils_js_1.bitMask)(BITS), + ZERO: _0n, + ONE: _1n, + create: (num) => mod(num, ORDER), + isValid: (num) => { + if (typeof num !== 'bigint') + throw new Error(`Invalid field element: expected bigint, got ${typeof num}`); + return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible + }, + is0: (num) => num === _0n, + isOdd: (num) => (num & _1n) === _1n, + neg: (num) => mod(-num, ORDER), + eql: (lhs, rhs) => lhs === rhs, + sqr: (num) => mod(num * num, ORDER), + add: (lhs, rhs) => mod(lhs + rhs, ORDER), + sub: (lhs, rhs) => mod(lhs - rhs, ORDER), + mul: (lhs, rhs) => mod(lhs * rhs, ORDER), + pow: (num, power) => FpPow(f, num, power), + div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), + // Same as above, but doesn't normalize + sqrN: (num) => num * num, + addN: (lhs, rhs) => lhs + rhs, + subN: (lhs, rhs) => lhs - rhs, + mulN: (lhs, rhs) => lhs * rhs, + inv: (num) => invert(num, ORDER), + sqrt: redef.sqrt || ((n) => sqrtP(f, n)), + invertBatch: (lst) => FpInvertBatch(f, lst), + // TODO: do we really need constant cmov? + // We don't have const-time bigints anyway, so probably will be not very useful + cmov: (a, b, c) => (c ? b : a), + toBytes: (num) => (isLE ? (0, utils_js_1.numberToBytesLE)(num, BYTES) : (0, utils_js_1.numberToBytesBE)(num, BYTES)), + fromBytes: (bytes) => { + if (bytes.length !== BYTES) + throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`); + return isLE ? (0, utils_js_1.bytesToNumberLE)(bytes) : (0, utils_js_1.bytesToNumberBE)(bytes); + }, + }); + return Object.freeze(f); +} +exports.Field = Field; +function FpSqrtOdd(Fp, elm) { + if (!Fp.isOdd) + throw new Error(`Field doesn't have isOdd`); + const root = Fp.sqrt(elm); + return Fp.isOdd(root) ? root : Fp.neg(root); +} +exports.FpSqrtOdd = FpSqrtOdd; +function FpSqrtEven(Fp, elm) { + if (!Fp.isOdd) + throw new Error(`Field doesn't have isOdd`); + const root = Fp.sqrt(elm); + return Fp.isOdd(root) ? Fp.neg(root) : root; +} +exports.FpSqrtEven = FpSqrtEven; +/** + * FIPS 186 B.4.1-compliant "constant-time" private key generation utility. + * Can take (n+8) or more bytes of uniform input e.g. from CSPRNG or KDF + * and convert them into private scalar, with the modulo bias being neglible. + * Needs at least 40 bytes of input for 32-byte private key. + * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/ + * @param hash hash output from SHA3 or a similar function + * @returns valid private scalar + */ +function hashToPrivateScalar(hash, groupOrder, isLE = false) { + hash = (0, utils_js_1.ensureBytes)('privateHash', hash); + const hashLen = hash.length; + const minLen = nLength(groupOrder).nByteLength + 8; + if (minLen < 24 || hashLen < minLen || hashLen > 1024) + throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`); + const num = isLE ? (0, utils_js_1.bytesToNumberLE)(hash) : (0, utils_js_1.bytesToNumberBE)(hash); + return mod(num, groupOrder - _1n) + _1n; +} +exports.hashToPrivateScalar = hashToPrivateScalar; +//# sourceMappingURL=modular.js.map + +/***/ }), + +/***/ "./node_modules/@noble/curves/abstract/utils.js": +/*!******************************************************!*\ + !*** ./node_modules/@noble/curves/abstract/utils.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.validateObject = exports.createHmacDrbg = exports.bitMask = exports.bitSet = exports.bitGet = exports.bitLen = exports.utf8ToBytes = exports.equalBytes = exports.concatBytes = exports.ensureBytes = exports.numberToVarBytesBE = exports.numberToBytesLE = exports.numberToBytesBE = exports.bytesToNumberLE = exports.bytesToNumberBE = exports.hexToBytes = exports.hexToNumber = exports.numberToHexUnpadded = exports.bytesToHex = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const _0n = BigInt(0); +const _1n = BigInt(1); +const _2n = BigInt(2); +const u8a = (a) => a instanceof Uint8Array; +const hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0')); +function bytesToHex(bytes) { + if (!u8a(bytes)) + throw new Error('Uint8Array expected'); + // pre-caching improves the speed 6x + let hex = ''; + for (let i = 0; i < bytes.length; i++) { + hex += hexes[bytes[i]]; + } + return hex; +} +exports.bytesToHex = bytesToHex; +function numberToHexUnpadded(num) { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; +} +exports.numberToHexUnpadded = numberToHexUnpadded; +function hexToNumber(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + // Big Endian + return BigInt(hex === '' ? '0' : `0x${hex}`); +} +exports.hexToNumber = hexToNumber; +// Caching slows it down 2-3x +function hexToBytes(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + if (hex.length % 2) + throw new Error('hex string is invalid: unpadded ' + hex.length); + const array = new Uint8Array(hex.length / 2); + for (let i = 0; i < array.length; i++) { + const j = i * 2; + const hexByte = hex.slice(j, j + 2); + const byte = Number.parseInt(hexByte, 16); + if (Number.isNaN(byte) || byte < 0) + throw new Error('invalid byte sequence'); + array[i] = byte; + } + return array; +} +exports.hexToBytes = hexToBytes; +// Big Endian +function bytesToNumberBE(bytes) { + return hexToNumber(bytesToHex(bytes)); +} +exports.bytesToNumberBE = bytesToNumberBE; +function bytesToNumberLE(bytes) { + if (!u8a(bytes)) + throw new Error('Uint8Array expected'); + return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse())); +} +exports.bytesToNumberLE = bytesToNumberLE; +const numberToBytesBE = (n, len) => hexToBytes(n.toString(16).padStart(len * 2, '0')); +exports.numberToBytesBE = numberToBytesBE; +const numberToBytesLE = (n, len) => (0, exports.numberToBytesBE)(n, len).reverse(); +exports.numberToBytesLE = numberToBytesLE; +// Returns variable number bytes (minimal bigint encoding?) +const numberToVarBytesBE = (n) => hexToBytes(numberToHexUnpadded(n)); +exports.numberToVarBytesBE = numberToVarBytesBE; +function ensureBytes(title, hex, expectedLength) { + let res; + if (typeof hex === 'string') { + try { + res = hexToBytes(hex); + } + catch (e) { + throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`); + } + } + else if (u8a(hex)) { + // Uint8Array.from() instead of hash.slice() because node.js Buffer + // is instance of Uint8Array, and its slice() creates **mutable** copy + res = Uint8Array.from(hex); + } + else { + throw new Error(`${title} must be hex string or Uint8Array`); + } + const len = res.length; + if (typeof expectedLength === 'number' && len !== expectedLength) + throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`); + return res; +} +exports.ensureBytes = ensureBytes; +// Copies several Uint8Arrays into one. +function concatBytes(...arrs) { + const r = new Uint8Array(arrs.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; // walk through each item, ensure they have proper type + arrs.forEach((a) => { + if (!u8a(a)) + throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; +} +exports.concatBytes = concatBytes; +function equalBytes(b1, b2) { + // We don't care about timing attacks here + if (b1.length !== b2.length) + return false; + for (let i = 0; i < b1.length; i++) + if (b1[i] !== b2[i]) + return false; + return true; +} +exports.equalBytes = equalBytes; +function utf8ToBytes(str) { + if (typeof str !== 'string') { + throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + } + return new TextEncoder().encode(str); +} +exports.utf8ToBytes = utf8ToBytes; +// Bit operations +// Amount of bits inside bigint (Same as n.toString(2).length) +function bitLen(n) { + let len; + for (len = 0; n > _0n; n >>= _1n, len += 1) + ; + return len; +} +exports.bitLen = bitLen; +// Gets single bit at position. NOTE: first bit position is 0 (same as arrays) +// Same as !!+Array.from(n.toString(2)).reverse()[pos] +const bitGet = (n, pos) => (n >> BigInt(pos)) & _1n; +exports.bitGet = bitGet; +// Sets single bit at position +const bitSet = (n, pos, value) => n | ((value ? _1n : _0n) << BigInt(pos)); +exports.bitSet = bitSet; +// Return mask for N bits (Same as BigInt(`0b${Array(i).fill('1').join('')}`)) +// Not using ** operator with bigints for old engines. +const bitMask = (n) => (_2n << BigInt(n - 1)) - _1n; +exports.bitMask = bitMask; +// DRBG +const u8n = (data) => new Uint8Array(data); // creates Uint8Array +const u8fr = (arr) => Uint8Array.from(arr); // another shortcut +/** + * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + * @returns function that will call DRBG until 2nd arg returns something meaningful + * @example + * const drbg = createHmacDRBG(32, 32, hmac); + * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined + */ +function createHmacDrbg(hashLen, qByteLen, hmacFn) { + if (typeof hashLen !== 'number' || hashLen < 2) + throw new Error('hashLen must be a number'); + if (typeof qByteLen !== 'number' || qByteLen < 2) + throw new Error('qByteLen must be a number'); + if (typeof hmacFn !== 'function') + throw new Error('hmacFn must be a function'); + // Step B, Step C: set hashLen to 8*ceil(hlen/8) + let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same + let i = 0; // Iterations counter, will throw when over 1000 + const reset = () => { + v.fill(1); + k.fill(0); + i = 0; + }; + const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values) + const reseed = (seed = u8n()) => { + // HMAC-DRBG reseed() function. Steps D-G + k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed) + v = h(); // v = hmac(k || v) + if (seed.length === 0) + return; + k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed) + v = h(); // v = hmac(k || v) + }; + const gen = () => { + // HMAC-DRBG generate() function + if (i++ >= 1000) + throw new Error('drbg: tried 1000 values'); + let len = 0; + const out = []; + while (len < qByteLen) { + v = h(); + const sl = v.slice(); + out.push(sl); + len += v.length; + } + return concatBytes(...out); + }; + const genUntil = (seed, pred) => { + reset(); + reseed(seed); // Steps D-G + let res = undefined; // Step H: grind until k is in [1..n-1] + while (!(res = pred(gen()))) + reseed(); + reset(); + return res; + }; + return genUntil; +} +exports.createHmacDrbg = createHmacDrbg; +// Validating curves and fields +const validatorFns = { + bigint: (val) => typeof val === 'bigint', + function: (val) => typeof val === 'function', + boolean: (val) => typeof val === 'boolean', + string: (val) => typeof val === 'string', + isSafeInteger: (val) => Number.isSafeInteger(val), + array: (val) => Array.isArray(val), + field: (val, object) => object.Fp.isValid(val), + hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen), +}; +// type Record = { [P in K]: T; } +function validateObject(object, validators, optValidators = {}) { + const checkField = (fieldName, type, isOptional) => { + const checkVal = validatorFns[type]; + if (typeof checkVal !== 'function') + throw new Error(`Invalid validator "${type}", expected function`); + const val = object[fieldName]; + if (isOptional && val === undefined) + return; + if (!checkVal(val, object)) { + throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`); + } + }; + for (const [fieldName, type] of Object.entries(validators)) + checkField(fieldName, type, false); + for (const [fieldName, type] of Object.entries(optValidators)) + checkField(fieldName, type, true); + return object; +} +exports.validateObject = validateObject; +// validate type tests +// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 }; +// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok! +// // Should fail type-check +// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' }); +// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' }); +// const z3 = validateObject(o, { test: 'boolean', z: 'bug' }); +// const z4 = validateObject(o, { a: 'boolean', z: 'bug' }); +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ "./node_modules/@noble/curves/abstract/weierstrass.js": +/*!************************************************************!*\ + !*** ./node_modules/@noble/curves/abstract/weierstrass.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.mapToCurveSimpleSWU = exports.SWUFpSqrtRatio = exports.weierstrass = exports.weierstrassPoints = exports.DER = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// Short Weierstrass curve. The formula is: y² = x³ + ax + b +const mod = __webpack_require__(/*! ./modular.js */ "./node_modules/@noble/curves/abstract/modular.js"); +const ut = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/curves/abstract/utils.js"); +const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/curves/abstract/utils.js"); +const curve_js_1 = __webpack_require__(/*! ./curve.js */ "./node_modules/@noble/curves/abstract/curve.js"); +function validatePointOpts(curve) { + const opts = (0, curve_js_1.validateBasic)(curve); + ut.validateObject(opts, { + a: 'field', + b: 'field', + }, { + allowedPrivateKeyLengths: 'array', + wrapPrivateKey: 'boolean', + isTorsionFree: 'function', + clearCofactor: 'function', + allowInfinityPoint: 'boolean', + fromBytes: 'function', + toBytes: 'function', + }); + const { endo, Fp, a } = opts; + if (endo) { + if (!Fp.eql(a, Fp.ZERO)) { + throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0'); + } + if (typeof endo !== 'object' || + typeof endo.beta !== 'bigint' || + typeof endo.splitScalar !== 'function') { + throw new Error('Expected endomorphism with beta: bigint and splitScalar: function'); + } + } + return Object.freeze({ ...opts }); +} +// ASN.1 DER encoding utilities +const { bytesToNumberBE: b2n, hexToBytes: h2b } = ut; +exports.DER = { + // asn.1 DER encoding utils + Err: class DERErr extends Error { + constructor(m = '') { + super(m); + } + }, + _parseInt(data) { + const { Err: E } = exports.DER; + if (data.length < 2 || data[0] !== 0x02) + throw new E('Invalid signature integer tag'); + const len = data[1]; + const res = data.subarray(2, len + 2); + if (!len || res.length !== len) + throw new E('Invalid signature integer: wrong length'); + // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, + // since we always use positive integers here. It must always be empty: + // - add zero byte if exists + // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) + if (res[0] & 0b10000000) + throw new E('Invalid signature integer: negative'); + if (res[0] === 0x00 && !(res[1] & 0b10000000)) + throw new E('Invalid signature integer: unnecessary leading zero'); + return { d: b2n(res), l: data.subarray(len + 2) }; // d is data, l is left + }, + toSig(hex) { + // parse DER signature + const { Err: E } = exports.DER; + const data = typeof hex === 'string' ? h2b(hex) : hex; + if (!(data instanceof Uint8Array)) + throw new Error('ui8a expected'); + let l = data.length; + if (l < 2 || data[0] != 0x30) + throw new E('Invalid signature tag'); + if (data[1] !== l - 2) + throw new E('Invalid signature: incorrect length'); + const { d: r, l: sBytes } = exports.DER._parseInt(data.subarray(2)); + const { d: s, l: rBytesLeft } = exports.DER._parseInt(sBytes); + if (rBytesLeft.length) + throw new E('Invalid signature: left bytes after parsing'); + return { r, s }; + }, + hexFromSig(sig) { + // Add leading zero if first byte has negative bit enabled. More details in '_parseInt' + const slice = (s) => (Number.parseInt(s[0], 16) & 0b1000 ? '00' + s : s); + const h = (num) => { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; + }; + const s = slice(h(sig.s)); + const r = slice(h(sig.r)); + const shl = s.length / 2; + const rhl = r.length / 2; + const sl = h(shl); + const rl = h(rhl); + return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`; + }, +}; +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4); +function weierstrassPoints(opts) { + const CURVE = validatePointOpts(opts); + const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ + const toBytes = CURVE.toBytes || + ((c, point, isCompressed) => { + const a = point.toAffine(); + return ut.concatBytes(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y)); + }); + const fromBytes = CURVE.fromBytes || + ((bytes) => { + // const head = bytes[0]; + const tail = bytes.subarray(1); + // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported'); + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + }); + /** + * y² = x³ + ax + b: Short weierstrass curve formula + * @returns y² + */ + function weierstrassEquation(x) { + const { a, b } = CURVE; + const x2 = Fp.sqr(x); // x * x + const x3 = Fp.mul(x2, x); // x2 * x + return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b + } + // Validate whether the passed curve params are valid. + // We check if curve equation works for generator point. + // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381. + // ProjectivePoint class has not been initialized yet. + if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx))) + throw new Error('bad generator point: equation left != right'); + // Valid group elements reside in range 1..n-1 + function isWithinCurveOrder(num) { + return typeof num === 'bigint' && _0n < num && num < CURVE.n; + } + function assertGE(num) { + if (!isWithinCurveOrder(num)) + throw new Error('Expected valid bigint: 0 < bigint < curve.n'); + } + // Validates if priv key is valid and converts it to bigint. + // Supports options allowedPrivateKeyLengths and wrapPrivateKey. + function normPrivateKeyToScalar(key) { + const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE; + if (lengths && typeof key !== 'bigint') { + if (key instanceof Uint8Array) + key = ut.bytesToHex(key); + // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes + if (typeof key !== 'string' || !lengths.includes(key.length)) + throw new Error('Invalid key'); + key = key.padStart(nByteLength * 2, '0'); + } + let num; + try { + num = + typeof key === 'bigint' + ? key + : ut.bytesToNumberBE((0, utils_js_1.ensureBytes)('private key', key, nByteLength)); + } + catch (error) { + throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`); + } + if (wrapPrivateKey) + num = mod.mod(num, n); // disabled by default, enabled for BLS + assertGE(num); // num in range [1..N-1] + return num; + } + const pointPrecomputes = new Map(); + function assertPrjPoint(other) { + if (!(other instanceof Point)) + throw new Error('ProjectivePoint expected'); + } + /** + * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z) + * Default Point works in 2d / affine coordinates: (x, y) + * We're doing calculations in projective, because its operations don't require costly inversion. + */ + class Point { + constructor(px, py, pz) { + this.px = px; + this.py = py; + this.pz = pz; + if (px == null || !Fp.isValid(px)) + throw new Error('x required'); + if (py == null || !Fp.isValid(py)) + throw new Error('y required'); + if (pz == null || !Fp.isValid(pz)) + throw new Error('z required'); + } + // Does not validate if the point is on-curve. + // Use fromHex instead, or call assertValidity() later. + static fromAffine(p) { + const { x, y } = p || {}; + if (!p || !Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('invalid affine point'); + if (p instanceof Point) + throw new Error('projective point not allowed'); + const is0 = (i) => Fp.eql(i, Fp.ZERO); + // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0) + if (is0(x) && is0(y)) + return Point.ZERO; + return new Point(x, y, Fp.ONE); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + /** + * Takes a bunch of Projective Points but executes only one + * inversion on all of them. Inversion is very slow operation, + * so this improves performance massively. + * Optimization: converts a list of projective points to a list of identical points with Z=1. + */ + static normalizeZ(points) { + const toInv = Fp.invertBatch(points.map((p) => p.pz)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + /** + * Converts hash string or Uint8Array to Point. + * @param hex short/long ECDSA hex + */ + static fromHex(hex) { + const P = Point.fromAffine(fromBytes((0, utils_js_1.ensureBytes)('pointHex', hex))); + P.assertValidity(); + return P; + } + // Multiplies generator point by privateKey. + static fromPrivateKey(privateKey) { + return Point.BASE.multiply(normPrivateKeyToScalar(privateKey)); + } + // "Private method", don't use it directly + _setWindowSize(windowSize) { + this._WINDOW_SIZE = windowSize; + pointPrecomputes.delete(this); + } + // A point on curve is valid if it conforms to equation. + assertValidity() { + // Zero is valid point too! + if (this.is0()) { + if (CURVE.allowInfinityPoint) + return; + throw new Error('bad point: ZERO'); + } + // Some 3rd-party test vectors require different wording between here & `fromCompressedHex` + const { x, y } = this.toAffine(); + // Check if x, y are valid field elements + if (!Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('bad point: x or y not FE'); + const left = Fp.sqr(y); // y² + const right = weierstrassEquation(x); // x³ + ax + b + if (!Fp.eql(left, right)) + throw new Error('bad point: equation left != right'); + if (!this.isTorsionFree()) + throw new Error('bad point: not in prime-order subgroup'); + } + hasEvenY() { + const { y } = this.toAffine(); + if (Fp.isOdd) + return !Fp.isOdd(y); + throw new Error("Field doesn't support isOdd"); + } + /** + * Compare one point to another. + */ + equals(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1)); + const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1)); + return U1 && U2; + } + /** + * Flips point to one corresponding to (x, -y) in Affine coordinates. + */ + negate() { + return new Point(this.px, Fp.neg(this.py), this.pz); + } + // Renes-Costello-Batina exception-free doubling formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 3 + // Cost: 8M + 3S + 3*a + 2*b3 + 15add. + double() { + const { a, b } = CURVE; + const b3 = Fp.mul(b, _3n); + const { px: X1, py: Y1, pz: Z1 } = this; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + let t0 = Fp.mul(X1, X1); // step 1 + let t1 = Fp.mul(Y1, Y1); + let t2 = Fp.mul(Z1, Z1); + let t3 = Fp.mul(X1, Y1); + t3 = Fp.add(t3, t3); // step 5 + Z3 = Fp.mul(X1, Z1); + Z3 = Fp.add(Z3, Z3); + X3 = Fp.mul(a, Z3); + Y3 = Fp.mul(b3, t2); + Y3 = Fp.add(X3, Y3); // step 10 + X3 = Fp.sub(t1, Y3); + Y3 = Fp.add(t1, Y3); + Y3 = Fp.mul(X3, Y3); + X3 = Fp.mul(t3, X3); + Z3 = Fp.mul(b3, Z3); // step 15 + t2 = Fp.mul(a, t2); + t3 = Fp.sub(t0, t2); + t3 = Fp.mul(a, t3); + t3 = Fp.add(t3, Z3); + Z3 = Fp.add(t0, t0); // step 20 + t0 = Fp.add(Z3, t0); + t0 = Fp.add(t0, t2); + t0 = Fp.mul(t0, t3); + Y3 = Fp.add(Y3, t0); + t2 = Fp.mul(Y1, Z1); // step 25 + t2 = Fp.add(t2, t2); + t0 = Fp.mul(t2, t3); + X3 = Fp.sub(X3, t0); + Z3 = Fp.mul(t2, t1); + Z3 = Fp.add(Z3, Z3); // step 30 + Z3 = Fp.add(Z3, Z3); + return new Point(X3, Y3, Z3); + } + // Renes-Costello-Batina exception-free addition formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 1 + // Cost: 12M + 0S + 3*a + 3*b3 + 23add. + add(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + const a = CURVE.a; + const b3 = Fp.mul(CURVE.b, _3n); + let t0 = Fp.mul(X1, X2); // step 1 + let t1 = Fp.mul(Y1, Y2); + let t2 = Fp.mul(Z1, Z2); + let t3 = Fp.add(X1, Y1); + let t4 = Fp.add(X2, Y2); // step 5 + t3 = Fp.mul(t3, t4); + t4 = Fp.add(t0, t1); + t3 = Fp.sub(t3, t4); + t4 = Fp.add(X1, Z1); + let t5 = Fp.add(X2, Z2); // step 10 + t4 = Fp.mul(t4, t5); + t5 = Fp.add(t0, t2); + t4 = Fp.sub(t4, t5); + t5 = Fp.add(Y1, Z1); + X3 = Fp.add(Y2, Z2); // step 15 + t5 = Fp.mul(t5, X3); + X3 = Fp.add(t1, t2); + t5 = Fp.sub(t5, X3); + Z3 = Fp.mul(a, t4); + X3 = Fp.mul(b3, t2); // step 20 + Z3 = Fp.add(X3, Z3); + X3 = Fp.sub(t1, Z3); + Z3 = Fp.add(t1, Z3); + Y3 = Fp.mul(X3, Z3); + t1 = Fp.add(t0, t0); // step 25 + t1 = Fp.add(t1, t0); + t2 = Fp.mul(a, t2); + t4 = Fp.mul(b3, t4); + t1 = Fp.add(t1, t2); + t2 = Fp.sub(t0, t2); // step 30 + t2 = Fp.mul(a, t2); + t4 = Fp.add(t4, t2); + t0 = Fp.mul(t1, t4); + Y3 = Fp.add(Y3, t0); + t0 = Fp.mul(t5, t4); // step 35 + X3 = Fp.mul(t3, X3); + X3 = Fp.sub(X3, t0); + t0 = Fp.mul(t3, t1); + Z3 = Fp.mul(t5, Z3); + Z3 = Fp.add(Z3, t0); // step 40 + return new Point(X3, Y3, Z3); + } + subtract(other) { + return this.add(other.negate()); + } + is0() { + return this.equals(Point.ZERO); + } + wNAF(n) { + return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => { + const toInv = Fp.invertBatch(comp.map((p) => p.pz)); + return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + }); + } + /** + * Non-constant-time multiplication. Uses double-and-add algorithm. + * It's faster, but should only be used when you don't care about + * an exposed private key e.g. sig verification, which works over *public* keys. + */ + multiplyUnsafe(n) { + const I = Point.ZERO; + if (n === _0n) + return I; + assertGE(n); // Will throw on 0 + if (n === _1n) + return this; + const { endo } = CURVE; + if (!endo) + return wnaf.unsafeLadder(this, n); + // Apply endomorphism + let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let k1p = I; + let k2p = I; + let d = this; + while (k1 > _0n || k2 > _0n) { + if (k1 & _1n) + k1p = k1p.add(d); + if (k2 & _1n) + k2p = k2p.add(d); + d = d.double(); + k1 >>= _1n; + k2 >>= _1n; + } + if (k1neg) + k1p = k1p.negate(); + if (k2neg) + k2p = k2p.negate(); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + return k1p.add(k2p); + } + /** + * Constant time multiplication. + * Uses wNAF method. Windowed method may be 10% faster, + * but takes 2x longer to generate and consumes 2x memory. + * Uses precomputes when available. + * Uses endomorphism for Koblitz curves. + * @param scalar by which the point would be multiplied + * @returns New point + */ + multiply(scalar) { + assertGE(scalar); + let n = scalar; + let point, fake; // Fake point is used to const-time mult + const { endo } = CURVE; + if (endo) { + const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let { p: k1p, f: f1p } = this.wNAF(k1); + let { p: k2p, f: f2p } = this.wNAF(k2); + k1p = wnaf.constTimeNegate(k1neg, k1p); + k2p = wnaf.constTimeNegate(k2neg, k2p); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + point = k1p.add(k2p); + fake = f1p.add(f2p); + } + else { + const { p, f } = this.wNAF(n); + point = p; + fake = f; + } + // Normalize `z` for both points, but return only real one + return Point.normalizeZ([point, fake])[0]; + } + /** + * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. + * Not using Strauss-Shamir trick: precomputation tables are faster. + * The trick could be useful if both P and Q are not G (not in our case). + * @returns non-zero affine point + */ + multiplyAndAddUnsafe(Q, a, b) { + const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes + const mul = (P, a // Select faster multiply() method + ) => (a === _0n || a === _1n || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a)); + const sum = mul(this, a).add(mul(Q, b)); + return sum.is0() ? undefined : sum; + } + // Converts Projective point to affine (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + // (x, y, z) ∋ (x=x/z, y=y/z) + toAffine(iz) { + const { px: x, py: y, pz: z } = this; + const is0 = this.is0(); + // If invZ was 0, we return zero point. However we still want to execute + // all operations, so we replace invZ with a random number, 1. + if (iz == null) + iz = is0 ? Fp.ONE : Fp.inv(z); + const ax = Fp.mul(x, iz); + const ay = Fp.mul(y, iz); + const zz = Fp.mul(z, iz); + if (is0) + return { x: Fp.ZERO, y: Fp.ZERO }; + if (!Fp.eql(zz, Fp.ONE)) + throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + } + isTorsionFree() { + const { h: cofactor, isTorsionFree } = CURVE; + if (cofactor === _1n) + return true; // No subgroups, always torsion-free + if (isTorsionFree) + return isTorsionFree(Point, this); + throw new Error('isTorsionFree() has not been declared for the elliptic curve'); + } + clearCofactor() { + const { h: cofactor, clearCofactor } = CURVE; + if (cofactor === _1n) + return this; // Fast-path + if (clearCofactor) + return clearCofactor(Point, this); + return this.multiplyUnsafe(CURVE.h); + } + toRawBytes(isCompressed = true) { + this.assertValidity(); + return toBytes(Point, this, isCompressed); + } + toHex(isCompressed = true) { + return ut.bytesToHex(this.toRawBytes(isCompressed)); + } + } + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); + Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); + const _bits = CURVE.nBitLength; + const wnaf = (0, curve_js_1.wNAF)(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits); + // Validate if generator point is on curve + return { + CURVE, + ProjectivePoint: Point, + normPrivateKeyToScalar, + weierstrassEquation, + isWithinCurveOrder, + }; +} +exports.weierstrassPoints = weierstrassPoints; +function validateOpts(curve) { + const opts = (0, curve_js_1.validateBasic)(curve); + ut.validateObject(opts, { + hash: 'hash', + hmac: 'function', + randomBytes: 'function', + }, { + bits2int: 'function', + bits2int_modN: 'function', + lowS: 'boolean', + }); + return Object.freeze({ lowS: true, ...opts }); +} +function weierstrass(curveDef) { + const CURVE = validateOpts(curveDef); + const { Fp, n: CURVE_ORDER } = CURVE; + const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32 + const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32 + function isValidFieldElement(num) { + return _0n < num && num < Fp.ORDER; // 0 is banned since it's not invertible FE + } + function modN(a) { + return mod.mod(a, CURVE_ORDER); + } + function invN(a) { + return mod.invert(a, CURVE_ORDER); + } + const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({ + ...CURVE, + toBytes(c, point, isCompressed) { + const a = point.toAffine(); + const x = Fp.toBytes(a.x); + const cat = ut.concatBytes; + if (isCompressed) { + return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x); + } + else { + return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y)); + } + }, + fromBytes(bytes) { + const len = bytes.length; + const head = bytes[0]; + const tail = bytes.subarray(1); + // this.assertValidity() is done inside of fromHex + if (len === compressedLen && (head === 0x02 || head === 0x03)) { + const x = ut.bytesToNumberBE(tail); + if (!isValidFieldElement(x)) + throw new Error('Point is not on curve'); + const y2 = weierstrassEquation(x); // y² = x³ + ax + b + let y = Fp.sqrt(y2); // y = y² ^ (p+1)/4 + const isYOdd = (y & _1n) === _1n; + // ECDSA + const isHeadOdd = (head & 1) === 1; + if (isHeadOdd !== isYOdd) + y = Fp.neg(y); + return { x, y }; + } + else if (len === uncompressedLen && head === 0x04) { + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + } + else { + throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`); + } + }, + }); + const numToNByteStr = (num) => ut.bytesToHex(ut.numberToBytesBE(num, CURVE.nByteLength)); + function isBiggerThanHalfOrder(number) { + const HALF = CURVE_ORDER >> _1n; + return number > HALF; + } + function normalizeS(s) { + return isBiggerThanHalfOrder(s) ? modN(-s) : s; + } + // slice bytes num + const slcNum = (b, from, to) => ut.bytesToNumberBE(b.slice(from, to)); + /** + * ECDSA signature with its (r, s) properties. Supports DER & compact representations. + */ + class Signature { + constructor(r, s, recovery) { + this.r = r; + this.s = s; + this.recovery = recovery; + this.assertValidity(); + } + // pair (bytes of r, bytes of s) + static fromCompact(hex) { + const l = CURVE.nByteLength; + hex = (0, utils_js_1.ensureBytes)('compactSignature', hex, l * 2); + return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l)); + } + // DER encoded ECDSA signature + // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script + static fromDER(hex) { + const { r, s } = exports.DER.toSig((0, utils_js_1.ensureBytes)('DER', hex)); + return new Signature(r, s); + } + assertValidity() { + // can use assertGE here + if (!isWithinCurveOrder(this.r)) + throw new Error('r must be 0 < r < CURVE.n'); + if (!isWithinCurveOrder(this.s)) + throw new Error('s must be 0 < s < CURVE.n'); + } + addRecoveryBit(recovery) { + return new Signature(this.r, this.s, recovery); + } + recoverPublicKey(msgHash) { + const { r, s, recovery: rec } = this; + const h = bits2int_modN((0, utils_js_1.ensureBytes)('msgHash', msgHash)); // Truncate hash + if (rec == null || ![0, 1, 2, 3].includes(rec)) + throw new Error('recovery id invalid'); + const radj = rec === 2 || rec === 3 ? r + CURVE.n : r; + if (radj >= Fp.ORDER) + throw new Error('recovery id 2 or 3 invalid'); + const prefix = (rec & 1) === 0 ? '02' : '03'; + const R = Point.fromHex(prefix + numToNByteStr(radj)); + const ir = invN(radj); // r^-1 + const u1 = modN(-h * ir); // -hr^-1 + const u2 = modN(s * ir); // sr^-1 + const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1) + if (!Q) + throw new Error('point at infinify'); // unsafe is fine: no priv data leaked + Q.assertValidity(); + return Q; + } + // Signatures should be low-s, to prevent malleability. + hasHighS() { + return isBiggerThanHalfOrder(this.s); + } + normalizeS() { + return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this; + } + // DER-encoded + toDERRawBytes() { + return ut.hexToBytes(this.toDERHex()); + } + toDERHex() { + return exports.DER.hexFromSig({ r: this.r, s: this.s }); + } + // padded bytes of r, then padded bytes of s + toCompactRawBytes() { + return ut.hexToBytes(this.toCompactHex()); + } + toCompactHex() { + return numToNByteStr(this.r) + numToNByteStr(this.s); + } + } + const utils = { + isValidPrivateKey(privateKey) { + try { + normPrivateKeyToScalar(privateKey); + return true; + } + catch (error) { + return false; + } + }, + normPrivateKeyToScalar: normPrivateKeyToScalar, + /** + * Produces cryptographically secure private key from random of size (nBitLength+64) + * as per FIPS 186 B.4.1 with modulo bias being neglible. + */ + randomPrivateKey: () => { + const rand = CURVE.randomBytes(Fp.BYTES + 8); + const num = mod.hashToPrivateScalar(rand, CURVE_ORDER); + return ut.numberToBytesBE(num, CURVE.nByteLength); + }, + /** + * Creates precompute table for an arbitrary EC point. Makes point "cached". + * Allows to massively speed-up `point.multiply(scalar)`. + * @returns cached point + * @example + * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey)); + * fast.multiply(privKey); // much faster ECDH now + */ + precompute(windowSize = 8, point = Point.BASE) { + point._setWindowSize(windowSize); + point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here + return point; + }, + }; + /** + * Computes public key for a private key. Checks for validity of the private key. + * @param privateKey private key + * @param isCompressed whether to return compact (default), or full key + * @returns Public key, full when isCompressed=false; short when isCompressed=true + */ + function getPublicKey(privateKey, isCompressed = true) { + return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed); + } + /** + * Quick and dirty check for item being public key. Does not validate hex, or being on-curve. + */ + function isProbPub(item) { + const arr = item instanceof Uint8Array; + const str = typeof item === 'string'; + const len = (arr || str) && item.length; + if (arr) + return len === compressedLen || len === uncompressedLen; + if (str) + return len === 2 * compressedLen || len === 2 * uncompressedLen; + if (item instanceof Point) + return true; + return false; + } + /** + * ECDH (Elliptic Curve Diffie Hellman). + * Computes shared public key from private key and public key. + * Checks: 1) private key validity 2) shared key is on-curve. + * Does NOT hash the result. + * @param privateA private key + * @param publicB different public key + * @param isCompressed whether to return compact (default), or full key + * @returns shared public key + */ + function getSharedSecret(privateA, publicB, isCompressed = true) { + if (isProbPub(privateA)) + throw new Error('first arg must be private key'); + if (!isProbPub(publicB)) + throw new Error('second arg must be public key'); + const b = Point.fromHex(publicB); // check for being on-curve + return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed); + } + // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets. + // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int. + // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same. + // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors + const bits2int = CURVE.bits2int || + function (bytes) { + // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m) + // for some cases, since bytes.length * 8 is not actual bitLength. + const num = ut.bytesToNumberBE(bytes); // check for == u8 done here + const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits + return delta > 0 ? num >> BigInt(delta) : num; + }; + const bits2int_modN = CURVE.bits2int_modN || + function (bytes) { + return modN(bits2int(bytes)); // can't use bytesToNumberBE here + }; + // NOTE: pads output with zero as per spec + const ORDER_MASK = ut.bitMask(CURVE.nBitLength); + /** + * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. + */ + function int2octets(num) { + if (typeof num !== 'bigint') + throw new Error('bigint expected'); + if (!(_0n <= num && num < ORDER_MASK)) + throw new Error(`bigint expected < 2^${CURVE.nBitLength}`); + // works with order, can have different size than numToField! + return ut.numberToBytesBE(num, CURVE.nByteLength); + } + // Steps A, D of RFC6979 3.2 + // Creates RFC6979 seed; converts msg/privKey to numbers. + // Used only in sign, not in verify. + // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, this will be wrong at least for P521. + // Also it can be bigger for P224 + SHA256 + function prepSig(msgHash, privateKey, opts = defaultSigOpts) { + if (['recovered', 'canonical'].some((k) => k in opts)) + throw new Error('sign() legacy options not supported'); + const { hash, randomBytes } = CURVE; + let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default + if (lowS == null) + lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash + msgHash = (0, utils_js_1.ensureBytes)('msgHash', msgHash); + if (prehash) + msgHash = (0, utils_js_1.ensureBytes)('prehashed msgHash', hash(msgHash)); + // We can't later call bits2octets, since nested bits2int is broken for curves + // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call. + // const bits2octets = (bits) => int2octets(bits2int_modN(bits)) + const h1int = bits2int_modN(msgHash); + const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint + const seedArgs = [int2octets(d), int2octets(h1int)]; + // extraEntropy. RFC6979 3.6: additional k' (optional). + if (ent != null) { + // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k') + const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is + seedArgs.push((0, utils_js_1.ensureBytes)('extraEntropy', e, Fp.BYTES)); // check for being of size BYTES + } + const seed = ut.concatBytes(...seedArgs); // Step D of RFC6979 3.2 + const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash! + // Converts signature params into point w r/s, checks result for validity. + function k2sig(kBytes) { + // RFC 6979 Section 3.2, step 3: k = bits2int(T) + const k = bits2int(kBytes); // Cannot use fields methods, since it is group element + if (!isWithinCurveOrder(k)) + return; // Important: all mod() calls here must be done over N + const ik = invN(k); // k^-1 mod n + const q = Point.BASE.multiply(k).toAffine(); // q = Gk + const r = modN(q.x); // r = q.x mod n + if (r === _0n) + return; + // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to + // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it: + // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT + const s = modN(ik * modN(m + r * d)); // Not using blinding here + if (s === _0n) + return; + let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n) + let normS = s; + if (lowS && isBiggerThanHalfOrder(s)) { + normS = normalizeS(s); // if lowS was passed, ensure s is always + recovery ^= 1; // // in the bottom half of N + } + return new Signature(r, normS, recovery); // use normS, not s + } + return { seed, k2sig }; + } + const defaultSigOpts = { lowS: CURVE.lowS, prehash: false }; + const defaultVerOpts = { lowS: CURVE.lowS, prehash: false }; + /** + * Signs message hash (not message: you need to hash it by yourself). + * ``` + * sign(m, d, k) where + * (x, y) = G × k + * r = x mod n + * s = (m + dr)/k mod n + * ``` + * @param opts `lowS, extraEntropy, prehash` + */ + function sign(msgHash, privKey, opts = defaultSigOpts) { + const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2. + const drbg = ut.createHmacDrbg(CURVE.hash.outputLen, CURVE.nByteLength, CURVE.hmac); + return drbg(seed, k2sig); // Steps B, C, D, E, F, G + } + // Enable precomputes. Slows down first publicKey computation by 20ms. + Point.BASE._setWindowSize(8); + // utils.precompute(8, ProjectivePoint.BASE) + /** + * Verifies a signature against message hash and public key. + * Rejects lowS signatures by default: to override, + * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf: + * + * ``` + * verify(r, s, h, P) where + * U1 = hs^-1 mod n + * U2 = rs^-1 mod n + * R = U1⋅G - U2⋅P + * mod(R.x, n) == r + * ``` + */ + function verify(signature, msgHash, publicKey, opts = defaultVerOpts) { + const sg = signature; + msgHash = (0, utils_js_1.ensureBytes)('msgHash', msgHash); + publicKey = (0, utils_js_1.ensureBytes)('publicKey', publicKey); + if ('strict' in opts) + throw new Error('options.strict was renamed to lowS'); + const { lowS, prehash } = opts; + let _sig = undefined; + let P; + try { + if (typeof sg === 'string' || sg instanceof Uint8Array) { + // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length). + // Since DER can also be 2*nByteLength bytes, we check for it first. + try { + _sig = Signature.fromDER(sg); + } + catch (derError) { + if (!(derError instanceof exports.DER.Err)) + throw derError; + _sig = Signature.fromCompact(sg); + } + } + else if (typeof sg === 'object' && typeof sg.r === 'bigint' && typeof sg.s === 'bigint') { + const { r, s } = sg; + _sig = new Signature(r, s); + } + else { + throw new Error('PARSE'); + } + P = Point.fromHex(publicKey); + } + catch (error) { + if (error.message === 'PARSE') + throw new Error(`signature must be Signature instance, Uint8Array or hex string`); + return false; + } + if (lowS && _sig.hasHighS()) + return false; + if (prehash) + msgHash = CURVE.hash(msgHash); + const { r, s } = _sig; + const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element + const is = invN(s); // s^-1 + const u1 = modN(h * is); // u1 = hs^-1 mod n + const u2 = modN(r * is); // u2 = rs^-1 mod n + const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P + if (!R) + return false; + const v = modN(R.x); + return v === r; + } + return { + CURVE, + getPublicKey, + getSharedSecret, + sign, + verify, + ProjectivePoint: Point, + Signature, + utils, + }; +} +exports.weierstrass = weierstrass; +// Implementation of the Shallue and van de Woestijne method for any Weierstrass curve +// TODO: check if there is a way to merge this with uvRatio in Edwards && move to modular? +// b = True and y = sqrt(u / v) if (u / v) is square in F, and +// b = False and y = sqrt(Z * (u / v)) otherwise. +function SWUFpSqrtRatio(Fp, Z) { + // Generic implementation + const q = Fp.ORDER; + let l = _0n; + for (let o = q - _1n; o % _2n === _0n; o /= _2n) + l += _1n; + const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1. + const c2 = (q - _1n) / _2n ** c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic + const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic + const c4 = _2n ** c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic + const c5 = _2n ** (c1 - _1n); // 5. c5 = 2^(c1 - 1) # Integer arithmetic + const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2 + const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2) + let sqrtRatio = (u, v) => { + let tv1 = c6; // 1. tv1 = c6 + let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4 + let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2 + tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v + let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3 + tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3 + tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2 + tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v + tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u + let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2 + tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5 + let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1 + tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7 + tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1 + tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR) + tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR) + // 17. for i in (c1, c1 - 1, ..., 2): + for (let i = c1; i > _1n; i--) { + let tv5 = _2n ** (i - _2n); // 18. tv5 = i - 2; 19. tv5 = 2^tv5 + let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5 + const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1 + tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1 + tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1 + tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1 + tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1) + tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1) + } + return { isValid: isQR, value: tv3 }; + }; + if (Fp.ORDER % _4n === _3n) { + // sqrt_ratio_3mod4(u, v) + const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic + const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z) + sqrtRatio = (u, v) => { + let tv1 = Fp.sqr(v); // 1. tv1 = v^2 + const tv2 = Fp.mul(u, v); // 2. tv2 = u * v + tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2 + let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1 + y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2 + const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2 + const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v + const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u + let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR) + return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2 + }; + } + // No curves uses that + // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8 + return sqrtRatio; +} +exports.SWUFpSqrtRatio = SWUFpSqrtRatio; +// From draft-irtf-cfrg-hash-to-curve-16 +function mapToCurveSimpleSWU(Fp, opts) { + mod.validateField(Fp); + if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z)) + throw new Error('mapToCurveSimpleSWU: invalid opts'); + const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z); + if (!Fp.isOdd) + throw new Error('Fp.isOdd is not implemented!'); + // Input: u, an element of F. + // Output: (x, y), a point on E. + return (u) => { + // prettier-ignore + let tv1, tv2, tv3, tv4, tv5, tv6, x, y; + tv1 = Fp.sqr(u); // 1. tv1 = u^2 + tv1 = Fp.mul(tv1, opts.Z); // 2. tv1 = Z * tv1 + tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2 + tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1 + tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1 + tv3 = Fp.mul(tv3, opts.B); // 6. tv3 = B * tv3 + tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0) + tv4 = Fp.mul(tv4, opts.A); // 8. tv4 = A * tv4 + tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2 + tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2 + tv5 = Fp.mul(tv6, opts.A); // 11. tv5 = A * tv6 + tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5 + tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3 + tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4 + tv5 = Fp.mul(tv6, opts.B); // 15. tv5 = B * tv6 + tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5 + x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3 + const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) + y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1 + y = Fp.mul(y, value); // 20. y = y * y1 + x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square) + y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square) + const e1 = Fp.isOdd(u) === Fp.isOdd(y); // 23. e1 = sgn0(u) == sgn0(y) + y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1) + x = Fp.div(x, tv4); // 25. x = x / tv4 + return { x, y }; + }; +} +exports.mapToCurveSimpleSWU = mapToCurveSimpleSWU; +//# sourceMappingURL=weierstrass.js.map + +/***/ }), + +/***/ "./node_modules/@noble/curves/secp256k1.js": +/*!*************************************************!*\ + !*** ./node_modules/@noble/curves/secp256k1.js ***! + \*************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var _a; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.encodeToCurve = exports.hashToCurve = exports.schnorr = exports.secp256k1 = void 0; +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +const sha256_1 = __webpack_require__(/*! @noble/hashes/sha256 */ "./node_modules/@noble/hashes/sha256.js"); +const utils_1 = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js"); +const modular_js_1 = __webpack_require__(/*! ./abstract/modular.js */ "./node_modules/@noble/curves/abstract/modular.js"); +const weierstrass_js_1 = __webpack_require__(/*! ./abstract/weierstrass.js */ "./node_modules/@noble/curves/abstract/weierstrass.js"); +const utils_js_1 = __webpack_require__(/*! ./abstract/utils.js */ "./node_modules/@noble/curves/abstract/utils.js"); +const htf = __webpack_require__(/*! ./abstract/hash-to-curve.js */ "./node_modules/@noble/curves/abstract/hash-to-curve.js"); +const _shortw_utils_js_1 = __webpack_require__(/*! ./_shortw_utils.js */ "./node_modules/@noble/curves/_shortw_utils.js"); +const secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'); +const secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'); +const _1n = BigInt(1); +const _2n = BigInt(2); +const divNearest = (a, b) => (a + b / _2n) / b; +/** + * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit. + * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00] + */ +function sqrtMod(y) { + const P = secp256k1P; + // prettier-ignore + const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22); + // prettier-ignore + const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88); + const b2 = (y * y * y) % P; // x^3, 11 + const b3 = (b2 * b2 * y) % P; // x^7 + const b6 = ((0, modular_js_1.pow2)(b3, _3n, P) * b3) % P; + const b9 = ((0, modular_js_1.pow2)(b6, _3n, P) * b3) % P; + const b11 = ((0, modular_js_1.pow2)(b9, _2n, P) * b2) % P; + const b22 = ((0, modular_js_1.pow2)(b11, _11n, P) * b11) % P; + const b44 = ((0, modular_js_1.pow2)(b22, _22n, P) * b22) % P; + const b88 = ((0, modular_js_1.pow2)(b44, _44n, P) * b44) % P; + const b176 = ((0, modular_js_1.pow2)(b88, _88n, P) * b88) % P; + const b220 = ((0, modular_js_1.pow2)(b176, _44n, P) * b44) % P; + const b223 = ((0, modular_js_1.pow2)(b220, _3n, P) * b3) % P; + const t1 = ((0, modular_js_1.pow2)(b223, _23n, P) * b22) % P; + const t2 = ((0, modular_js_1.pow2)(t1, _6n, P) * b2) % P; + const root = (0, modular_js_1.pow2)(t2, _2n, P); + if (!Fp.eql(Fp.sqr(root), y)) + throw new Error('Cannot find square root'); + return root; +} +const Fp = (0, modular_js_1.Field)(secp256k1P, undefined, undefined, { sqrt: sqrtMod }); +exports.secp256k1 = (0, _shortw_utils_js_1.createCurve)({ + a: BigInt(0), + b: BigInt(7), + Fp, + n: secp256k1N, + // Base point (x, y) aka generator point + Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'), + Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'), + h: BigInt(1), + lowS: true, + /** + * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism. + * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%. + * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit. + * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066 + */ + endo: { + beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'), + splitScalar: (k) => { + const n = secp256k1N; + const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15'); + const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3'); + const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8'); + const b2 = a1; + const POW_2_128 = BigInt('0x100000000000000000000000000000000'); // (2n**128n).toString(16) + const c1 = divNearest(b2 * k, n); + const c2 = divNearest(-b1 * k, n); + let k1 = (0, modular_js_1.mod)(k - c1 * a1 - c2 * a2, n); + let k2 = (0, modular_js_1.mod)(-c1 * b1 - c2 * b2, n); + const k1neg = k1 > POW_2_128; + const k2neg = k2 > POW_2_128; + if (k1neg) + k1 = n - k1; + if (k2neg) + k2 = n - k2; + if (k1 > POW_2_128 || k2 > POW_2_128) { + throw new Error('splitScalar: Endomorphism failed, k=' + k); + } + return { k1neg, k1, k2neg, k2 }; + }, + }, +}, sha256_1.sha256); +// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code. +// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki +const _0n = BigInt(0); +const fe = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1P; +const ge = (x) => typeof x === 'bigint' && _0n < x && x < secp256k1N; +/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */ +const TAGGED_HASH_PREFIXES = {}; +function taggedHash(tag, ...messages) { + let tagP = TAGGED_HASH_PREFIXES[tag]; + if (tagP === undefined) { + const tagH = (0, sha256_1.sha256)(Uint8Array.from(tag, (c) => c.charCodeAt(0))); + tagP = (0, utils_js_1.concatBytes)(tagH, tagH); + TAGGED_HASH_PREFIXES[tag] = tagP; + } + return (0, sha256_1.sha256)((0, utils_js_1.concatBytes)(tagP, ...messages)); +} +// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03 +const pointToBytes = (point) => point.toRawBytes(true).slice(1); +const numTo32b = (n) => (0, utils_js_1.numberToBytesBE)(n, 32); +const modP = (x) => (0, modular_js_1.mod)(x, secp256k1P); +const modN = (x) => (0, modular_js_1.mod)(x, secp256k1N); +const Point = exports.secp256k1.ProjectivePoint; +const GmulAdd = (Q, a, b) => Point.BASE.multiplyAndAddUnsafe(Q, a, b); +// Calculate point, scalar and bytes +function schnorrGetExtPubKey(priv) { + let d_ = exports.secp256k1.utils.normPrivateKeyToScalar(priv); // same method executed in fromPrivateKey + let p = Point.fromPrivateKey(d_); // P = d'⋅G; 0 < d' < n check is done inside + const scalar = p.hasEvenY() ? d_ : modN(-d_); + return { scalar: scalar, bytes: pointToBytes(p) }; +} +/** + * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point. + * @returns valid point checked for being on-curve + */ +function lift_x(x) { + if (!fe(x)) + throw new Error('bad x: need 0 < x < p'); // Fail if x ≥ p. + const xx = modP(x * x); + const c = modP(xx * x + BigInt(7)); // Let c = x³ + 7 mod p. + let y = sqrtMod(c); // Let y = c^(p+1)/4 mod p. + if (y % _2n !== _0n) + y = modP(-y); // Return the unique point P such that x(P) = x and + const p = new Point(x, y, _1n); // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise. + p.assertValidity(); + return p; +} +/** + * Create tagged hash, convert it to bigint, reduce modulo-n. + */ +function challenge(...args) { + return modN((0, utils_js_1.bytesToNumberBE)(taggedHash('BIP0340/challenge', ...args))); +} +/** + * Schnorr public key is just `x` coordinate of Point as per BIP340. + */ +function schnorrGetPublicKey(privateKey) { + return schnorrGetExtPubKey(privateKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G) +} +/** + * Creates Schnorr signature as per BIP340. Verifies itself before returning anything. + * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous. + */ +function schnorrSign(message, privateKey, auxRand = (0, utils_1.randomBytes)(32)) { + const m = (0, utils_js_1.ensureBytes)('message', message); + const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey); // checks for isWithinCurveOrder + const a = (0, utils_js_1.ensureBytes)('auxRand', auxRand, 32); // Auxiliary random data a: a 32-byte array + const t = numTo32b(d ^ (0, utils_js_1.bytesToNumberBE)(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a) + const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m) + const k_ = modN((0, utils_js_1.bytesToNumberBE)(rand)); // Let k' = int(rand) mod n + if (k_ === _0n) + throw new Error('sign failed: k is zero'); // Fail if k' = 0. + const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_); // Let R = k'⋅G. + const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n. + const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n). + sig.set(rx, 0); + sig.set(numTo32b(modN(k + e * d)), 32); + // If Verify(bytes(P), m, sig) (see below) returns failure, abort + if (!schnorrVerify(sig, m, px)) + throw new Error('sign: Invalid signature produced'); + return sig; +} +/** + * Verifies Schnorr signature. + * Will swallow errors & return false except for initial type validation of arguments. + */ +function schnorrVerify(signature, message, publicKey) { + const sig = (0, utils_js_1.ensureBytes)('signature', signature, 64); + const m = (0, utils_js_1.ensureBytes)('message', message); + const pub = (0, utils_js_1.ensureBytes)('publicKey', publicKey, 32); + try { + const P = lift_x((0, utils_js_1.bytesToNumberBE)(pub)); // P = lift_x(int(pk)); fail if that fails + const r = (0, utils_js_1.bytesToNumberBE)(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p. + if (!fe(r)) + return false; + const s = (0, utils_js_1.bytesToNumberBE)(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n. + if (!ge(s)) + return false; + const e = challenge(numTo32b(r), pointToBytes(P), m); // int(challenge(bytes(r)||bytes(P)||m))%n + const R = GmulAdd(P, s, modN(-e)); // R = s⋅G - e⋅P + if (!R || !R.hasEvenY() || R.toAffine().x !== r) + return false; // -eP == (n-e)P + return true; // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r. + } + catch (error) { + return false; + } +} +exports.schnorr = { + getPublicKey: schnorrGetPublicKey, + sign: schnorrSign, + verify: schnorrVerify, + utils: { + randomPrivateKey: exports.secp256k1.utils.randomPrivateKey, + lift_x, + pointToBytes, + numberToBytesBE: utils_js_1.numberToBytesBE, + bytesToNumberBE: utils_js_1.bytesToNumberBE, + taggedHash, + mod: modular_js_1.mod, + }, +}; +const isoMap = htf.isogenyMap(Fp, [ + // xNum + [ + '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7', + '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581', + '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262', + '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c', + ], + // xDen + [ + '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b', + '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14', + '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], + // yNum + [ + '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c', + '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3', + '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931', + '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84', + ], + // yDen + [ + '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b', + '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573', + '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f', + '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], +].map((i) => i.map((j) => BigInt(j)))); +const mapSWU = (0, weierstrass_js_1.mapToCurveSimpleSWU)(Fp, { + A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'), + B: BigInt('1771'), + Z: Fp.create(BigInt('-11')), +}); +_a = htf.createHasher(exports.secp256k1.ProjectivePoint, (scalars) => { + const { x, y } = mapSWU(Fp.create(scalars[0])); + return isoMap(x, y); +}, { + DST: 'secp256k1_XMD:SHA-256_SSWU_RO_', + encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_', + p: Fp.ORDER, + m: 1, + k: 128, + expand: 'xmd', + hash: sha256_1.sha256, +}), exports.hashToCurve = _a.hashToCurve, exports.encodeToCurve = _a.encodeToCurve; +//# sourceMappingURL=secp256k1.js.map + +/***/ }), + +/***/ "./node_modules/@noble/hashes/_assert.js": +/*!***********************************************!*\ + !*** ./node_modules/@noble/hashes/_assert.js ***! + \***********************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.output = exports.exists = exports.hash = exports.bytes = exports.bool = exports.number = void 0; +function number(n) { + if (!Number.isSafeInteger(n) || n < 0) + throw new Error(`Wrong positive integer: ${n}`); +} +exports.number = number; +function bool(b) { + if (typeof b !== 'boolean') + throw new Error(`Expected boolean, not ${b}`); +} +exports.bool = bool; +function bytes(b, ...lengths) { + if (!(b instanceof Uint8Array)) + throw new TypeError('Expected Uint8Array'); + if (lengths.length > 0 && !lengths.includes(b.length)) + throw new TypeError(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); +} +exports.bytes = bytes; +function hash(hash) { + if (typeof hash !== 'function' || typeof hash.create !== 'function') + throw new Error('Hash should be wrapped by utils.wrapConstructor'); + number(hash.outputLen); + number(hash.blockLen); +} +exports.hash = hash; +function exists(instance, checkFinished = true) { + if (instance.destroyed) + throw new Error('Hash instance has been destroyed'); + if (checkFinished && instance.finished) + throw new Error('Hash#digest() has already been called'); +} +exports.exists = exists; +function output(out, instance) { + bytes(out); + const min = instance.outputLen; + if (out.length < min) { + throw new Error(`digestInto() expects output buffer of length at least ${min}`); + } +} +exports.output = output; +const assert = { + number, + bool, + bytes, + hash, + exists, + output, +}; +exports["default"] = assert; +//# sourceMappingURL=_assert.js.map + +/***/ }), + +/***/ "./node_modules/@noble/hashes/_sha2.js": +/*!*********************************************!*\ + !*** ./node_modules/@noble/hashes/_sha2.js ***! + \*********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SHA2 = void 0; +const _assert_js_1 = __webpack_require__(/*! ./_assert.js */ "./node_modules/@noble/hashes/_assert.js"); +const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/hashes/utils.js"); +// Polyfill for Safari 14 +function setBigUint64(view, byteOffset, value, isLE) { + if (typeof view.setBigUint64 === 'function') + return view.setBigUint64(byteOffset, value, isLE); + const _32n = BigInt(32); + const _u32_max = BigInt(0xffffffff); + const wh = Number((value >> _32n) & _u32_max); + const wl = Number(value & _u32_max); + const h = isLE ? 4 : 0; + const l = isLE ? 0 : 4; + view.setUint32(byteOffset + h, wh, isLE); + view.setUint32(byteOffset + l, wl, isLE); +} +// Base SHA2 class (RFC 6234) +class SHA2 extends utils_js_1.Hash { + constructor(blockLen, outputLen, padOffset, isLE) { + super(); + this.blockLen = blockLen; + this.outputLen = outputLen; + this.padOffset = padOffset; + this.isLE = isLE; + this.finished = false; + this.length = 0; + this.pos = 0; + this.destroyed = false; + this.buffer = new Uint8Array(blockLen); + this.view = (0, utils_js_1.createView)(this.buffer); + } + update(data) { + _assert_js_1.default.exists(this); + const { view, buffer, blockLen } = this; + data = (0, utils_js_1.toBytes)(data); + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + // Fast path: we have at least one block in input, cast it to view and process + if (take === blockLen) { + const dataView = (0, utils_js_1.createView)(data); + for (; blockLen <= len - pos; pos += blockLen) + this.process(dataView, pos); + continue; + } + buffer.set(data.subarray(pos, pos + take), this.pos); + this.pos += take; + pos += take; + if (this.pos === blockLen) { + this.process(view, 0); + this.pos = 0; + } + } + this.length += data.length; + this.roundClean(); + return this; + } + digestInto(out) { + _assert_js_1.default.exists(this); + _assert_js_1.default.output(out, this); + this.finished = true; + // Padding + // We can avoid allocation of buffer for padding completely if it + // was previously not allocated here. But it won't change performance. + const { buffer, view, blockLen, isLE } = this; + let { pos } = this; + // append the bit '1' to the message + buffer[pos++] = 0b10000000; + this.buffer.subarray(pos).fill(0); + // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again + if (this.padOffset > blockLen - pos) { + this.process(view, 0); + pos = 0; + } + // Pad until full block byte with zeros + for (let i = pos; i < blockLen; i++) + buffer[i] = 0; + // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that + // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen. + // So we just write lowest 64 bits of that value. + setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE); + this.process(view, 0); + const oview = (0, utils_js_1.createView)(out); + const len = this.outputLen; + // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT + if (len % 4) + throw new Error('_sha2: outputLen should be aligned to 32bit'); + const outLen = len / 4; + const state = this.get(); + if (outLen > state.length) + throw new Error('_sha2: outputLen bigger than state'); + for (let i = 0; i < outLen; i++) + oview.setUint32(4 * i, state[i], isLE); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to) { + to || (to = new this.constructor()); + to.set(...this.get()); + const { blockLen, buffer, length, finished, destroyed, pos } = this; + to.length = length; + to.pos = pos; + to.finished = finished; + to.destroyed = destroyed; + if (length % blockLen) + to.buffer.set(buffer); + return to; + } +} +exports.SHA2 = SHA2; +//# sourceMappingURL=_sha2.js.map + +/***/ }), + +/***/ "./node_modules/@noble/hashes/_u64.js": +/*!********************************************!*\ + !*** ./node_modules/@noble/hashes/_u64.js ***! + \********************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.add = exports.toBig = exports.split = exports.fromBig = void 0; +const U32_MASK64 = BigInt(2 ** 32 - 1); +const _32n = BigInt(32); +// We are not using BigUint64Array, because they are extremely slow as per 2022 +function fromBig(n, le = false) { + if (le) + return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; + return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; +} +exports.fromBig = fromBig; +function split(lst, le = false) { + let Ah = new Uint32Array(lst.length); + let Al = new Uint32Array(lst.length); + for (let i = 0; i < lst.length; i++) { + const { h, l } = fromBig(lst[i], le); + [Ah[i], Al[i]] = [h, l]; + } + return [Ah, Al]; +} +exports.split = split; +const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); +exports.toBig = toBig; +// for Shift in [0, 32) +const shrSH = (h, l, s) => h >>> s; +const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); +// Right rotate for Shift in [1, 32) +const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s)); +const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); +// Right rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32)); +const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s)); +// Right rotate for shift===32 (just swaps l&h) +const rotr32H = (h, l) => l; +const rotr32L = (h, l) => h; +// Left rotate for Shift in [1, 32) +const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); +const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); +// Left rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); +const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); +// JS uses 32-bit signed integers for bitwise operations which means we cannot +// simple take carry out of low bit sum by shift, we need to use division. +// Removing "export" has 5% perf penalty -_- +function add(Ah, Al, Bh, Bl) { + const l = (Al >>> 0) + (Bl >>> 0); + return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; +} +exports.add = add; +// Addition with more than 2 elements +const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); +const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; +const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); +const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; +const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); +const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; +// prettier-ignore +const u64 = { + fromBig, split, toBig: exports.toBig, + shrSH, shrSL, + rotrSH, rotrSL, rotrBH, rotrBL, + rotr32H, rotr32L, + rotlSH, rotlSL, rotlBH, rotlBL, + add, add3L, add3H, add4L, add4H, add5H, add5L, +}; +exports["default"] = u64; +//# sourceMappingURL=_u64.js.map + +/***/ }), + +/***/ "./node_modules/@noble/hashes/crypto.js": +/*!**********************************************!*\ + !*** ./node_modules/@noble/hashes/crypto.js ***! + \**********************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.crypto = void 0; +exports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined; +//# sourceMappingURL=crypto.js.map + +/***/ }), + +/***/ "./node_modules/@noble/hashes/hmac.js": +/*!********************************************!*\ + !*** ./node_modules/@noble/hashes/hmac.js ***! + \********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.hmac = void 0; +const _assert_js_1 = __webpack_require__(/*! ./_assert.js */ "./node_modules/@noble/hashes/_assert.js"); +const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/hashes/utils.js"); +// HMAC (RFC 2104) +class HMAC extends utils_js_1.Hash { + constructor(hash, _key) { + super(); + this.finished = false; + this.destroyed = false; + _assert_js_1.default.hash(hash); + const key = (0, utils_js_1.toBytes)(_key); + this.iHash = hash.create(); + if (typeof this.iHash.update !== 'function') + throw new TypeError('Expected instance of class which extends utils.Hash'); + this.blockLen = this.iHash.blockLen; + this.outputLen = this.iHash.outputLen; + const blockLen = this.blockLen; + const pad = new Uint8Array(blockLen); + // blockLen can be bigger than outputLen + pad.set(key.length > blockLen ? hash.create().update(key).digest() : key); + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36; + this.iHash.update(pad); + // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone + this.oHash = hash.create(); + // Undo internal XOR && apply outer XOR + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36 ^ 0x5c; + this.oHash.update(pad); + pad.fill(0); + } + update(buf) { + _assert_js_1.default.exists(this); + this.iHash.update(buf); + return this; + } + digestInto(out) { + _assert_js_1.default.exists(this); + _assert_js_1.default.bytes(out, this.outputLen); + this.finished = true; + this.iHash.digestInto(out); + this.oHash.update(out); + this.oHash.digestInto(out); + this.destroy(); + } + digest() { + const out = new Uint8Array(this.oHash.outputLen); + this.digestInto(out); + return out; + } + _cloneInto(to) { + // Create new instance without calling constructor since key already in state and we don't know it. + to || (to = Object.create(Object.getPrototypeOf(this), {})); + const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; + to = to; + to.finished = finished; + to.destroyed = destroyed; + to.blockLen = blockLen; + to.outputLen = outputLen; + to.oHash = oHash._cloneInto(to.oHash); + to.iHash = iHash._cloneInto(to.iHash); + return to; + } + destroy() { + this.destroyed = true; + this.oHash.destroy(); + this.iHash.destroy(); + } +} +/** + * HMAC: RFC2104 message authentication code. + * @param hash - function that would be used e.g. sha256 + * @param key - message key + * @param message - message data + */ +const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest(); +exports.hmac = hmac; +exports.hmac.create = (hash, key) => new HMAC(hash, key); +//# sourceMappingURL=hmac.js.map + +/***/ }), + +/***/ "./node_modules/@noble/hashes/pbkdf2.js": +/*!**********************************************!*\ + !*** ./node_modules/@noble/hashes/pbkdf2.js ***! + \**********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pbkdf2Async = exports.pbkdf2 = void 0; +const _assert_js_1 = __webpack_require__(/*! ./_assert.js */ "./node_modules/@noble/hashes/_assert.js"); +const hmac_js_1 = __webpack_require__(/*! ./hmac.js */ "./node_modules/@noble/hashes/hmac.js"); +const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/hashes/utils.js"); +// Common prologue and epilogue for sync/async functions +function pbkdf2Init(hash, _password, _salt, _opts) { + _assert_js_1.default.hash(hash); + const opts = (0, utils_js_1.checkOpts)({ dkLen: 32, asyncTick: 10 }, _opts); + const { c, dkLen, asyncTick } = opts; + _assert_js_1.default.number(c); + _assert_js_1.default.number(dkLen); + _assert_js_1.default.number(asyncTick); + if (c < 1) + throw new Error('PBKDF2: iterations (c) should be >= 1'); + const password = (0, utils_js_1.toBytes)(_password); + const salt = (0, utils_js_1.toBytes)(_salt); + // DK = PBKDF2(PRF, Password, Salt, c, dkLen); + const DK = new Uint8Array(dkLen); + // U1 = PRF(Password, Salt + INT_32_BE(i)) + const PRF = hmac_js_1.hmac.create(hash, password); + const PRFSalt = PRF._cloneInto().update(salt); + return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; +} +function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) { + PRF.destroy(); + PRFSalt.destroy(); + if (prfW) + prfW.destroy(); + u.fill(0); + return DK; +} +/** + * PBKDF2-HMAC: RFC 2898 key derivation function + * @param hash - hash function that would be used e.g. sha256 + * @param password - password from which a derived key is generated + * @param salt - cryptographic salt + * @param opts - {c, dkLen} where c is work factor and dkLen is output message size + */ +function pbkdf2(hash, password, salt, opts) { + const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); + let prfW; // Working copy + const arr = new Uint8Array(4); + const view = (0, utils_js_1.createView)(arr); + const u = new Uint8Array(PRF.outputLen); + // DK = T1 + T2 + ⋯ + Tdklen/hlen + for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { + // Ti = F(Password, Salt, c, i) + const Ti = DK.subarray(pos, pos + PRF.outputLen); + view.setInt32(0, ti, false); + // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc + // U1 = PRF(Password, Salt + INT_32_BE(i)) + (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); + Ti.set(u.subarray(0, Ti.length)); + for (let ui = 1; ui < c; ui++) { + // Uc = PRF(Password, Uc−1) + PRF._cloneInto(prfW).update(u).digestInto(u); + for (let i = 0; i < Ti.length; i++) + Ti[i] ^= u[i]; + } + } + return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); +} +exports.pbkdf2 = pbkdf2; +async function pbkdf2Async(hash, password, salt, opts) { + const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); + let prfW; // Working copy + const arr = new Uint8Array(4); + const view = (0, utils_js_1.createView)(arr); + const u = new Uint8Array(PRF.outputLen); + // DK = T1 + T2 + ⋯ + Tdklen/hlen + for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { + // Ti = F(Password, Salt, c, i) + const Ti = DK.subarray(pos, pos + PRF.outputLen); + view.setInt32(0, ti, false); + // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc + // U1 = PRF(Password, Salt + INT_32_BE(i)) + (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); + Ti.set(u.subarray(0, Ti.length)); + await (0, utils_js_1.asyncLoop)(c - 1, asyncTick, (i) => { + // Uc = PRF(Password, Uc−1) + PRF._cloneInto(prfW).update(u).digestInto(u); + for (let i = 0; i < Ti.length; i++) + Ti[i] ^= u[i]; + }); + } + return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); +} +exports.pbkdf2Async = pbkdf2Async; +//# sourceMappingURL=pbkdf2.js.map + +/***/ }), + +/***/ "./node_modules/@noble/hashes/ripemd160.js": +/*!*************************************************!*\ + !*** ./node_modules/@noble/hashes/ripemd160.js ***! + \*************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ripemd160 = exports.RIPEMD160 = void 0; +const _sha2_js_1 = __webpack_require__(/*! ./_sha2.js */ "./node_modules/@noble/hashes/_sha2.js"); +const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/hashes/utils.js"); +// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html +// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf +const Rho = new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]); +const Id = Uint8Array.from({ length: 16 }, (_, i) => i); +const Pi = Id.map((i) => (9 * i + 5) % 16); +let idxL = [Id]; +let idxR = [Pi]; +for (let i = 0; i < 4; i++) + for (let j of [idxL, idxR]) + j.push(j[i].map((k) => Rho[k])); +const shifts = [ + [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], + [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], + [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], + [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], + [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5], +].map((i) => new Uint8Array(i)); +const shiftsL = idxL.map((idx, i) => idx.map((j) => shifts[i][j])); +const shiftsR = idxR.map((idx, i) => idx.map((j) => shifts[i][j])); +const Kl = new Uint32Array([0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]); +const Kr = new Uint32Array([0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]); +// The rotate left (circular left shift) operation for uint32 +const rotl = (word, shift) => (word << shift) | (word >>> (32 - shift)); +// It's called f() in spec. +function f(group, x, y, z) { + if (group === 0) + return x ^ y ^ z; + else if (group === 1) + return (x & y) | (~x & z); + else if (group === 2) + return (x | ~y) ^ z; + else if (group === 3) + return (x & z) | (y & ~z); + else + return x ^ (y | ~z); +} +// Temporary buffer, not used to store anything between runs +const BUF = new Uint32Array(16); +class RIPEMD160 extends _sha2_js_1.SHA2 { + constructor() { + super(64, 20, 8, true); + this.h0 = 0x67452301 | 0; + this.h1 = 0xefcdab89 | 0; + this.h2 = 0x98badcfe | 0; + this.h3 = 0x10325476 | 0; + this.h4 = 0xc3d2e1f0 | 0; + } + get() { + const { h0, h1, h2, h3, h4 } = this; + return [h0, h1, h2, h3, h4]; + } + set(h0, h1, h2, h3, h4) { + this.h0 = h0 | 0; + this.h1 = h1 | 0; + this.h2 = h2 | 0; + this.h3 = h3 | 0; + this.h4 = h4 | 0; + } + process(view, offset) { + for (let i = 0; i < 16; i++, offset += 4) + BUF[i] = view.getUint32(offset, true); + // prettier-ignore + let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el; + // Instead of iterating 0 to 80, we split it into 5 groups + // And use the groups in constants, functions, etc. Much simpler + for (let group = 0; group < 5; group++) { + const rGroup = 4 - group; + const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore + const rl = idxL[group], rr = idxR[group]; // prettier-ignore + const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore + for (let i = 0; i < 16; i++) { + const tl = (rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0; + al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore + } + // 2 loops are 10% faster + for (let i = 0; i < 16; i++) { + const tr = (rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0; + ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore + } + } + // Add the compressed chunk to the current hash value + this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0); + } + roundClean() { + BUF.fill(0); + } + destroy() { + this.destroyed = true; + this.buffer.fill(0); + this.set(0, 0, 0, 0, 0); + } +} +exports.RIPEMD160 = RIPEMD160; +/** + * RIPEMD-160 - a hash function from 1990s. + * @param message - msg that would be hashed + */ +exports.ripemd160 = (0, utils_js_1.wrapConstructor)(() => new RIPEMD160()); +//# sourceMappingURL=ripemd160.js.map + +/***/ }), + +/***/ "./node_modules/@noble/hashes/sha256.js": +/*!**********************************************!*\ + !*** ./node_modules/@noble/hashes/sha256.js ***! + \**********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.sha224 = exports.sha256 = void 0; +const _sha2_js_1 = __webpack_require__(/*! ./_sha2.js */ "./node_modules/@noble/hashes/_sha2.js"); +const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/hashes/utils.js"); +// Choice: a ? b : c +const Chi = (a, b, c) => (a & b) ^ (~a & c); +// Majority function, true if any two inpust is true +const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); +// Round constants: +// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311) +// prettier-ignore +const SHA256_K = new Uint32Array([ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]); +// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): +// prettier-ignore +const IV = new Uint32Array([ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 +]); +// Temporary buffer, not used to store anything between runs +// Named this way because it matches specification. +const SHA256_W = new Uint32Array(64); +class SHA256 extends _sha2_js_1.SHA2 { + constructor() { + super(64, 32, 8, false); + // We cannot use array here since array allows indexing by variable + // which means optimizer/compiler cannot use registers. + this.A = IV[0] | 0; + this.B = IV[1] | 0; + this.C = IV[2] | 0; + this.D = IV[3] | 0; + this.E = IV[4] | 0; + this.F = IV[5] | 0; + this.G = IV[6] | 0; + this.H = IV[7] | 0; + } + get() { + const { A, B, C, D, E, F, G, H } = this; + return [A, B, C, D, E, F, G, H]; + } + // prettier-ignore + set(A, B, C, D, E, F, G, H) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + this.F = F | 0; + this.G = G | 0; + this.H = H | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) + SHA256_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W[i - 15]; + const W2 = SHA256_W[i - 2]; + const s0 = (0, utils_js_1.rotr)(W15, 7) ^ (0, utils_js_1.rotr)(W15, 18) ^ (W15 >>> 3); + const s1 = (0, utils_js_1.rotr)(W2, 17) ^ (0, utils_js_1.rotr)(W2, 19) ^ (W2 >>> 10); + SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; + } + // Compression function main loop, 64 rounds + let { A, B, C, D, E, F, G, H } = this; + for (let i = 0; i < 64; i++) { + const sigma1 = (0, utils_js_1.rotr)(E, 6) ^ (0, utils_js_1.rotr)(E, 11) ^ (0, utils_js_1.rotr)(E, 25); + const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const sigma0 = (0, utils_js_1.rotr)(A, 2) ^ (0, utils_js_1.rotr)(A, 13) ^ (0, utils_js_1.rotr)(A, 22); + const T2 = (sigma0 + Maj(A, B, C)) | 0; + H = G; + G = F; + F = E; + E = (D + T1) | 0; + D = C; + C = B; + B = A; + A = (T1 + T2) | 0; + } + // Add the compressed chunk to the current hash value + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + F = (F + this.F) | 0; + G = (G + this.G) | 0; + H = (H + this.H) | 0; + this.set(A, B, C, D, E, F, G, H); + } + roundClean() { + SHA256_W.fill(0); + } + destroy() { + this.set(0, 0, 0, 0, 0, 0, 0, 0); + this.buffer.fill(0); + } +} +// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf +class SHA224 extends SHA256 { + constructor() { + super(); + this.A = 0xc1059ed8 | 0; + this.B = 0x367cd507 | 0; + this.C = 0x3070dd17 | 0; + this.D = 0xf70e5939 | 0; + this.E = 0xffc00b31 | 0; + this.F = 0x68581511 | 0; + this.G = 0x64f98fa7 | 0; + this.H = 0xbefa4fa4 | 0; + this.outputLen = 28; + } +} +/** + * SHA2-256 hash function + * @param message - data that would be hashed + */ +exports.sha256 = (0, utils_js_1.wrapConstructor)(() => new SHA256()); +exports.sha224 = (0, utils_js_1.wrapConstructor)(() => new SHA224()); +//# sourceMappingURL=sha256.js.map + +/***/ }), + +/***/ "./node_modules/@noble/hashes/sha3.js": +/*!********************************************!*\ + !*** ./node_modules/@noble/hashes/sha3.js ***! + \********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.shake256 = exports.shake128 = exports.keccak_512 = exports.keccak_384 = exports.keccak_256 = exports.keccak_224 = exports.sha3_512 = exports.sha3_384 = exports.sha3_256 = exports.sha3_224 = exports.Keccak = exports.keccakP = void 0; +const _assert_js_1 = __webpack_require__(/*! ./_assert.js */ "./node_modules/@noble/hashes/_assert.js"); +const _u64_js_1 = __webpack_require__(/*! ./_u64.js */ "./node_modules/@noble/hashes/_u64.js"); +const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/hashes/utils.js"); +// Various per round constants calculations +const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; +const _0n = BigInt(0); +const _1n = BigInt(1); +const _2n = BigInt(2); +const _7n = BigInt(7); +const _256n = BigInt(256); +const _0x71n = BigInt(0x71); +for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { + // Pi + [x, y] = [y, (2 * x + 3 * y) % 5]; + SHA3_PI.push(2 * (5 * y + x)); + // Rotational + SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); + // Iota + let t = _0n; + for (let j = 0; j < 7; j++) { + R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; + if (R & _2n) + t ^= _1n << ((_1n << BigInt(j)) - _1n); + } + _SHA3_IOTA.push(t); +} +const [SHA3_IOTA_H, SHA3_IOTA_L] = _u64_js_1.default.split(_SHA3_IOTA, true); +// Left rotation (without 0, 32, 64) +const rotlH = (h, l, s) => s > 32 ? _u64_js_1.default.rotlBH(h, l, s) : _u64_js_1.default.rotlSH(h, l, s); +const rotlL = (h, l, s) => s > 32 ? _u64_js_1.default.rotlBL(h, l, s) : _u64_js_1.default.rotlSL(h, l, s); +// Same as keccakf1600, but allows to skip some rounds +function keccakP(s, rounds = 24) { + const B = new Uint32Array(5 * 2); + // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) + for (let round = 24 - rounds; round < 24; round++) { + // Theta θ + for (let x = 0; x < 10; x++) + B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; + for (let x = 0; x < 10; x += 2) { + const idx1 = (x + 8) % 10; + const idx0 = (x + 2) % 10; + const B0 = B[idx0]; + const B1 = B[idx0 + 1]; + const Th = rotlH(B0, B1, 1) ^ B[idx1]; + const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; + for (let y = 0; y < 50; y += 10) { + s[x + y] ^= Th; + s[x + y + 1] ^= Tl; + } + } + // Rho (ρ) and Pi (π) + let curH = s[2]; + let curL = s[3]; + for (let t = 0; t < 24; t++) { + const shift = SHA3_ROTL[t]; + const Th = rotlH(curH, curL, shift); + const Tl = rotlL(curH, curL, shift); + const PI = SHA3_PI[t]; + curH = s[PI]; + curL = s[PI + 1]; + s[PI] = Th; + s[PI + 1] = Tl; + } + // Chi (χ) + for (let y = 0; y < 50; y += 10) { + for (let x = 0; x < 10; x++) + B[x] = s[y + x]; + for (let x = 0; x < 10; x++) + s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; + } + // Iota (ι) + s[0] ^= SHA3_IOTA_H[round]; + s[1] ^= SHA3_IOTA_L[round]; + } + B.fill(0); +} +exports.keccakP = keccakP; +class Keccak extends utils_js_1.Hash { + // NOTE: we accept arguments in bytes instead of bits here. + constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { + super(); + this.blockLen = blockLen; + this.suffix = suffix; + this.outputLen = outputLen; + this.enableXOF = enableXOF; + this.rounds = rounds; + this.pos = 0; + this.posOut = 0; + this.finished = false; + this.destroyed = false; + // Can be passed from user as dkLen + _assert_js_1.default.number(outputLen); + // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes + if (0 >= this.blockLen || this.blockLen >= 200) + throw new Error('Sha3 supports only keccak-f1600 function'); + this.state = new Uint8Array(200); + this.state32 = (0, utils_js_1.u32)(this.state); + } + keccak() { + keccakP(this.state32, this.rounds); + this.posOut = 0; + this.pos = 0; + } + update(data) { + _assert_js_1.default.exists(this); + const { blockLen, state } = this; + data = (0, utils_js_1.toBytes)(data); + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + for (let i = 0; i < take; i++) + state[this.pos++] ^= data[pos++]; + if (this.pos === blockLen) + this.keccak(); + } + return this; + } + finish() { + if (this.finished) + return; + this.finished = true; + const { state, suffix, pos, blockLen } = this; + // Do the padding + state[pos] ^= suffix; + if ((suffix & 0x80) !== 0 && pos === blockLen - 1) + this.keccak(); + state[blockLen - 1] ^= 0x80; + this.keccak(); + } + writeInto(out) { + _assert_js_1.default.exists(this, false); + _assert_js_1.default.bytes(out); + this.finish(); + const bufferOut = this.state; + const { blockLen } = this; + for (let pos = 0, len = out.length; pos < len;) { + if (this.posOut >= blockLen) + this.keccak(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out) { + // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF + if (!this.enableXOF) + throw new Error('XOF is not possible for this instance'); + return this.writeInto(out); + } + xof(bytes) { + _assert_js_1.default.number(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out) { + _assert_js_1.default.output(out, this); + if (this.finished) + throw new Error('digest() was already called'); + this.writeInto(out); + this.destroy(); + return out; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } + destroy() { + this.destroyed = true; + this.state.fill(0); + } + _cloneInto(to) { + const { blockLen, suffix, outputLen, rounds, enableXOF } = this; + to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); + to.state32.set(this.state32); + to.pos = this.pos; + to.posOut = this.posOut; + to.finished = this.finished; + to.rounds = rounds; + // Suffix can change in cSHAKE + to.suffix = suffix; + to.outputLen = outputLen; + to.enableXOF = enableXOF; + to.destroyed = this.destroyed; + return to; + } +} +exports.Keccak = Keccak; +const gen = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapConstructor)(() => new Keccak(blockLen, suffix, outputLen)); +exports.sha3_224 = gen(0x06, 144, 224 / 8); +/** + * SHA3-256 hash function + * @param message - that would be hashed + */ +exports.sha3_256 = gen(0x06, 136, 256 / 8); +exports.sha3_384 = gen(0x06, 104, 384 / 8); +exports.sha3_512 = gen(0x06, 72, 512 / 8); +exports.keccak_224 = gen(0x01, 144, 224 / 8); +/** + * keccak-256 hash function. Different from SHA3-256. + * @param message - that would be hashed + */ +exports.keccak_256 = gen(0x01, 136, 256 / 8); +exports.keccak_384 = gen(0x01, 104, 384 / 8); +exports.keccak_512 = gen(0x01, 72, 512 / 8); +const genShake = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapConstructorWithOpts)((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true)); +exports.shake128 = genShake(0x1f, 168, 128 / 8); +exports.shake256 = genShake(0x1f, 136, 256 / 8); +//# sourceMappingURL=sha3.js.map + +/***/ }), + +/***/ "./node_modules/@noble/hashes/sha512.js": +/*!**********************************************!*\ + !*** ./node_modules/@noble/hashes/sha512.js ***! + \**********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.sha384 = exports.sha512_256 = exports.sha512_224 = exports.sha512 = exports.SHA512 = void 0; +const _sha2_js_1 = __webpack_require__(/*! ./_sha2.js */ "./node_modules/@noble/hashes/_sha2.js"); +const _u64_js_1 = __webpack_require__(/*! ./_u64.js */ "./node_modules/@noble/hashes/_u64.js"); +const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/hashes/utils.js"); +// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409): +// prettier-ignore +const [SHA512_Kh, SHA512_Kl] = _u64_js_1.default.split([ + '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc', + '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118', + '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2', + '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694', + '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65', + '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5', + '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4', + '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70', + '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df', + '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b', + '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30', + '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8', + '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8', + '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3', + '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec', + '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b', + '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178', + '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b', + '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c', + '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817' +].map(n => BigInt(n))); +// Temporary buffer, not used to store anything between runs +const SHA512_W_H = new Uint32Array(80); +const SHA512_W_L = new Uint32Array(80); +class SHA512 extends _sha2_js_1.SHA2 { + constructor() { + super(128, 64, 16, false); + // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers. + // Also looks cleaner and easier to verify with spec. + // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0x6a09e667 | 0; + this.Al = 0xf3bcc908 | 0; + this.Bh = 0xbb67ae85 | 0; + this.Bl = 0x84caa73b | 0; + this.Ch = 0x3c6ef372 | 0; + this.Cl = 0xfe94f82b | 0; + this.Dh = 0xa54ff53a | 0; + this.Dl = 0x5f1d36f1 | 0; + this.Eh = 0x510e527f | 0; + this.El = 0xade682d1 | 0; + this.Fh = 0x9b05688c | 0; + this.Fl = 0x2b3e6c1f | 0; + this.Gh = 0x1f83d9ab | 0; + this.Gl = 0xfb41bd6b | 0; + this.Hh = 0x5be0cd19 | 0; + this.Hl = 0x137e2179 | 0; + } + // prettier-ignore + get() { + const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; + } + // prettier-ignore + set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { + this.Ah = Ah | 0; + this.Al = Al | 0; + this.Bh = Bh | 0; + this.Bl = Bl | 0; + this.Ch = Ch | 0; + this.Cl = Cl | 0; + this.Dh = Dh | 0; + this.Dl = Dl | 0; + this.Eh = Eh | 0; + this.El = El | 0; + this.Fh = Fh | 0; + this.Fl = Fl | 0; + this.Gh = Gh | 0; + this.Gl = Gl | 0; + this.Hh = Hh | 0; + this.Hl = Hl | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) { + SHA512_W_H[i] = view.getUint32(offset); + SHA512_W_L[i] = view.getUint32((offset += 4)); + } + for (let i = 16; i < 80; i++) { + // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) + const W15h = SHA512_W_H[i - 15] | 0; + const W15l = SHA512_W_L[i - 15] | 0; + const s0h = _u64_js_1.default.rotrSH(W15h, W15l, 1) ^ _u64_js_1.default.rotrSH(W15h, W15l, 8) ^ _u64_js_1.default.shrSH(W15h, W15l, 7); + const s0l = _u64_js_1.default.rotrSL(W15h, W15l, 1) ^ _u64_js_1.default.rotrSL(W15h, W15l, 8) ^ _u64_js_1.default.shrSL(W15h, W15l, 7); + // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) + const W2h = SHA512_W_H[i - 2] | 0; + const W2l = SHA512_W_L[i - 2] | 0; + const s1h = _u64_js_1.default.rotrSH(W2h, W2l, 19) ^ _u64_js_1.default.rotrBH(W2h, W2l, 61) ^ _u64_js_1.default.shrSH(W2h, W2l, 6); + const s1l = _u64_js_1.default.rotrSL(W2h, W2l, 19) ^ _u64_js_1.default.rotrBL(W2h, W2l, 61) ^ _u64_js_1.default.shrSL(W2h, W2l, 6); + // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16]; + const SUMl = _u64_js_1.default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); + const SUMh = _u64_js_1.default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); + SHA512_W_H[i] = SUMh | 0; + SHA512_W_L[i] = SUMl | 0; + } + let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + // Compression function main loop, 80 rounds + for (let i = 0; i < 80; i++) { + // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) + const sigma1h = _u64_js_1.default.rotrSH(Eh, El, 14) ^ _u64_js_1.default.rotrSH(Eh, El, 18) ^ _u64_js_1.default.rotrBH(Eh, El, 41); + const sigma1l = _u64_js_1.default.rotrSL(Eh, El, 14) ^ _u64_js_1.default.rotrSL(Eh, El, 18) ^ _u64_js_1.default.rotrBL(Eh, El, 41); + //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const CHIh = (Eh & Fh) ^ (~Eh & Gh); + const CHIl = (El & Fl) ^ (~El & Gl); + // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] + // prettier-ignore + const T1ll = _u64_js_1.default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); + const T1h = _u64_js_1.default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); + const T1l = T1ll | 0; + // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) + const sigma0h = _u64_js_1.default.rotrSH(Ah, Al, 28) ^ _u64_js_1.default.rotrBH(Ah, Al, 34) ^ _u64_js_1.default.rotrBH(Ah, Al, 39); + const sigma0l = _u64_js_1.default.rotrSL(Ah, Al, 28) ^ _u64_js_1.default.rotrBL(Ah, Al, 34) ^ _u64_js_1.default.rotrBL(Ah, Al, 39); + const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); + const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); + Hh = Gh | 0; + Hl = Gl | 0; + Gh = Fh | 0; + Gl = Fl | 0; + Fh = Eh | 0; + Fl = El | 0; + ({ h: Eh, l: El } = _u64_js_1.default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); + Dh = Ch | 0; + Dl = Cl | 0; + Ch = Bh | 0; + Cl = Bl | 0; + Bh = Ah | 0; + Bl = Al | 0; + const All = _u64_js_1.default.add3L(T1l, sigma0l, MAJl); + Ah = _u64_js_1.default.add3H(All, T1h, sigma0h, MAJh); + Al = All | 0; + } + // Add the compressed chunk to the current hash value + ({ h: Ah, l: Al } = _u64_js_1.default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); + ({ h: Bh, l: Bl } = _u64_js_1.default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); + ({ h: Ch, l: Cl } = _u64_js_1.default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); + ({ h: Dh, l: Dl } = _u64_js_1.default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); + ({ h: Eh, l: El } = _u64_js_1.default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); + ({ h: Fh, l: Fl } = _u64_js_1.default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); + ({ h: Gh, l: Gl } = _u64_js_1.default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); + ({ h: Hh, l: Hl } = _u64_js_1.default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); + this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); + } + roundClean() { + SHA512_W_H.fill(0); + SHA512_W_L.fill(0); + } + destroy() { + this.buffer.fill(0); + this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } +} +exports.SHA512 = SHA512; +class SHA512_224 extends SHA512 { + constructor() { + super(); + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0x8c3d37c8 | 0; + this.Al = 0x19544da2 | 0; + this.Bh = 0x73e19966 | 0; + this.Bl = 0x89dcd4d6 | 0; + this.Ch = 0x1dfab7ae | 0; + this.Cl = 0x32ff9c82 | 0; + this.Dh = 0x679dd514 | 0; + this.Dl = 0x582f9fcf | 0; + this.Eh = 0x0f6d2b69 | 0; + this.El = 0x7bd44da8 | 0; + this.Fh = 0x77e36f73 | 0; + this.Fl = 0x04c48942 | 0; + this.Gh = 0x3f9d85a8 | 0; + this.Gl = 0x6a1d36c8 | 0; + this.Hh = 0x1112e6ad | 0; + this.Hl = 0x91d692a1 | 0; + this.outputLen = 28; + } +} +class SHA512_256 extends SHA512 { + constructor() { + super(); + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0x22312194 | 0; + this.Al = 0xfc2bf72c | 0; + this.Bh = 0x9f555fa3 | 0; + this.Bl = 0xc84c64c2 | 0; + this.Ch = 0x2393b86b | 0; + this.Cl = 0x6f53b151 | 0; + this.Dh = 0x96387719 | 0; + this.Dl = 0x5940eabd | 0; + this.Eh = 0x96283ee2 | 0; + this.El = 0xa88effe3 | 0; + this.Fh = 0xbe5e1e25 | 0; + this.Fl = 0x53863992 | 0; + this.Gh = 0x2b0199fc | 0; + this.Gl = 0x2c85b8aa | 0; + this.Hh = 0x0eb72ddc | 0; + this.Hl = 0x81c52ca2 | 0; + this.outputLen = 32; + } +} +class SHA384 extends SHA512 { + constructor() { + super(); + // h -- high 32 bits, l -- low 32 bits + this.Ah = 0xcbbb9d5d | 0; + this.Al = 0xc1059ed8 | 0; + this.Bh = 0x629a292a | 0; + this.Bl = 0x367cd507 | 0; + this.Ch = 0x9159015a | 0; + this.Cl = 0x3070dd17 | 0; + this.Dh = 0x152fecd8 | 0; + this.Dl = 0xf70e5939 | 0; + this.Eh = 0x67332667 | 0; + this.El = 0xffc00b31 | 0; + this.Fh = 0x8eb44a87 | 0; + this.Fl = 0x68581511 | 0; + this.Gh = 0xdb0c2e0d | 0; + this.Gl = 0x64f98fa7 | 0; + this.Hh = 0x47b5481d | 0; + this.Hl = 0xbefa4fa4 | 0; + this.outputLen = 48; + } +} +exports.sha512 = (0, utils_js_1.wrapConstructor)(() => new SHA512()); +exports.sha512_224 = (0, utils_js_1.wrapConstructor)(() => new SHA512_224()); +exports.sha512_256 = (0, utils_js_1.wrapConstructor)(() => new SHA512_256()); +exports.sha384 = (0, utils_js_1.wrapConstructor)(() => new SHA384()); +//# sourceMappingURL=sha512.js.map + +/***/ }), + +/***/ "./node_modules/@noble/hashes/utils.js": +/*!*********************************************!*\ + !*** ./node_modules/@noble/hashes/utils.js ***! + \*********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.randomBytes = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.concatBytes = exports.toBytes = exports.utf8ToBytes = exports.asyncLoop = exports.nextTick = exports.hexToBytes = exports.bytesToHex = exports.isLE = exports.rotr = exports.createView = exports.u32 = exports.u8 = void 0; +// We use `globalThis.crypto`, but node.js versions earlier than v19 don't +// declare it in global scope. For node.js, package.json#exports field mapping +// rewrites import from `crypto` to `cryptoNode`, which imports native module. +// Makes the utils un-importable in browsers without a bundler. +// Once node.js 18 is deprecated, we can just drop the import. +const crypto_1 = __webpack_require__(/*! @noble/hashes/crypto */ "./node_modules/@noble/hashes/crypto.js"); +// Cast array to different type +const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); +exports.u8 = u8; +const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); +exports.u32 = u32; +// Cast array to view +const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); +exports.createView = createView; +// The rotate right (circular right shift) operation for uint32 +const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); +exports.rotr = rotr; +// big-endian hardware is rare. Just in case someone still decides to run hashes: +// early-throw an error because we don't support BE yet. +exports.isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; +if (!exports.isLE) + throw new Error('Non little-endian hardware is not supported'); +const hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0')); +/** + * @example bytesToHex(Uint8Array.from([0xde, 0xad, 0xbe, 0xef])) // 'deadbeef' + */ +function bytesToHex(uint8a) { + // pre-caching improves the speed 6x + if (!(uint8a instanceof Uint8Array)) + throw new Error('Uint8Array expected'); + let hex = ''; + for (let i = 0; i < uint8a.length; i++) { + hex += hexes[uint8a[i]]; + } + return hex; +} +exports.bytesToHex = bytesToHex; +/** + * @example hexToBytes('deadbeef') // Uint8Array.from([0xde, 0xad, 0xbe, 0xef]) + */ +function hexToBytes(hex) { + if (typeof hex !== 'string') { + throw new TypeError('hexToBytes: expected string, got ' + typeof hex); + } + if (hex.length % 2) + throw new Error('hexToBytes: received invalid unpadded hex'); + const array = new Uint8Array(hex.length / 2); + for (let i = 0; i < array.length; i++) { + const j = i * 2; + const hexByte = hex.slice(j, j + 2); + const byte = Number.parseInt(hexByte, 16); + if (Number.isNaN(byte) || byte < 0) + throw new Error('Invalid byte sequence'); + array[i] = byte; + } + return array; +} +exports.hexToBytes = hexToBytes; +// There is no setImmediate in browser and setTimeout is slow. +// call of async fn will return Promise, which will be fullfiled only on +// next scheduler queue processing step and this is exactly what we need. +const nextTick = async () => { }; +exports.nextTick = nextTick; +// Returns control to thread each 'tick' ms to avoid blocking +async function asyncLoop(iters, tick, cb) { + let ts = Date.now(); + for (let i = 0; i < iters; i++) { + cb(i); + // Date.now() is not monotonic, so in case if clock goes backwards we return return control too + const diff = Date.now() - ts; + if (diff >= 0 && diff < tick) + continue; + await (0, exports.nextTick)(); + ts += diff; + } +} +exports.asyncLoop = asyncLoop; +function utf8ToBytes(str) { + if (typeof str !== 'string') { + throw new TypeError(`utf8ToBytes expected string, got ${typeof str}`); + } + return new TextEncoder().encode(str); +} +exports.utf8ToBytes = utf8ToBytes; +function toBytes(data) { + if (typeof data === 'string') + data = utf8ToBytes(data); + if (!(data instanceof Uint8Array)) + throw new TypeError(`Expected input type is Uint8Array (got ${typeof data})`); + return data; +} +exports.toBytes = toBytes; +/** + * Concats Uint8Array-s into one; like `Buffer.concat([buf1, buf2])` + * @example concatBytes(buf1, buf2) + */ +function concatBytes(...arrays) { + if (!arrays.every((a) => a instanceof Uint8Array)) + throw new Error('Uint8Array list expected'); + if (arrays.length === 1) + return arrays[0]; + const length = arrays.reduce((a, arr) => a + arr.length, 0); + const result = new Uint8Array(length); + for (let i = 0, pad = 0; i < arrays.length; i++) { + const arr = arrays[i]; + result.set(arr, pad); + pad += arr.length; + } + return result; +} +exports.concatBytes = concatBytes; +// For runtime check if class implements interface +class Hash { + // Safe version that clones internal state + clone() { + return this._cloneInto(); + } +} +exports.Hash = Hash; +// Check if object doens't have custom constructor (like Uint8Array/Array) +const isPlainObject = (obj) => Object.prototype.toString.call(obj) === '[object Object]' && obj.constructor === Object; +function checkOpts(defaults, opts) { + if (opts !== undefined && (typeof opts !== 'object' || !isPlainObject(opts))) + throw new TypeError('Options should be object or undefined'); + const merged = Object.assign(defaults, opts); + return merged; +} +exports.checkOpts = checkOpts; +function wrapConstructor(hashConstructor) { + const hashC = (message) => hashConstructor().update(toBytes(message)).digest(); + const tmp = hashConstructor(); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = () => hashConstructor(); + return hashC; +} +exports.wrapConstructor = wrapConstructor; +function wrapConstructorWithOpts(hashCons) { + const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); + const tmp = hashCons({}); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = (opts) => hashCons(opts); + return hashC; +} +exports.wrapConstructorWithOpts = wrapConstructorWithOpts; +/** + * Secure PRNG. Uses `globalThis.crypto` or node.js crypto module. + */ +function randomBytes(bytesLength = 32) { + if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === 'function') { + return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength)); + } + throw new Error('crypto.getRandomValues must be defined'); +} +exports.randomBytes = randomBytes; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ "./node_modules/@protobufjs/aspromise/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/@protobufjs/aspromise/index.js ***! + \*****************************************************/ +/***/ (function(module) { + +"use strict"; + +module.exports = asPromise; + +/** + * Callback as used by {@link util.asPromise}. + * @typedef asPromiseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {...*} params Additional arguments + * @returns {undefined} + */ + +/** + * Returns a promise from a node-style callback function. + * @memberof util + * @param {asPromiseCallback} fn Function to call + * @param {*} ctx Function context + * @param {...*} params Function arguments + * @returns {Promise<*>} Promisified function + */ +function asPromise(fn, ctx/*, varargs */) { + var params = new Array(arguments.length - 1), + offset = 0, + index = 2, + pending = true; + while (index < arguments.length) + params[offset++] = arguments[index++]; + return new Promise(function executor(resolve, reject) { + params[offset] = function callback(err/*, varargs */) { + if (pending) { + pending = false; + if (err) + reject(err); + else { + var params = new Array(arguments.length - 1), + offset = 0; + while (offset < params.length) + params[offset++] = arguments[offset]; + resolve.apply(null, params); + } + } + }; + try { + fn.apply(ctx || null, params); + } catch (err) { + if (pending) { + pending = false; + reject(err); + } + } + }); +} + + +/***/ }), + +/***/ "./node_modules/@protobufjs/base64/index.js": +/*!**************************************************!*\ + !*** ./node_modules/@protobufjs/base64/index.js ***! + \**************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + + +/** + * A minimal base64 implementation for number arrays. + * @memberof util + * @namespace + */ +var base64 = exports; + +/** + * Calculates the byte length of a base64 encoded string. + * @param {string} string Base64 encoded string + * @returns {number} Byte length + */ +base64.length = function length(string) { + var p = string.length; + if (!p) + return 0; + var n = 0; + while (--p % 4 > 1 && string.charAt(p) === "=") + ++n; + return Math.ceil(string.length * 3) / 4 - n; +}; + +// Base64 encoding table +var b64 = new Array(64); + +// Base64 decoding table +var s64 = new Array(123); + +// 65..90, 97..122, 48..57, 43, 47 +for (var i = 0; i < 64;) + s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; + +/** + * Encodes a buffer to a base64 encoded string. + * @param {Uint8Array} buffer Source buffer + * @param {number} start Source start + * @param {number} end Source end + * @returns {string} Base64 encoded string + */ +base64.encode = function encode(buffer, start, end) { + var parts = null, + chunk = []; + var i = 0, // output index + j = 0, // goto index + t; // temporary + while (start < end) { + var b = buffer[start++]; + switch (j) { + case 0: + chunk[i++] = b64[b >> 2]; + t = (b & 3) << 4; + j = 1; + break; + case 1: + chunk[i++] = b64[t | b >> 4]; + t = (b & 15) << 2; + j = 2; + break; + case 2: + chunk[i++] = b64[t | b >> 6]; + chunk[i++] = b64[b & 63]; + j = 0; + break; + } + if (i > 8191) { + (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); + i = 0; + } + } + if (j) { + chunk[i++] = b64[t]; + chunk[i++] = 61; + if (j === 1) + chunk[i++] = 61; + } + if (parts) { + if (i) + parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); + return parts.join(""); + } + return String.fromCharCode.apply(String, chunk.slice(0, i)); +}; + +var invalidEncoding = "invalid encoding"; + +/** + * Decodes a base64 encoded string to a buffer. + * @param {string} string Source string + * @param {Uint8Array} buffer Destination buffer + * @param {number} offset Destination offset + * @returns {number} Number of bytes written + * @throws {Error} If encoding is invalid + */ +base64.decode = function decode(string, buffer, offset) { + var start = offset; + var j = 0, // goto index + t; // temporary + for (var i = 0; i < string.length;) { + var c = string.charCodeAt(i++); + if (c === 61 && j > 1) + break; + if ((c = s64[c]) === undefined) + throw Error(invalidEncoding); + switch (j) { + case 0: + t = c; + j = 1; + break; + case 1: + buffer[offset++] = t << 2 | (c & 48) >> 4; + t = c; + j = 2; + break; + case 2: + buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2; + t = c; + j = 3; + break; + case 3: + buffer[offset++] = (t & 3) << 6 | c; + j = 0; + break; + } + } + if (j === 1) + throw Error(invalidEncoding); + return offset - start; +}; + +/** + * Tests if the specified string appears to be base64 encoded. + * @param {string} string String to test + * @returns {boolean} `true` if probably base64 encoded, otherwise false + */ +base64.test = function test(string) { + return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string); +}; + + +/***/ }), + +/***/ "./node_modules/@protobufjs/codegen/index.js": +/*!***************************************************!*\ + !*** ./node_modules/@protobufjs/codegen/index.js ***! + \***************************************************/ +/***/ (function(module) { + +"use strict"; + +module.exports = codegen; + +/** + * Begins generating a function. + * @memberof util + * @param {string[]} functionParams Function parameter names + * @param {string} [functionName] Function name if not anonymous + * @returns {Codegen} Appender that appends code to the function's body + */ +function codegen(functionParams, functionName) { + + /* istanbul ignore if */ + if (typeof functionParams === "string") { + functionName = functionParams; + functionParams = undefined; + } + + var body = []; + + /** + * Appends code to the function's body or finishes generation. + * @typedef Codegen + * @type {function} + * @param {string|Object.} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any + * @param {...*} [formatParams] Format parameters + * @returns {Codegen|Function} Itself or the generated function if finished + * @throws {Error} If format parameter counts do not match + */ + + function Codegen(formatStringOrScope) { + // note that explicit array handling below makes this ~50% faster + + // finish the function + if (typeof formatStringOrScope !== "string") { + var source = toString(); + if (codegen.verbose) + console.log("codegen: " + source); // eslint-disable-line no-console + source = "return " + source; + if (formatStringOrScope) { + var scopeKeys = Object.keys(formatStringOrScope), + scopeParams = new Array(scopeKeys.length + 1), + scopeValues = new Array(scopeKeys.length), + scopeOffset = 0; + while (scopeOffset < scopeKeys.length) { + scopeParams[scopeOffset] = scopeKeys[scopeOffset]; + scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]]; + } + scopeParams[scopeOffset] = source; + return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func + } + return Function(source)(); // eslint-disable-line no-new-func + } + + // otherwise append to body + var formatParams = new Array(arguments.length - 1), + formatOffset = 0; + while (formatOffset < formatParams.length) + formatParams[formatOffset] = arguments[++formatOffset]; + formatOffset = 0; + formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) { + var value = formatParams[formatOffset++]; + switch ($1) { + case "d": case "f": return String(Number(value)); + case "i": return String(Math.floor(value)); + case "j": return JSON.stringify(value); + case "s": return String(value); + } + return "%"; + }); + if (formatOffset !== formatParams.length) + throw Error("parameter count mismatch"); + body.push(formatStringOrScope); + return Codegen; + } + + function toString(functionNameOverride) { + return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}"; + } + + Codegen.toString = toString; + return Codegen; +} + +/** + * Begins generating a function. + * @memberof util + * @function codegen + * @param {string} [functionName] Function name if not anonymous + * @returns {Codegen} Appender that appends code to the function's body + * @variation 2 + */ + +/** + * When set to `true`, codegen will log generated code to console. Useful for debugging. + * @name util.codegen.verbose + * @type {boolean} + */ +codegen.verbose = false; + + +/***/ }), + +/***/ "./node_modules/@protobufjs/eventemitter/index.js": +/*!********************************************************!*\ + !*** ./node_modules/@protobufjs/eventemitter/index.js ***! + \********************************************************/ +/***/ (function(module) { + +"use strict"; + +module.exports = EventEmitter; + +/** + * Constructs a new event emitter instance. + * @classdesc A minimal event emitter. + * @memberof util + * @constructor + */ +function EventEmitter() { + + /** + * Registered listeners. + * @type {Object.} + * @private + */ + this._listeners = {}; +} + +/** + * Registers an event listener. + * @param {string} evt Event name + * @param {function} fn Listener + * @param {*} [ctx] Listener context + * @returns {util.EventEmitter} `this` + */ +EventEmitter.prototype.on = function on(evt, fn, ctx) { + (this._listeners[evt] || (this._listeners[evt] = [])).push({ + fn : fn, + ctx : ctx || this + }); + return this; +}; + +/** + * Removes an event listener or any matching listeners if arguments are omitted. + * @param {string} [evt] Event name. Removes all listeners if omitted. + * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted. + * @returns {util.EventEmitter} `this` + */ +EventEmitter.prototype.off = function off(evt, fn) { + if (evt === undefined) + this._listeners = {}; + else { + if (fn === undefined) + this._listeners[evt] = []; + else { + var listeners = this._listeners[evt]; + for (var i = 0; i < listeners.length;) + if (listeners[i].fn === fn) + listeners.splice(i, 1); + else + ++i; + } + } + return this; +}; + +/** + * Emits an event by calling its listeners with the specified arguments. + * @param {string} evt Event name + * @param {...*} args Arguments + * @returns {util.EventEmitter} `this` + */ +EventEmitter.prototype.emit = function emit(evt) { + var listeners = this._listeners[evt]; + if (listeners) { + var args = [], + i = 1; + for (; i < arguments.length;) + args.push(arguments[i++]); + for (i = 0; i < listeners.length;) + listeners[i].fn.apply(listeners[i++].ctx, args); + } + return this; +}; + + +/***/ }), + +/***/ "./node_modules/@protobufjs/fetch/index.js": +/*!*************************************************!*\ + !*** ./node_modules/@protobufjs/fetch/index.js ***! + \*************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + +module.exports = fetch; + +var asPromise = __webpack_require__(/*! @protobufjs/aspromise */ "./node_modules/@protobufjs/aspromise/index.js"), + inquire = __webpack_require__(/*! @protobufjs/inquire */ "./node_modules/@protobufjs/inquire/index.js"); + +var fs = inquire("fs"); + +/** + * Node-style callback as used by {@link util.fetch}. + * @typedef FetchCallback + * @type {function} + * @param {?Error} error Error, if any, otherwise `null` + * @param {string} [contents] File contents, if there hasn't been an error + * @returns {undefined} + */ + +/** + * Options as used by {@link util.fetch}. + * @typedef FetchOptions + * @type {Object} + * @property {boolean} [binary=false] Whether expecting a binary response + * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest + */ + +/** + * Fetches the contents of a file. + * @memberof util + * @param {string} filename File path or url + * @param {FetchOptions} options Fetch options + * @param {FetchCallback} callback Callback function + * @returns {undefined} + */ +function fetch(filename, options, callback) { + if (typeof options === "function") { + callback = options; + options = {}; + } else if (!options) + options = {}; + + if (!callback) + return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this + + // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found. + if (!options.xhr && fs && fs.readFile) + return fs.readFile(filename, function fetchReadFileCallback(err, contents) { + return err && typeof XMLHttpRequest !== "undefined" + ? fetch.xhr(filename, options, callback) + : err + ? callback(err) + : callback(null, options.binary ? contents : contents.toString("utf8")); + }); + + // use the XHR version otherwise. + return fetch.xhr(filename, options, callback); +} + +/** + * Fetches the contents of a file. + * @name util.fetch + * @function + * @param {string} path File path or url + * @param {FetchCallback} callback Callback function + * @returns {undefined} + * @variation 2 + */ + +/** + * Fetches the contents of a file. + * @name util.fetch + * @function + * @param {string} path File path or url + * @param {FetchOptions} [options] Fetch options + * @returns {Promise} Promise + * @variation 3 + */ + +/**/ +fetch.xhr = function fetch_xhr(filename, options, callback) { + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() { + + if (xhr.readyState !== 4) + return undefined; + + // local cors security errors return status 0 / empty string, too. afaik this cannot be + // reliably distinguished from an actually empty file for security reasons. feel free + // to send a pull request if you are aware of a solution. + if (xhr.status !== 0 && xhr.status !== 200) + return callback(Error("status " + xhr.status)); + + // if binary data is expected, make sure that some sort of array is returned, even if + // ArrayBuffers are not supported. the binary string fallback, however, is unsafe. + if (options.binary) { + var buffer = xhr.response; + if (!buffer) { + buffer = []; + for (var i = 0; i < xhr.responseText.length; ++i) + buffer.push(xhr.responseText.charCodeAt(i) & 255); + } + return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer); + } + return callback(null, xhr.responseText); + }; + + if (options.binary) { + // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers + if ("overrideMimeType" in xhr) + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + xhr.responseType = "arraybuffer"; + } + + xhr.open("GET", filename); + xhr.send(); +}; + + +/***/ }), + +/***/ "./node_modules/@protobufjs/float/index.js": +/*!*************************************************!*\ + !*** ./node_modules/@protobufjs/float/index.js ***! + \*************************************************/ +/***/ (function(module) { + +"use strict"; + + +module.exports = factory(factory); + +/** + * Reads / writes floats / doubles from / to buffers. + * @name util.float + * @namespace + */ + +/** + * Writes a 32 bit float to a buffer using little endian byte order. + * @name util.float.writeFloatLE + * @function + * @param {number} val Value to write + * @param {Uint8Array} buf Target buffer + * @param {number} pos Target buffer offset + * @returns {undefined} + */ + +/** + * Writes a 32 bit float to a buffer using big endian byte order. + * @name util.float.writeFloatBE + * @function + * @param {number} val Value to write + * @param {Uint8Array} buf Target buffer + * @param {number} pos Target buffer offset + * @returns {undefined} + */ + +/** + * Reads a 32 bit float from a buffer using little endian byte order. + * @name util.float.readFloatLE + * @function + * @param {Uint8Array} buf Source buffer + * @param {number} pos Source buffer offset + * @returns {number} Value read + */ + +/** + * Reads a 32 bit float from a buffer using big endian byte order. + * @name util.float.readFloatBE + * @function + * @param {Uint8Array} buf Source buffer + * @param {number} pos Source buffer offset + * @returns {number} Value read + */ + +/** + * Writes a 64 bit double to a buffer using little endian byte order. + * @name util.float.writeDoubleLE + * @function + * @param {number} val Value to write + * @param {Uint8Array} buf Target buffer + * @param {number} pos Target buffer offset + * @returns {undefined} + */ + +/** + * Writes a 64 bit double to a buffer using big endian byte order. + * @name util.float.writeDoubleBE + * @function + * @param {number} val Value to write + * @param {Uint8Array} buf Target buffer + * @param {number} pos Target buffer offset + * @returns {undefined} + */ + +/** + * Reads a 64 bit double from a buffer using little endian byte order. + * @name util.float.readDoubleLE + * @function + * @param {Uint8Array} buf Source buffer + * @param {number} pos Source buffer offset + * @returns {number} Value read + */ + +/** + * Reads a 64 bit double from a buffer using big endian byte order. + * @name util.float.readDoubleBE + * @function + * @param {Uint8Array} buf Source buffer + * @param {number} pos Source buffer offset + * @returns {number} Value read + */ + +// Factory function for the purpose of node-based testing in modified global environments +function factory(exports) { + + // float: typed array + if (typeof Float32Array !== "undefined") (function() { + + var f32 = new Float32Array([ -0 ]), + f8b = new Uint8Array(f32.buffer), + le = f8b[3] === 128; + + function writeFloat_f32_cpy(val, buf, pos) { + f32[0] = val; + buf[pos ] = f8b[0]; + buf[pos + 1] = f8b[1]; + buf[pos + 2] = f8b[2]; + buf[pos + 3] = f8b[3]; + } + + function writeFloat_f32_rev(val, buf, pos) { + f32[0] = val; + buf[pos ] = f8b[3]; + buf[pos + 1] = f8b[2]; + buf[pos + 2] = f8b[1]; + buf[pos + 3] = f8b[0]; + } + + /* istanbul ignore next */ + exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev; + /* istanbul ignore next */ + exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy; + + function readFloat_f32_cpy(buf, pos) { + f8b[0] = buf[pos ]; + f8b[1] = buf[pos + 1]; + f8b[2] = buf[pos + 2]; + f8b[3] = buf[pos + 3]; + return f32[0]; + } + + function readFloat_f32_rev(buf, pos) { + f8b[3] = buf[pos ]; + f8b[2] = buf[pos + 1]; + f8b[1] = buf[pos + 2]; + f8b[0] = buf[pos + 3]; + return f32[0]; + } + + /* istanbul ignore next */ + exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev; + /* istanbul ignore next */ + exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy; + + // float: ieee754 + })(); else (function() { + + function writeFloat_ieee754(writeUint, val, buf, pos) { + var sign = val < 0 ? 1 : 0; + if (sign) + val = -val; + if (val === 0) + writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos); + else if (isNaN(val)) + writeUint(2143289344, buf, pos); + else if (val > 3.4028234663852886e+38) // +-Infinity + writeUint((sign << 31 | 2139095040) >>> 0, buf, pos); + else if (val < 1.1754943508222875e-38) // denormal + writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos); + else { + var exponent = Math.floor(Math.log(val) / Math.LN2), + mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607; + writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos); + } + } + + exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE); + exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE); + + function readFloat_ieee754(readUint, buf, pos) { + var uint = readUint(buf, pos), + sign = (uint >> 31) * 2 + 1, + exponent = uint >>> 23 & 255, + mantissa = uint & 8388607; + return exponent === 255 + ? mantissa + ? NaN + : sign * Infinity + : exponent === 0 // denormal + ? sign * 1.401298464324817e-45 * mantissa + : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608); + } + + exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE); + exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE); + + })(); + + // double: typed array + if (typeof Float64Array !== "undefined") (function() { + + var f64 = new Float64Array([-0]), + f8b = new Uint8Array(f64.buffer), + le = f8b[7] === 128; + + function writeDouble_f64_cpy(val, buf, pos) { + f64[0] = val; + buf[pos ] = f8b[0]; + buf[pos + 1] = f8b[1]; + buf[pos + 2] = f8b[2]; + buf[pos + 3] = f8b[3]; + buf[pos + 4] = f8b[4]; + buf[pos + 5] = f8b[5]; + buf[pos + 6] = f8b[6]; + buf[pos + 7] = f8b[7]; + } + + function writeDouble_f64_rev(val, buf, pos) { + f64[0] = val; + buf[pos ] = f8b[7]; + buf[pos + 1] = f8b[6]; + buf[pos + 2] = f8b[5]; + buf[pos + 3] = f8b[4]; + buf[pos + 4] = f8b[3]; + buf[pos + 5] = f8b[2]; + buf[pos + 6] = f8b[1]; + buf[pos + 7] = f8b[0]; + } + + /* istanbul ignore next */ + exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev; + /* istanbul ignore next */ + exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy; + + function readDouble_f64_cpy(buf, pos) { + f8b[0] = buf[pos ]; + f8b[1] = buf[pos + 1]; + f8b[2] = buf[pos + 2]; + f8b[3] = buf[pos + 3]; + f8b[4] = buf[pos + 4]; + f8b[5] = buf[pos + 5]; + f8b[6] = buf[pos + 6]; + f8b[7] = buf[pos + 7]; + return f64[0]; + } + + function readDouble_f64_rev(buf, pos) { + f8b[7] = buf[pos ]; + f8b[6] = buf[pos + 1]; + f8b[5] = buf[pos + 2]; + f8b[4] = buf[pos + 3]; + f8b[3] = buf[pos + 4]; + f8b[2] = buf[pos + 5]; + f8b[1] = buf[pos + 6]; + f8b[0] = buf[pos + 7]; + return f64[0]; + } + + /* istanbul ignore next */ + exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev; + /* istanbul ignore next */ + exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy; + + // double: ieee754 + })(); else (function() { + + function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) { + var sign = val < 0 ? 1 : 0; + if (sign) + val = -val; + if (val === 0) { + writeUint(0, buf, pos + off0); + writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1); + } else if (isNaN(val)) { + writeUint(0, buf, pos + off0); + writeUint(2146959360, buf, pos + off1); + } else if (val > 1.7976931348623157e+308) { // +-Infinity + writeUint(0, buf, pos + off0); + writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1); + } else { + var mantissa; + if (val < 2.2250738585072014e-308) { // denormal + mantissa = val / 5e-324; + writeUint(mantissa >>> 0, buf, pos + off0); + writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1); + } else { + var exponent = Math.floor(Math.log(val) / Math.LN2); + if (exponent === 1024) + exponent = 1023; + mantissa = val * Math.pow(2, -exponent); + writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0); + writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1); + } + } + } + + exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4); + exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0); + + function readDouble_ieee754(readUint, off0, off1, buf, pos) { + var lo = readUint(buf, pos + off0), + hi = readUint(buf, pos + off1); + var sign = (hi >> 31) * 2 + 1, + exponent = hi >>> 20 & 2047, + mantissa = 4294967296 * (hi & 1048575) + lo; + return exponent === 2047 + ? mantissa + ? NaN + : sign * Infinity + : exponent === 0 // denormal + ? sign * 5e-324 * mantissa + : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496); + } + + exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4); + exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0); + + })(); + + return exports; +} + +// uint helpers + +function writeUintLE(val, buf, pos) { + buf[pos ] = val & 255; + buf[pos + 1] = val >>> 8 & 255; + buf[pos + 2] = val >>> 16 & 255; + buf[pos + 3] = val >>> 24; +} + +function writeUintBE(val, buf, pos) { + buf[pos ] = val >>> 24; + buf[pos + 1] = val >>> 16 & 255; + buf[pos + 2] = val >>> 8 & 255; + buf[pos + 3] = val & 255; +} + +function readUintLE(buf, pos) { + return (buf[pos ] + | buf[pos + 1] << 8 + | buf[pos + 2] << 16 + | buf[pos + 3] << 24) >>> 0; +} + +function readUintBE(buf, pos) { + return (buf[pos ] << 24 + | buf[pos + 1] << 16 + | buf[pos + 2] << 8 + | buf[pos + 3]) >>> 0; +} + + +/***/ }), + +/***/ "./node_modules/@protobufjs/inquire/index.js": +/*!***************************************************!*\ + !*** ./node_modules/@protobufjs/inquire/index.js ***! + \***************************************************/ +/***/ (function(module) { + +"use strict"; + +module.exports = inquire; + +/** + * Requires a module only if available. + * @memberof util + * @param {string} moduleName Module to require + * @returns {?Object} Required module if available and not empty, otherwise `null` + */ +function inquire(moduleName) { + try { + var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval + if (mod && (mod.length || Object.keys(mod).length)) + return mod; + } catch (e) {} // eslint-disable-line no-empty + return null; +} + + +/***/ }), + +/***/ "./node_modules/@protobufjs/path/index.js": +/*!************************************************!*\ + !*** ./node_modules/@protobufjs/path/index.js ***! + \************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + + +/** + * A minimal path module to resolve Unix, Windows and URL paths alike. + * @memberof util + * @namespace + */ +var path = exports; + +var isAbsolute = +/** + * Tests if the specified path is absolute. + * @param {string} path Path to test + * @returns {boolean} `true` if path is absolute + */ +path.isAbsolute = function isAbsolute(path) { + return /^(?:\/|\w+:)/.test(path); +}; + +var normalize = +/** + * Normalizes the specified path. + * @param {string} path Path to normalize + * @returns {string} Normalized path + */ +path.normalize = function normalize(path) { + path = path.replace(/\\/g, "/") + .replace(/\/{2,}/g, "/"); + var parts = path.split("/"), + absolute = isAbsolute(path), + prefix = ""; + if (absolute) + prefix = parts.shift() + "/"; + for (var i = 0; i < parts.length;) { + if (parts[i] === "..") { + if (i > 0 && parts[i - 1] !== "..") + parts.splice(--i, 2); + else if (absolute) + parts.splice(i, 1); + else + ++i; + } else if (parts[i] === ".") + parts.splice(i, 1); + else + ++i; + } + return prefix + parts.join("/"); +}; + +/** + * Resolves the specified include path against the specified origin path. + * @param {string} originPath Path to the origin file + * @param {string} includePath Include path relative to origin path + * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized + * @returns {string} Path to the include file + */ +path.resolve = function resolve(originPath, includePath, alreadyNormalized) { + if (!alreadyNormalized) + includePath = normalize(includePath); + if (isAbsolute(includePath)) + return includePath; + if (!alreadyNormalized) + originPath = normalize(originPath); + return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath; +}; + + +/***/ }), + +/***/ "./node_modules/@protobufjs/pool/index.js": +/*!************************************************!*\ + !*** ./node_modules/@protobufjs/pool/index.js ***! + \************************************************/ +/***/ (function(module) { + +"use strict"; + +module.exports = pool; + +/** + * An allocator as used by {@link util.pool}. + * @typedef PoolAllocator + * @type {function} + * @param {number} size Buffer size + * @returns {Uint8Array} Buffer + */ + +/** + * A slicer as used by {@link util.pool}. + * @typedef PoolSlicer + * @type {function} + * @param {number} start Start offset + * @param {number} end End offset + * @returns {Uint8Array} Buffer slice + * @this {Uint8Array} + */ + +/** + * A general purpose buffer pool. + * @memberof util + * @function + * @param {PoolAllocator} alloc Allocator + * @param {PoolSlicer} slice Slicer + * @param {number} [size=8192] Slab size + * @returns {PoolAllocator} Pooled allocator + */ +function pool(alloc, slice, size) { + var SIZE = size || 8192; + var MAX = SIZE >>> 1; + var slab = null; + var offset = SIZE; + return function pool_alloc(size) { + if (size < 1 || size > MAX) + return alloc(size); + if (offset + size > SIZE) { + slab = alloc(SIZE); + offset = 0; + } + var buf = slice.call(slab, offset, offset += size); + if (offset & 7) // align to 32 bit + offset = (offset | 7) + 1; + return buf; + }; +} + + +/***/ }), + +/***/ "./node_modules/@protobufjs/utf8/index.js": +/*!************************************************!*\ + !*** ./node_modules/@protobufjs/utf8/index.js ***! + \************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + + +/** + * A minimal UTF8 implementation for number arrays. + * @memberof util + * @namespace + */ +var utf8 = exports; + +/** + * Calculates the UTF8 byte length of a string. + * @param {string} string String + * @returns {number} Byte length + */ +utf8.length = function utf8_length(string) { + var len = 0, + c = 0; + for (var i = 0; i < string.length; ++i) { + c = string.charCodeAt(i); + if (c < 128) + len += 1; + else if (c < 2048) + len += 2; + else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) { + ++i; + len += 4; + } else + len += 3; + } + return len; +}; + +/** + * Reads UTF8 bytes as a string. + * @param {Uint8Array} buffer Source buffer + * @param {number} start Source start + * @param {number} end Source end + * @returns {string} String read + */ +utf8.read = function utf8_read(buffer, start, end) { + var len = end - start; + if (len < 1) + return ""; + var parts = null, + chunk = [], + i = 0, // char offset + t; // temporary + while (start < end) { + t = buffer[start++]; + if (t < 128) + chunk[i++] = t; + else if (t > 191 && t < 224) + chunk[i++] = (t & 31) << 6 | buffer[start++] & 63; + else if (t > 239 && t < 365) { + t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000; + chunk[i++] = 0xD800 + (t >> 10); + chunk[i++] = 0xDC00 + (t & 1023); + } else + chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; + if (i > 8191) { + (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); + i = 0; + } + } + if (parts) { + if (i) + parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); + return parts.join(""); + } + return String.fromCharCode.apply(String, chunk.slice(0, i)); +}; + +/** + * Writes a string as UTF8 bytes. + * @param {string} string Source string + * @param {Uint8Array} buffer Destination buffer + * @param {number} offset Destination offset + * @returns {number} Bytes written + */ +utf8.write = function utf8_write(string, buffer, offset) { + var start = offset, + c1, // character 1 + c2; // character 2 + for (var i = 0; i < string.length; ++i) { + c1 = string.charCodeAt(i); + if (c1 < 128) { + buffer[offset++] = c1; + } else if (c1 < 2048) { + buffer[offset++] = c1 >> 6 | 192; + buffer[offset++] = c1 & 63 | 128; + } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) { + c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); + ++i; + buffer[offset++] = c1 >> 18 | 240; + buffer[offset++] = c1 >> 12 & 63 | 128; + buffer[offset++] = c1 >> 6 & 63 | 128; + buffer[offset++] = c1 & 63 | 128; + } else { + buffer[offset++] = c1 >> 12 | 224; + buffer[offset++] = c1 >> 6 & 63 | 128; + buffer[offset++] = c1 & 63 | 128; + } + } + return offset - start; +}; + + +/***/ }), + +/***/ "./node_modules/@scure/base/lib/index.js": +/*!***********************************************!*\ + !*** ./node_modules/@scure/base/lib/index.js ***! + \***********************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.bytes = exports.stringToBytes = exports.str = exports.bytesToString = exports.hex = exports.utf8 = exports.bech32m = exports.bech32 = exports.base58check = exports.base58xmr = exports.base58xrp = exports.base58flickr = exports.base58 = exports.base64url = exports.base64 = exports.base32crockford = exports.base32hex = exports.base32 = exports.base16 = exports.utils = exports.assertNumber = void 0; +function assertNumber(n) { + if (!Number.isSafeInteger(n)) + throw new Error(`Wrong integer: ${n}`); +} +exports.assertNumber = assertNumber; +function chain(...args) { + const wrap = (a, b) => (c) => a(b(c)); + const encode = Array.from(args) + .reverse() + .reduce((acc, i) => (acc ? wrap(acc, i.encode) : i.encode), undefined); + const decode = args.reduce((acc, i) => (acc ? wrap(acc, i.decode) : i.decode), undefined); + return { encode, decode }; +} +function alphabet(alphabet) { + return { + encode: (digits) => { + if (!Array.isArray(digits) || (digits.length && typeof digits[0] !== 'number')) + throw new Error('alphabet.encode input should be an array of numbers'); + return digits.map((i) => { + assertNumber(i); + if (i < 0 || i >= alphabet.length) + throw new Error(`Digit index outside alphabet: ${i} (alphabet: ${alphabet.length})`); + return alphabet[i]; + }); + }, + decode: (input) => { + if (!Array.isArray(input) || (input.length && typeof input[0] !== 'string')) + throw new Error('alphabet.decode input should be array of strings'); + return input.map((letter) => { + if (typeof letter !== 'string') + throw new Error(`alphabet.decode: not string element=${letter}`); + const index = alphabet.indexOf(letter); + if (index === -1) + throw new Error(`Unknown letter: "${letter}". Allowed: ${alphabet}`); + return index; + }); + }, + }; +} +function join(separator = '') { + if (typeof separator !== 'string') + throw new Error('join separator should be string'); + return { + encode: (from) => { + if (!Array.isArray(from) || (from.length && typeof from[0] !== 'string')) + throw new Error('join.encode input should be array of strings'); + for (let i of from) + if (typeof i !== 'string') + throw new Error(`join.encode: non-string input=${i}`); + return from.join(separator); + }, + decode: (to) => { + if (typeof to !== 'string') + throw new Error('join.decode input should be string'); + return to.split(separator); + }, + }; +} +function padding(bits, chr = '=') { + assertNumber(bits); + if (typeof chr !== 'string') + throw new Error('padding chr should be string'); + return { + encode(data) { + if (!Array.isArray(data) || (data.length && typeof data[0] !== 'string')) + throw new Error('padding.encode input should be array of strings'); + for (let i of data) + if (typeof i !== 'string') + throw new Error(`padding.encode: non-string input=${i}`); + while ((data.length * bits) % 8) + data.push(chr); + return data; + }, + decode(input) { + if (!Array.isArray(input) || (input.length && typeof input[0] !== 'string')) + throw new Error('padding.encode input should be array of strings'); + for (let i of input) + if (typeof i !== 'string') + throw new Error(`padding.decode: non-string input=${i}`); + let end = input.length; + if ((end * bits) % 8) + throw new Error('Invalid padding: string should have whole number of bytes'); + for (; end > 0 && input[end - 1] === chr; end--) { + if (!(((end - 1) * bits) % 8)) + throw new Error('Invalid padding: string has too much padding'); + } + return input.slice(0, end); + }, + }; +} +function normalize(fn) { + if (typeof fn !== 'function') + throw new Error('normalize fn should be function'); + return { encode: (from) => from, decode: (to) => fn(to) }; +} +function convertRadix(data, from, to) { + if (from < 2) + throw new Error(`convertRadix: wrong from=${from}, base cannot be less than 2`); + if (to < 2) + throw new Error(`convertRadix: wrong to=${to}, base cannot be less than 2`); + if (!Array.isArray(data)) + throw new Error('convertRadix: data should be array'); + if (!data.length) + return []; + let pos = 0; + const res = []; + const digits = Array.from(data); + digits.forEach((d) => { + assertNumber(d); + if (d < 0 || d >= from) + throw new Error(`Wrong integer: ${d}`); + }); + while (true) { + let carry = 0; + let done = true; + for (let i = pos; i < digits.length; i++) { + const digit = digits[i]; + const digitBase = from * carry + digit; + if (!Number.isSafeInteger(digitBase) || + (from * carry) / from !== carry || + digitBase - digit !== from * carry) { + throw new Error('convertRadix: carry overflow'); + } + carry = digitBase % to; + digits[i] = Math.floor(digitBase / to); + if (!Number.isSafeInteger(digits[i]) || digits[i] * to + carry !== digitBase) + throw new Error('convertRadix: carry overflow'); + if (!done) + continue; + else if (!digits[i]) + pos = i; + else + done = false; + } + res.push(carry); + if (done) + break; + } + for (let i = 0; i < data.length - 1 && data[i] === 0; i++) + res.push(0); + return res.reverse(); +} +const gcd = (a, b) => (!b ? a : gcd(b, a % b)); +const radix2carry = (from, to) => from + (to - gcd(from, to)); +function convertRadix2(data, from, to, padding) { + if (!Array.isArray(data)) + throw new Error('convertRadix2: data should be array'); + if (from <= 0 || from > 32) + throw new Error(`convertRadix2: wrong from=${from}`); + if (to <= 0 || to > 32) + throw new Error(`convertRadix2: wrong to=${to}`); + if (radix2carry(from, to) > 32) { + throw new Error(`convertRadix2: carry overflow from=${from} to=${to} carryBits=${radix2carry(from, to)}`); + } + let carry = 0; + let pos = 0; + const mask = 2 ** to - 1; + const res = []; + for (const n of data) { + assertNumber(n); + if (n >= 2 ** from) + throw new Error(`convertRadix2: invalid data word=${n} from=${from}`); + carry = (carry << from) | n; + if (pos + from > 32) + throw new Error(`convertRadix2: carry overflow pos=${pos} from=${from}`); + pos += from; + for (; pos >= to; pos -= to) + res.push(((carry >> (pos - to)) & mask) >>> 0); + carry &= 2 ** pos - 1; + } + carry = (carry << (to - pos)) & mask; + if (!padding && pos >= from) + throw new Error('Excess padding'); + if (!padding && carry) + throw new Error(`Non-zero padding: ${carry}`); + if (padding && pos > 0) + res.push(carry >>> 0); + return res; +} +function radix(num) { + assertNumber(num); + return { + encode: (bytes) => { + if (!(bytes instanceof Uint8Array)) + throw new Error('radix.encode input should be Uint8Array'); + return convertRadix(Array.from(bytes), 2 ** 8, num); + }, + decode: (digits) => { + if (!Array.isArray(digits) || (digits.length && typeof digits[0] !== 'number')) + throw new Error('radix.decode input should be array of strings'); + return Uint8Array.from(convertRadix(digits, num, 2 ** 8)); + }, + }; +} +function radix2(bits, revPadding = false) { + assertNumber(bits); + if (bits <= 0 || bits > 32) + throw new Error('radix2: bits should be in (0..32]'); + if (radix2carry(8, bits) > 32 || radix2carry(bits, 8) > 32) + throw new Error('radix2: carry overflow'); + return { + encode: (bytes) => { + if (!(bytes instanceof Uint8Array)) + throw new Error('radix2.encode input should be Uint8Array'); + return convertRadix2(Array.from(bytes), 8, bits, !revPadding); + }, + decode: (digits) => { + if (!Array.isArray(digits) || (digits.length && typeof digits[0] !== 'number')) + throw new Error('radix2.decode input should be array of strings'); + return Uint8Array.from(convertRadix2(digits, bits, 8, revPadding)); + }, + }; +} +function unsafeWrapper(fn) { + if (typeof fn !== 'function') + throw new Error('unsafeWrapper fn should be function'); + return function (...args) { + try { + return fn.apply(null, args); + } + catch (e) { } + }; +} +function checksum(len, fn) { + assertNumber(len); + if (typeof fn !== 'function') + throw new Error('checksum fn should be function'); + return { + encode(data) { + if (!(data instanceof Uint8Array)) + throw new Error('checksum.encode: input should be Uint8Array'); + const checksum = fn(data).slice(0, len); + const res = new Uint8Array(data.length + len); + res.set(data); + res.set(checksum, data.length); + return res; + }, + decode(data) { + if (!(data instanceof Uint8Array)) + throw new Error('checksum.decode: input should be Uint8Array'); + const payload = data.slice(0, -len); + const newChecksum = fn(payload).slice(0, len); + const oldChecksum = data.slice(-len); + for (let i = 0; i < len; i++) + if (newChecksum[i] !== oldChecksum[i]) + throw new Error('Invalid checksum'); + return payload; + }, + }; +} +exports.utils = { alphabet, chain, checksum, radix, radix2, join, padding }; +exports.base16 = chain(radix2(4), alphabet('0123456789ABCDEF'), join('')); +exports.base32 = chain(radix2(5), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'), padding(5), join('')); +exports.base32hex = chain(radix2(5), alphabet('0123456789ABCDEFGHIJKLMNOPQRSTUV'), padding(5), join('')); +exports.base32crockford = chain(radix2(5), alphabet('0123456789ABCDEFGHJKMNPQRSTVWXYZ'), join(''), normalize((s) => s.toUpperCase().replace(/O/g, '0').replace(/[IL]/g, '1'))); +exports.base64 = chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'), padding(6), join('')); +exports.base64url = chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'), padding(6), join('')); +const genBase58 = (abc) => chain(radix(58), alphabet(abc), join('')); +exports.base58 = genBase58('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'); +exports.base58flickr = genBase58('123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'); +exports.base58xrp = genBase58('rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz'); +const XMR_BLOCK_LEN = [0, 2, 3, 5, 6, 7, 9, 10, 11]; +exports.base58xmr = { + encode(data) { + let res = ''; + for (let i = 0; i < data.length; i += 8) { + const block = data.subarray(i, i + 8); + res += exports.base58.encode(block).padStart(XMR_BLOCK_LEN[block.length], '1'); + } + return res; + }, + decode(str) { + let res = []; + for (let i = 0; i < str.length; i += 11) { + const slice = str.slice(i, i + 11); + const blockLen = XMR_BLOCK_LEN.indexOf(slice.length); + const block = exports.base58.decode(slice); + for (let j = 0; j < block.length - blockLen; j++) { + if (block[j] !== 0) + throw new Error('base58xmr: wrong padding'); + } + res = res.concat(Array.from(block.slice(block.length - blockLen))); + } + return Uint8Array.from(res); + }, +}; +const base58check = (sha256) => chain(checksum(4, (data) => sha256(sha256(data))), exports.base58); +exports.base58check = base58check; +const BECH_ALPHABET = chain(alphabet('qpzry9x8gf2tvdw0s3jn54khce6mua7l'), join('')); +const POLYMOD_GENERATORS = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3]; +function bech32Polymod(pre) { + const b = pre >> 25; + let chk = (pre & 0x1ffffff) << 5; + for (let i = 0; i < POLYMOD_GENERATORS.length; i++) { + if (((b >> i) & 1) === 1) + chk ^= POLYMOD_GENERATORS[i]; + } + return chk; +} +function bechChecksum(prefix, words, encodingConst = 1) { + const len = prefix.length; + let chk = 1; + for (let i = 0; i < len; i++) { + const c = prefix.charCodeAt(i); + if (c < 33 || c > 126) + throw new Error(`Invalid prefix (${prefix})`); + chk = bech32Polymod(chk) ^ (c >> 5); + } + chk = bech32Polymod(chk); + for (let i = 0; i < len; i++) + chk = bech32Polymod(chk) ^ (prefix.charCodeAt(i) & 0x1f); + for (let v of words) + chk = bech32Polymod(chk) ^ v; + for (let i = 0; i < 6; i++) + chk = bech32Polymod(chk); + chk ^= encodingConst; + return BECH_ALPHABET.encode(convertRadix2([chk % 2 ** 30], 30, 5, false)); +} +function genBech32(encoding) { + const ENCODING_CONST = encoding === 'bech32' ? 1 : 0x2bc830a3; + const _words = radix2(5); + const fromWords = _words.decode; + const toWords = _words.encode; + const fromWordsUnsafe = unsafeWrapper(fromWords); + function encode(prefix, words, limit = 90) { + if (typeof prefix !== 'string') + throw new Error(`bech32.encode prefix should be string, not ${typeof prefix}`); + if (!Array.isArray(words) || (words.length && typeof words[0] !== 'number')) + throw new Error(`bech32.encode words should be array of numbers, not ${typeof words}`); + const actualLength = prefix.length + 7 + words.length; + if (limit !== false && actualLength > limit) + throw new TypeError(`Length ${actualLength} exceeds limit ${limit}`); + prefix = prefix.toLowerCase(); + return `${prefix}1${BECH_ALPHABET.encode(words)}${bechChecksum(prefix, words, ENCODING_CONST)}`; + } + function decode(str, limit = 90) { + if (typeof str !== 'string') + throw new Error(`bech32.decode input should be string, not ${typeof str}`); + if (str.length < 8 || (limit !== false && str.length > limit)) + throw new TypeError(`Wrong string length: ${str.length} (${str}). Expected (8..${limit})`); + const lowered = str.toLowerCase(); + if (str !== lowered && str !== str.toUpperCase()) + throw new Error(`String must be lowercase or uppercase`); + str = lowered; + const sepIndex = str.lastIndexOf('1'); + if (sepIndex === 0 || sepIndex === -1) + throw new Error(`Letter "1" must be present between prefix and data only`); + const prefix = str.slice(0, sepIndex); + const _words = str.slice(sepIndex + 1); + if (_words.length < 6) + throw new Error('Data must be at least 6 characters long'); + const words = BECH_ALPHABET.decode(_words).slice(0, -6); + const sum = bechChecksum(prefix, words, ENCODING_CONST); + if (!_words.endsWith(sum)) + throw new Error(`Invalid checksum in ${str}: expected "${sum}"`); + return { prefix, words }; + } + const decodeUnsafe = unsafeWrapper(decode); + function decodeToBytes(str) { + const { prefix, words } = decode(str, false); + return { prefix, words, bytes: fromWords(words) }; + } + return { encode, decode, decodeToBytes, decodeUnsafe, fromWords, fromWordsUnsafe, toWords }; +} +exports.bech32 = genBech32('bech32'); +exports.bech32m = genBech32('bech32m'); +exports.utf8 = { + encode: (data) => new TextDecoder().decode(data), + decode: (str) => new TextEncoder().encode(str), +}; +exports.hex = chain(radix2(4), alphabet('0123456789abcdef'), join(''), normalize((s) => { + if (typeof s !== 'string' || s.length % 2) + throw new TypeError(`hex.decode: expected string, got ${typeof s} with length ${s.length}`); + return s.toLowerCase(); +})); +const CODERS = { + utf8: exports.utf8, hex: exports.hex, base16: exports.base16, base32: exports.base32, base64: exports.base64, base64url: exports.base64url, base58: exports.base58, base58xmr: exports.base58xmr +}; +const coderTypeError = `Invalid encoding type. Available types: ${Object.keys(CODERS).join(', ')}`; +const bytesToString = (type, bytes) => { + if (typeof type !== 'string' || !CODERS.hasOwnProperty(type)) + throw new TypeError(coderTypeError); + if (!(bytes instanceof Uint8Array)) + throw new TypeError('bytesToString() expects Uint8Array'); + return CODERS[type].encode(bytes); +}; +exports.bytesToString = bytesToString; +exports.str = exports.bytesToString; +const stringToBytes = (type, str) => { + if (!CODERS.hasOwnProperty(type)) + throw new TypeError(coderTypeError); + if (typeof str !== 'string') + throw new TypeError('stringToBytes() expects string'); + return CODERS[type].decode(str); +}; +exports.stringToBytes = stringToBytes; +exports.bytes = exports.stringToBytes; + + +/***/ }), + +/***/ "./node_modules/@scure/bip32/lib/index.js": +/*!************************************************!*\ + !*** ./node_modules/@scure/bip32/lib/index.js ***! + \************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.HDKey = exports.HARDENED_OFFSET = void 0; +const hmac_1 = __webpack_require__(/*! @noble/hashes/hmac */ "./node_modules/@noble/hashes/hmac.js"); +const ripemd160_1 = __webpack_require__(/*! @noble/hashes/ripemd160 */ "./node_modules/@noble/hashes/ripemd160.js"); +const sha256_1 = __webpack_require__(/*! @noble/hashes/sha256 */ "./node_modules/@noble/hashes/sha256.js"); +const sha512_1 = __webpack_require__(/*! @noble/hashes/sha512 */ "./node_modules/@noble/hashes/sha512.js"); +const _assert_1 = __webpack_require__(/*! @noble/hashes/_assert */ "./node_modules/@noble/hashes/_assert.js"); +const utils_1 = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js"); +const secp256k1_1 = __webpack_require__(/*! @noble/curves/secp256k1 */ "./node_modules/@noble/curves/secp256k1.js"); +const modular_1 = __webpack_require__(/*! @noble/curves/abstract/modular */ "./node_modules/@noble/curves/abstract/modular.js"); +const base_1 = __webpack_require__(/*! @scure/base */ "./node_modules/@scure/base/lib/index.js"); +const Point = secp256k1_1.secp256k1.ProjectivePoint; +const base58check = (0, base_1.base58check)(sha256_1.sha256); +function bytesToNumber(bytes) { + return BigInt(`0x${(0, utils_1.bytesToHex)(bytes)}`); +} +function numberToBytes(num) { + return (0, utils_1.hexToBytes)(num.toString(16).padStart(64, '0')); +} +const MASTER_SECRET = (0, utils_1.utf8ToBytes)('Bitcoin seed'); +const BITCOIN_VERSIONS = { private: 0x0488ade4, public: 0x0488b21e }; +exports.HARDENED_OFFSET = 0x80000000; +const hash160 = (data) => (0, ripemd160_1.ripemd160)((0, sha256_1.sha256)(data)); +const fromU32 = (data) => (0, utils_1.createView)(data).getUint32(0, false); +const toU32 = (n) => { + if (!Number.isSafeInteger(n) || n < 0 || n > 2 ** 32 - 1) { + throw new Error(`Invalid number=${n}. Should be from 0 to 2 ** 32 - 1`); + } + const buf = new Uint8Array(4); + (0, utils_1.createView)(buf).setUint32(0, n, false); + return buf; +}; +class HDKey { + get fingerprint() { + if (!this.pubHash) { + throw new Error('No publicKey set!'); + } + return fromU32(this.pubHash); + } + get identifier() { + return this.pubHash; + } + get pubKeyHash() { + return this.pubHash; + } + get privateKey() { + return this.privKeyBytes || null; + } + get publicKey() { + return this.pubKey || null; + } + get privateExtendedKey() { + const priv = this.privateKey; + if (!priv) { + throw new Error('No private key'); + } + return base58check.encode(this.serialize(this.versions.private, (0, utils_1.concatBytes)(new Uint8Array([0]), priv))); + } + get publicExtendedKey() { + if (!this.pubKey) { + throw new Error('No public key'); + } + return base58check.encode(this.serialize(this.versions.public, this.pubKey)); + } + static fromMasterSeed(seed, versions = BITCOIN_VERSIONS) { + (0, _assert_1.bytes)(seed); + if (8 * seed.length < 128 || 8 * seed.length > 512) { + throw new Error(`HDKey: wrong seed length=${seed.length}. Should be between 128 and 512 bits; 256 bits is advised)`); + } + const I = (0, hmac_1.hmac)(sha512_1.sha512, MASTER_SECRET, seed); + return new HDKey({ + versions, + chainCode: I.slice(32), + privateKey: I.slice(0, 32), + }); + } + static fromExtendedKey(base58key, versions = BITCOIN_VERSIONS) { + const keyBuffer = base58check.decode(base58key); + const keyView = (0, utils_1.createView)(keyBuffer); + const version = keyView.getUint32(0, false); + const opt = { + versions, + depth: keyBuffer[4], + parentFingerprint: keyView.getUint32(5, false), + index: keyView.getUint32(9, false), + chainCode: keyBuffer.slice(13, 45), + }; + const key = keyBuffer.slice(45); + const isPriv = key[0] === 0; + if (version !== versions[isPriv ? 'private' : 'public']) { + throw new Error('Version mismatch'); + } + if (isPriv) { + return new HDKey({ ...opt, privateKey: key.slice(1) }); + } + else { + return new HDKey({ ...opt, publicKey: key }); + } + } + static fromJSON(json) { + return HDKey.fromExtendedKey(json.xpriv); + } + constructor(opt) { + this.depth = 0; + this.index = 0; + this.chainCode = null; + this.parentFingerprint = 0; + if (!opt || typeof opt !== 'object') { + throw new Error('HDKey.constructor must not be called directly'); + } + this.versions = opt.versions || BITCOIN_VERSIONS; + this.depth = opt.depth || 0; + this.chainCode = opt.chainCode; + this.index = opt.index || 0; + this.parentFingerprint = opt.parentFingerprint || 0; + if (!this.depth) { + if (this.parentFingerprint || this.index) { + throw new Error('HDKey: zero depth with non-zero index/parent fingerprint'); + } + } + if (opt.publicKey && opt.privateKey) { + throw new Error('HDKey: publicKey and privateKey at same time.'); + } + if (opt.privateKey) { + if (!secp256k1_1.secp256k1.utils.isValidPrivateKey(opt.privateKey)) { + throw new Error('Invalid private key'); + } + this.privKey = + typeof opt.privateKey === 'bigint' ? opt.privateKey : bytesToNumber(opt.privateKey); + this.privKeyBytes = numberToBytes(this.privKey); + this.pubKey = secp256k1_1.secp256k1.getPublicKey(opt.privateKey, true); + } + else if (opt.publicKey) { + this.pubKey = Point.fromHex(opt.publicKey).toRawBytes(true); + } + else { + throw new Error('HDKey: no public or private key provided'); + } + this.pubHash = hash160(this.pubKey); + } + derive(path) { + if (!/^[mM]'?/.test(path)) { + throw new Error('Path must start with "m" or "M"'); + } + if (/^[mM]'?$/.test(path)) { + return this; + } + const parts = path.replace(/^[mM]'?\//, '').split('/'); + let child = this; + for (const c of parts) { + const m = /^(\d+)('?)$/.exec(c); + if (!m || m.length !== 3) { + throw new Error(`Invalid child index: ${c}`); + } + let idx = +m[1]; + if (!Number.isSafeInteger(idx) || idx >= exports.HARDENED_OFFSET) { + throw new Error('Invalid index'); + } + if (m[2] === "'") { + idx += exports.HARDENED_OFFSET; + } + child = child.deriveChild(idx); + } + return child; + } + deriveChild(index) { + if (!this.pubKey || !this.chainCode) { + throw new Error('No publicKey or chainCode set'); + } + let data = toU32(index); + if (index >= exports.HARDENED_OFFSET) { + const priv = this.privateKey; + if (!priv) { + throw new Error('Could not derive hardened child key'); + } + data = (0, utils_1.concatBytes)(new Uint8Array([0]), priv, data); + } + else { + data = (0, utils_1.concatBytes)(this.pubKey, data); + } + const I = (0, hmac_1.hmac)(sha512_1.sha512, this.chainCode, data); + const childTweak = bytesToNumber(I.slice(0, 32)); + const chainCode = I.slice(32); + if (!secp256k1_1.secp256k1.utils.isValidPrivateKey(childTweak)) { + throw new Error('Tweak bigger than curve order'); + } + const opt = { + versions: this.versions, + chainCode, + depth: this.depth + 1, + parentFingerprint: this.fingerprint, + index, + }; + try { + if (this.privateKey) { + const added = (0, modular_1.mod)(this.privKey + childTweak, secp256k1_1.secp256k1.CURVE.n); + if (!secp256k1_1.secp256k1.utils.isValidPrivateKey(added)) { + throw new Error('The tweak was out of range or the resulted private key is invalid'); + } + opt.privateKey = added; + } + else { + const added = Point.fromHex(this.pubKey).add(Point.fromPrivateKey(childTweak)); + if (added.equals(Point.ZERO)) { + throw new Error('The tweak was equal to negative P, which made the result key invalid'); + } + opt.publicKey = added.toRawBytes(true); + } + return new HDKey(opt); + } + catch (err) { + return this.deriveChild(index + 1); + } + } + sign(hash) { + if (!this.privateKey) { + throw new Error('No privateKey set!'); + } + (0, _assert_1.bytes)(hash, 32); + return secp256k1_1.secp256k1.sign(hash, this.privKey).toCompactRawBytes(); + } + verify(hash, signature) { + (0, _assert_1.bytes)(hash, 32); + (0, _assert_1.bytes)(signature, 64); + if (!this.publicKey) { + throw new Error('No publicKey set!'); + } + let sig; + try { + sig = secp256k1_1.secp256k1.Signature.fromCompact(signature); + } + catch (error) { + return false; + } + return secp256k1_1.secp256k1.verify(sig, hash, this.publicKey); + } + wipePrivateData() { + this.privKey = undefined; + if (this.privKeyBytes) { + this.privKeyBytes.fill(0); + this.privKeyBytes = undefined; + } + return this; + } + toJSON() { + return { + xpriv: this.privateExtendedKey, + xpub: this.publicExtendedKey, + }; + } + serialize(version, key) { + if (!this.chainCode) { + throw new Error('No chainCode set'); + } + (0, _assert_1.bytes)(key, 33); + return (0, utils_1.concatBytes)(toU32(version), new Uint8Array([this.depth]), toU32(this.parentFingerprint), toU32(this.index), this.chainCode, key); + } +} +exports.HDKey = HDKey; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@scure/bip39/index.js": +/*!********************************************!*\ + !*** ./node_modules/@scure/bip39/index.js ***! + \********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.mnemonicToSeedSync = exports.mnemonicToSeed = exports.validateMnemonic = exports.entropyToMnemonic = exports.mnemonicToEntropy = exports.generateMnemonic = void 0; +/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */ +const _assert_1 = __webpack_require__(/*! @noble/hashes/_assert */ "./node_modules/@noble/hashes/_assert.js"); +const pbkdf2_1 = __webpack_require__(/*! @noble/hashes/pbkdf2 */ "./node_modules/@noble/hashes/pbkdf2.js"); +const sha256_1 = __webpack_require__(/*! @noble/hashes/sha256 */ "./node_modules/@noble/hashes/sha256.js"); +const sha512_1 = __webpack_require__(/*! @noble/hashes/sha512 */ "./node_modules/@noble/hashes/sha512.js"); +const utils_1 = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js"); +const base_1 = __webpack_require__(/*! @scure/base */ "./node_modules/@scure/base/lib/index.js"); +// Japanese wordlist +const isJapanese = (wordlist) => wordlist[0] === '\u3042\u3044\u3053\u304f\u3057\u3093'; +// Normalization replaces equivalent sequences of characters +// so that any two texts that are equivalent will be reduced +// to the same sequence of code points, called the normal form of the original text. +function nfkd(str) { + if (typeof str !== 'string') + throw new TypeError(`Invalid mnemonic type: ${typeof str}`); + return str.normalize('NFKD'); +} +function normalize(str) { + const norm = nfkd(str); + const words = norm.split(' '); + if (![12, 15, 18, 21, 24].includes(words.length)) + throw new Error('Invalid mnemonic'); + return { nfkd: norm, words }; +} +function assertEntropy(entropy) { + _assert_1.default.bytes(entropy, 16, 20, 24, 28, 32); +} +/** + * Generate x random words. Uses Cryptographically-Secure Random Number Generator. + * @param wordlist imported wordlist for specific language + * @param strength mnemonic strength 128-256 bits + * @example + * generateMnemonic(wordlist, 128) + * // 'legal winner thank year wave sausage worth useful legal winner thank yellow' + */ +function generateMnemonic(wordlist, strength = 128) { + _assert_1.default.number(strength); + if (strength % 32 !== 0 || strength > 256) + throw new TypeError('Invalid entropy'); + return entropyToMnemonic((0, utils_1.randomBytes)(strength / 8), wordlist); +} +exports.generateMnemonic = generateMnemonic; +const calcChecksum = (entropy) => { + // Checksum is ent.length/4 bits long + const bitsLeft = 8 - entropy.length / 4; + // Zero rightmost "bitsLeft" bits in byte + // For example: bitsLeft=4 val=10111101 -> 10110000 + return new Uint8Array([((0, sha256_1.sha256)(entropy)[0] >> bitsLeft) << bitsLeft]); +}; +function getCoder(wordlist) { + if (!Array.isArray(wordlist) || wordlist.length !== 2048 || typeof wordlist[0] !== 'string') + throw new Error('Worlist: expected array of 2048 strings'); + wordlist.forEach((i) => { + if (typeof i !== 'string') + throw new Error(`Wordlist: non-string element: ${i}`); + }); + return base_1.utils.chain(base_1.utils.checksum(1, calcChecksum), base_1.utils.radix2(11, true), base_1.utils.alphabet(wordlist)); +} +/** + * Reversible: Converts mnemonic string to raw entropy in form of byte array. + * @param mnemonic 12-24 words + * @param wordlist imported wordlist for specific language + * @example + * const mnem = 'legal winner thank year wave sausage worth useful legal winner thank yellow'; + * mnemonicToEntropy(mnem, wordlist) + * // Produces + * new Uint8Array([ + * 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, + * 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f + * ]) + */ +function mnemonicToEntropy(mnemonic, wordlist) { + const { words } = normalize(mnemonic); + const entropy = getCoder(wordlist).decode(words); + assertEntropy(entropy); + return entropy; +} +exports.mnemonicToEntropy = mnemonicToEntropy; +/** + * Reversible: Converts raw entropy in form of byte array to mnemonic string. + * @param entropy byte array + * @param wordlist imported wordlist for specific language + * @returns 12-24 words + * @example + * const ent = new Uint8Array([ + * 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, + * 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f + * ]); + * entropyToMnemonic(ent, wordlist); + * // 'legal winner thank year wave sausage worth useful legal winner thank yellow' + */ +function entropyToMnemonic(entropy, wordlist) { + assertEntropy(entropy); + const words = getCoder(wordlist).encode(entropy); + return words.join(isJapanese(wordlist) ? '\u3000' : ' '); +} +exports.entropyToMnemonic = entropyToMnemonic; +/** + * Validates mnemonic for being 12-24 words contained in `wordlist`. + */ +function validateMnemonic(mnemonic, wordlist) { + try { + mnemonicToEntropy(mnemonic, wordlist); + } + catch (e) { + return false; + } + return true; +} +exports.validateMnemonic = validateMnemonic; +const salt = (passphrase) => nfkd(`mnemonic${passphrase}`); +/** + * Irreversible: Uses KDF to derive 64 bytes of key data from mnemonic + optional password. + * @param mnemonic 12-24 words + * @param passphrase string that will additionally protect the key + * @returns 64 bytes of key data + * @example + * const mnem = 'legal winner thank year wave sausage worth useful legal winner thank yellow'; + * await mnemonicToSeed(mnem, 'password'); + * // new Uint8Array([...64 bytes]) + */ +function mnemonicToSeed(mnemonic, passphrase = '') { + return (0, pbkdf2_1.pbkdf2Async)(sha512_1.sha512, normalize(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 }); +} +exports.mnemonicToSeed = mnemonicToSeed; +/** + * Irreversible: Uses KDF to derive 64 bytes of key data from mnemonic + optional password. + * @param mnemonic 12-24 words + * @param passphrase string that will additionally protect the key + * @returns 64 bytes of key data + * @example + * const mnem = 'legal winner thank year wave sausage worth useful legal winner thank yellow'; + * mnemonicToSeedSync(mnem, 'password'); + * // new Uint8Array([...64 bytes]) + */ +function mnemonicToSeedSync(mnemonic, passphrase = '') { + return (0, pbkdf2_1.pbkdf2)(sha512_1.sha512, normalize(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 }); +} +exports.mnemonicToSeedSync = mnemonicToSeedSync; + + +/***/ }), + +/***/ "./node_modules/@scure/bip39/wordlists/english.js": +/*!********************************************************!*\ + !*** ./node_modules/@scure/bip39/wordlists/english.js ***! + \********************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.wordlist = void 0; +exports.wordlist = `abandon +ability +able +about +above +absent +absorb +abstract +absurd +abuse +access +accident +account +accuse +achieve +acid +acoustic +acquire +across +act +action +actor +actress +actual +adapt +add +addict +address +adjust +admit +adult +advance +advice +aerobic +affair +afford +afraid +again +age +agent +agree +ahead +aim +air +airport +aisle +alarm +album +alcohol +alert +alien +all +alley +allow +almost +alone +alpha +already +also +alter +always +amateur +amazing +among +amount +amused +analyst +anchor +ancient +anger +angle +angry +animal +ankle +announce +annual +another +answer +antenna +antique +anxiety +any +apart +apology +appear +apple +approve +april +arch +arctic +area +arena +argue +arm +armed +armor +army +around +arrange +arrest +arrive +arrow +art +artefact +artist +artwork +ask +aspect +assault +asset +assist +assume +asthma +athlete +atom +attack +attend +attitude +attract +auction +audit +august +aunt +author +auto +autumn +average +avocado +avoid +awake +aware +away +awesome +awful +awkward +axis +baby +bachelor +bacon +badge +bag +balance +balcony +ball +bamboo +banana +banner +bar +barely +bargain +barrel +base +basic +basket +battle +beach +bean +beauty +because +become +beef +before +begin +behave +behind +believe +below +belt +bench +benefit +best +betray +better +between +beyond +bicycle +bid +bike +bind +biology +bird +birth +bitter +black +blade +blame +blanket +blast +bleak +bless +blind +blood +blossom +blouse +blue +blur +blush +board +boat +body +boil +bomb +bone +bonus +book +boost +border +boring +borrow +boss +bottom +bounce +box +boy +bracket +brain +brand +brass +brave +bread +breeze +brick +bridge +brief +bright +bring +brisk +broccoli +broken +bronze +broom +brother +brown +brush +bubble +buddy +budget +buffalo +build +bulb +bulk +bullet +bundle +bunker +burden +burger +burst +bus +business +busy +butter +buyer +buzz +cabbage +cabin +cable +cactus +cage +cake +call +calm +camera +camp +can +canal +cancel +candy +cannon +canoe +canvas +canyon +capable +capital +captain +car +carbon +card +cargo +carpet +carry +cart +case +cash +casino +castle +casual +cat +catalog +catch +category +cattle +caught +cause +caution +cave +ceiling +celery +cement +census +century +cereal +certain +chair +chalk +champion +change +chaos +chapter +charge +chase +chat +cheap +check +cheese +chef +cherry +chest +chicken +chief +child +chimney +choice +choose +chronic +chuckle +chunk +churn +cigar +cinnamon +circle +citizen +city +civil +claim +clap +clarify +claw +clay +clean +clerk +clever +click +client +cliff +climb +clinic +clip +clock +clog +close +cloth +cloud +clown +club +clump +cluster +clutch +coach +coast +coconut +code +coffee +coil +coin +collect +color +column +combine +come +comfort +comic +common +company +concert +conduct +confirm +congress +connect +consider +control +convince +cook +cool +copper +copy +coral +core +corn +correct +cost +cotton +couch +country +couple +course +cousin +cover +coyote +crack +cradle +craft +cram +crane +crash +crater +crawl +crazy +cream +credit +creek +crew +cricket +crime +crisp +critic +crop +cross +crouch +crowd +crucial +cruel +cruise +crumble +crunch +crush +cry +crystal +cube +culture +cup +cupboard +curious +current +curtain +curve +cushion +custom +cute +cycle +dad +damage +damp +dance +danger +daring +dash +daughter +dawn +day +deal +debate +debris +decade +december +decide +decline +decorate +decrease +deer +defense +define +defy +degree +delay +deliver +demand +demise +denial +dentist +deny +depart +depend +deposit +depth +deputy +derive +describe +desert +design +desk +despair +destroy +detail +detect +develop +device +devote +diagram +dial +diamond +diary +dice +diesel +diet +differ +digital +dignity +dilemma +dinner +dinosaur +direct +dirt +disagree +discover +disease +dish +dismiss +disorder +display +distance +divert +divide +divorce +dizzy +doctor +document +dog +doll +dolphin +domain +donate +donkey +donor +door +dose +double +dove +draft +dragon +drama +drastic +draw +dream +dress +drift +drill +drink +drip +drive +drop +drum +dry +duck +dumb +dune +during +dust +dutch +duty +dwarf +dynamic +eager +eagle +early +earn +earth +easily +east +easy +echo +ecology +economy +edge +edit +educate +effort +egg +eight +either +elbow +elder +electric +elegant +element +elephant +elevator +elite +else +embark +embody +embrace +emerge +emotion +employ +empower +empty +enable +enact +end +endless +endorse +enemy +energy +enforce +engage +engine +enhance +enjoy +enlist +enough +enrich +enroll +ensure +enter +entire +entry +envelope +episode +equal +equip +era +erase +erode +erosion +error +erupt +escape +essay +essence +estate +eternal +ethics +evidence +evil +evoke +evolve +exact +example +excess +exchange +excite +exclude +excuse +execute +exercise +exhaust +exhibit +exile +exist +exit +exotic +expand +expect +expire +explain +expose +express +extend +extra +eye +eyebrow +fabric +face +faculty +fade +faint +faith +fall +false +fame +family +famous +fan +fancy +fantasy +farm +fashion +fat +fatal +father +fatigue +fault +favorite +feature +february +federal +fee +feed +feel +female +fence +festival +fetch +fever +few +fiber +fiction +field +figure +file +film +filter +final +find +fine +finger +finish +fire +firm +first +fiscal +fish +fit +fitness +fix +flag +flame +flash +flat +flavor +flee +flight +flip +float +flock +floor +flower +fluid +flush +fly +foam +focus +fog +foil +fold +follow +food +foot +force +forest +forget +fork +fortune +forum +forward +fossil +foster +found +fox +fragile +frame +frequent +fresh +friend +fringe +frog +front +frost +frown +frozen +fruit +fuel +fun +funny +furnace +fury +future +gadget +gain +galaxy +gallery +game +gap +garage +garbage +garden +garlic +garment +gas +gasp +gate +gather +gauge +gaze +general +genius +genre +gentle +genuine +gesture +ghost +giant +gift +giggle +ginger +giraffe +girl +give +glad +glance +glare +glass +glide +glimpse +globe +gloom +glory +glove +glow +glue +goat +goddess +gold +good +goose +gorilla +gospel +gossip +govern +gown +grab +grace +grain +grant +grape +grass +gravity +great +green +grid +grief +grit +grocery +group +grow +grunt +guard +guess +guide +guilt +guitar +gun +gym +habit +hair +half +hammer +hamster +hand +happy +harbor +hard +harsh +harvest +hat +have +hawk +hazard +head +health +heart +heavy +hedgehog +height +hello +helmet +help +hen +hero +hidden +high +hill +hint +hip +hire +history +hobby +hockey +hold +hole +holiday +hollow +home +honey +hood +hope +horn +horror +horse +hospital +host +hotel +hour +hover +hub +huge +human +humble +humor +hundred +hungry +hunt +hurdle +hurry +hurt +husband +hybrid +ice +icon +idea +identify +idle +ignore +ill +illegal +illness +image +imitate +immense +immune +impact +impose +improve +impulse +inch +include +income +increase +index +indicate +indoor +industry +infant +inflict +inform +inhale +inherit +initial +inject +injury +inmate +inner +innocent +input +inquiry +insane +insect +inside +inspire +install +intact +interest +into +invest +invite +involve +iron +island +isolate +issue +item +ivory +jacket +jaguar +jar +jazz +jealous +jeans +jelly +jewel +job +join +joke +journey +joy +judge +juice +jump +jungle +junior +junk +just +kangaroo +keen +keep +ketchup +key +kick +kid +kidney +kind +kingdom +kiss +kit +kitchen +kite +kitten +kiwi +knee +knife +knock +know +lab +label +labor +ladder +lady +lake +lamp +language +laptop +large +later +latin +laugh +laundry +lava +law +lawn +lawsuit +layer +lazy +leader +leaf +learn +leave +lecture +left +leg +legal +legend +leisure +lemon +lend +length +lens +leopard +lesson +letter +level +liar +liberty +library +license +life +lift +light +like +limb +limit +link +lion +liquid +list +little +live +lizard +load +loan +lobster +local +lock +logic +lonely +long +loop +lottery +loud +lounge +love +loyal +lucky +luggage +lumber +lunar +lunch +luxury +lyrics +machine +mad +magic +magnet +maid +mail +main +major +make +mammal +man +manage +mandate +mango +mansion +manual +maple +marble +march +margin +marine +market +marriage +mask +mass +master +match +material +math +matrix +matter +maximum +maze +meadow +mean +measure +meat +mechanic +medal +media +melody +melt +member +memory +mention +menu +mercy +merge +merit +merry +mesh +message +metal +method +middle +midnight +milk +million +mimic +mind +minimum +minor +minute +miracle +mirror +misery +miss +mistake +mix +mixed +mixture +mobile +model +modify +mom +moment +monitor +monkey +monster +month +moon +moral +more +morning +mosquito +mother +motion +motor +mountain +mouse +move +movie +much +muffin +mule +multiply +muscle +museum +mushroom +music +must +mutual +myself +mystery +myth +naive +name +napkin +narrow +nasty +nation +nature +near +neck +need +negative +neglect +neither +nephew +nerve +nest +net +network +neutral +never +news +next +nice +night +noble +noise +nominee +noodle +normal +north +nose +notable +note +nothing +notice +novel +now +nuclear +number +nurse +nut +oak +obey +object +oblige +obscure +observe +obtain +obvious +occur +ocean +october +odor +off +offer +office +often +oil +okay +old +olive +olympic +omit +once +one +onion +online +only +open +opera +opinion +oppose +option +orange +orbit +orchard +order +ordinary +organ +orient +original +orphan +ostrich +other +outdoor +outer +output +outside +oval +oven +over +own +owner +oxygen +oyster +ozone +pact +paddle +page +pair +palace +palm +panda +panel +panic +panther +paper +parade +parent +park +parrot +party +pass +patch +path +patient +patrol +pattern +pause +pave +payment +peace +peanut +pear +peasant +pelican +pen +penalty +pencil +people +pepper +perfect +permit +person +pet +phone +photo +phrase +physical +piano +picnic +picture +piece +pig +pigeon +pill +pilot +pink +pioneer +pipe +pistol +pitch +pizza +place +planet +plastic +plate +play +please +pledge +pluck +plug +plunge +poem +poet +point +polar +pole +police +pond +pony +pool +popular +portion +position +possible +post +potato +pottery +poverty +powder +power +practice +praise +predict +prefer +prepare +present +pretty +prevent +price +pride +primary +print +priority +prison +private +prize +problem +process +produce +profit +program +project +promote +proof +property +prosper +protect +proud +provide +public +pudding +pull +pulp +pulse +pumpkin +punch +pupil +puppy +purchase +purity +purpose +purse +push +put +puzzle +pyramid +quality +quantum +quarter +question +quick +quit +quiz +quote +rabbit +raccoon +race +rack +radar +radio +rail +rain +raise +rally +ramp +ranch +random +range +rapid +rare +rate +rather +raven +raw +razor +ready +real +reason +rebel +rebuild +recall +receive +recipe +record +recycle +reduce +reflect +reform +refuse +region +regret +regular +reject +relax +release +relief +rely +remain +remember +remind +remove +render +renew +rent +reopen +repair +repeat +replace +report +require +rescue +resemble +resist +resource +response +result +retire +retreat +return +reunion +reveal +review +reward +rhythm +rib +ribbon +rice +rich +ride +ridge +rifle +right +rigid +ring +riot +ripple +risk +ritual +rival +river +road +roast +robot +robust +rocket +romance +roof +rookie +room +rose +rotate +rough +round +route +royal +rubber +rude +rug +rule +run +runway +rural +sad +saddle +sadness +safe +sail +salad +salmon +salon +salt +salute +same +sample +sand +satisfy +satoshi +sauce +sausage +save +say +scale +scan +scare +scatter +scene +scheme +school +science +scissors +scorpion +scout +scrap +screen +script +scrub +sea +search +season +seat +second +secret +section +security +seed +seek +segment +select +sell +seminar +senior +sense +sentence +series +service +session +settle +setup +seven +shadow +shaft +shallow +share +shed +shell +sheriff +shield +shift +shine +ship +shiver +shock +shoe +shoot +shop +short +shoulder +shove +shrimp +shrug +shuffle +shy +sibling +sick +side +siege +sight +sign +silent +silk +silly +silver +similar +simple +since +sing +siren +sister +situate +six +size +skate +sketch +ski +skill +skin +skirt +skull +slab +slam +sleep +slender +slice +slide +slight +slim +slogan +slot +slow +slush +small +smart +smile +smoke +smooth +snack +snake +snap +sniff +snow +soap +soccer +social +sock +soda +soft +solar +soldier +solid +solution +solve +someone +song +soon +sorry +sort +soul +sound +soup +source +south +space +spare +spatial +spawn +speak +special +speed +spell +spend +sphere +spice +spider +spike +spin +spirit +split +spoil +sponsor +spoon +sport +spot +spray +spread +spring +spy +square +squeeze +squirrel +stable +stadium +staff +stage +stairs +stamp +stand +start +state +stay +steak +steel +stem +step +stereo +stick +still +sting +stock +stomach +stone +stool +story +stove +strategy +street +strike +strong +struggle +student +stuff +stumble +style +subject +submit +subway +success +such +sudden +suffer +sugar +suggest +suit +summer +sun +sunny +sunset +super +supply +supreme +sure +surface +surge +surprise +surround +survey +suspect +sustain +swallow +swamp +swap +swarm +swear +sweet +swift +swim +swing +switch +sword +symbol +symptom +syrup +system +table +tackle +tag +tail +talent +talk +tank +tape +target +task +taste +tattoo +taxi +teach +team +tell +ten +tenant +tennis +tent +term +test +text +thank +that +theme +then +theory +there +they +thing +this +thought +three +thrive +throw +thumb +thunder +ticket +tide +tiger +tilt +timber +time +tiny +tip +tired +tissue +title +toast +tobacco +today +toddler +toe +together +toilet +token +tomato +tomorrow +tone +tongue +tonight +tool +tooth +top +topic +topple +torch +tornado +tortoise +toss +total +tourist +toward +tower +town +toy +track +trade +traffic +tragic +train +transfer +trap +trash +travel +tray +treat +tree +trend +trial +tribe +trick +trigger +trim +trip +trophy +trouble +truck +true +truly +trumpet +trust +truth +try +tube +tuition +tumble +tuna +tunnel +turkey +turn +turtle +twelve +twenty +twice +twin +twist +two +type +typical +ugly +umbrella +unable +unaware +uncle +uncover +under +undo +unfair +unfold +unhappy +uniform +unique +unit +universe +unknown +unlock +until +unusual +unveil +update +upgrade +uphold +upon +upper +upset +urban +urge +usage +use +used +useful +useless +usual +utility +vacant +vacuum +vague +valid +valley +valve +van +vanish +vapor +various +vast +vault +vehicle +velvet +vendor +venture +venue +verb +verify +version +very +vessel +veteran +viable +vibrant +vicious +victory +video +view +village +vintage +violin +virtual +virus +visa +visit +visual +vital +vivid +vocal +voice +void +volcano +volume +vote +voyage +wage +wagon +wait +walk +wall +walnut +want +warfare +warm +warrior +wash +wasp +waste +water +wave +way +wealth +weapon +wear +weasel +weather +web +wedding +weekend +weird +welcome +west +wet +whale +what +wheat +wheel +when +where +whip +whisper +wide +width +wife +wild +will +win +window +wine +wing +wink +winner +winter +wire +wisdom +wise +wish +witness +wolf +woman +wonder +wood +wool +word +work +world +worry +worth +wrap +wreck +wrestle +wrist +write +wrong +yard +year +yellow +you +young +youth +zebra +zero +zone +zoo`.split('\n'); + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1.js": +/*!******************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1.js ***! + \******************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +const asn1 = exports; + +asn1.bignum = __webpack_require__(/*! bn.js */ "./node_modules/asn1.js/node_modules/bn.js/lib/bn.js"); + +asn1.define = (__webpack_require__(/*! ./asn1/api */ "./node_modules/asn1.js/lib/asn1/api.js").define); +asn1.base = __webpack_require__(/*! ./asn1/base */ "./node_modules/asn1.js/lib/asn1/base/index.js"); +asn1.constants = __webpack_require__(/*! ./asn1/constants */ "./node_modules/asn1.js/lib/asn1/constants/index.js"); +asn1.decoders = __webpack_require__(/*! ./asn1/decoders */ "./node_modules/asn1.js/lib/asn1/decoders/index.js"); +asn1.encoders = __webpack_require__(/*! ./asn1/encoders */ "./node_modules/asn1.js/lib/asn1/encoders/index.js"); + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/api.js": +/*!**********************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/api.js ***! + \**********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +const encoders = __webpack_require__(/*! ./encoders */ "./node_modules/asn1.js/lib/asn1/encoders/index.js"); +const decoders = __webpack_require__(/*! ./decoders */ "./node_modules/asn1.js/lib/asn1/decoders/index.js"); +const inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); + +const api = exports; + +api.define = function define(name, body) { + return new Entity(name, body); +}; + +function Entity(name, body) { + this.name = name; + this.body = body; + + this.decoders = {}; + this.encoders = {}; +} + +Entity.prototype._createNamed = function createNamed(Base) { + const name = this.name; + + function Generated(entity) { + this._initNamed(entity, name); + } + inherits(Generated, Base); + Generated.prototype._initNamed = function _initNamed(entity, name) { + Base.call(this, entity, name); + }; + + return new Generated(this); +}; + +Entity.prototype._getDecoder = function _getDecoder(enc) { + enc = enc || 'der'; + // Lazily create decoder + if (!this.decoders.hasOwnProperty(enc)) + this.decoders[enc] = this._createNamed(decoders[enc]); + return this.decoders[enc]; +}; + +Entity.prototype.decode = function decode(data, enc, options) { + return this._getDecoder(enc).decode(data, options); +}; + +Entity.prototype._getEncoder = function _getEncoder(enc) { + enc = enc || 'der'; + // Lazily create encoder + if (!this.encoders.hasOwnProperty(enc)) + this.encoders[enc] = this._createNamed(encoders[enc]); + return this.encoders[enc]; +}; + +Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) { + return this._getEncoder(enc).encode(data, reporter); +}; + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/base/buffer.js": +/*!******************************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/base/buffer.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +const inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +const Reporter = (__webpack_require__(/*! ../base/reporter */ "./node_modules/asn1.js/lib/asn1/base/reporter.js").Reporter); +const Buffer = (__webpack_require__(/*! safer-buffer */ "./node_modules/safer-buffer/safer.js").Buffer); + +function DecoderBuffer(base, options) { + Reporter.call(this, options); + if (!Buffer.isBuffer(base)) { + this.error('Input not Buffer'); + return; + } + + this.base = base; + this.offset = 0; + this.length = base.length; +} +inherits(DecoderBuffer, Reporter); +exports.DecoderBuffer = DecoderBuffer; + +DecoderBuffer.isDecoderBuffer = function isDecoderBuffer(data) { + if (data instanceof DecoderBuffer) { + return true; + } + + // Or accept compatible API + const isCompatible = typeof data === 'object' && + Buffer.isBuffer(data.base) && + data.constructor.name === 'DecoderBuffer' && + typeof data.offset === 'number' && + typeof data.length === 'number' && + typeof data.save === 'function' && + typeof data.restore === 'function' && + typeof data.isEmpty === 'function' && + typeof data.readUInt8 === 'function' && + typeof data.skip === 'function' && + typeof data.raw === 'function'; + + return isCompatible; +}; + +DecoderBuffer.prototype.save = function save() { + return { offset: this.offset, reporter: Reporter.prototype.save.call(this) }; +}; + +DecoderBuffer.prototype.restore = function restore(save) { + // Return skipped data + const res = new DecoderBuffer(this.base); + res.offset = save.offset; + res.length = this.offset; + + this.offset = save.offset; + Reporter.prototype.restore.call(this, save.reporter); + + return res; +}; + +DecoderBuffer.prototype.isEmpty = function isEmpty() { + return this.offset === this.length; +}; + +DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) { + if (this.offset + 1 <= this.length) + return this.base.readUInt8(this.offset++, true); + else + return this.error(fail || 'DecoderBuffer overrun'); +}; + +DecoderBuffer.prototype.skip = function skip(bytes, fail) { + if (!(this.offset + bytes <= this.length)) + return this.error(fail || 'DecoderBuffer overrun'); + + const res = new DecoderBuffer(this.base); + + // Share reporter state + res._reporterState = this._reporterState; + + res.offset = this.offset; + res.length = this.offset + bytes; + this.offset += bytes; + return res; +}; + +DecoderBuffer.prototype.raw = function raw(save) { + return this.base.slice(save ? save.offset : this.offset, this.length); +}; + +function EncoderBuffer(value, reporter) { + if (Array.isArray(value)) { + this.length = 0; + this.value = value.map(function(item) { + if (!EncoderBuffer.isEncoderBuffer(item)) + item = new EncoderBuffer(item, reporter); + this.length += item.length; + return item; + }, this); + } else if (typeof value === 'number') { + if (!(0 <= value && value <= 0xff)) + return reporter.error('non-byte EncoderBuffer value'); + this.value = value; + this.length = 1; + } else if (typeof value === 'string') { + this.value = value; + this.length = Buffer.byteLength(value); + } else if (Buffer.isBuffer(value)) { + this.value = value; + this.length = value.length; + } else { + return reporter.error('Unsupported type: ' + typeof value); + } +} +exports.EncoderBuffer = EncoderBuffer; + +EncoderBuffer.isEncoderBuffer = function isEncoderBuffer(data) { + if (data instanceof EncoderBuffer) { + return true; + } + + // Or accept compatible API + const isCompatible = typeof data === 'object' && + data.constructor.name === 'EncoderBuffer' && + typeof data.length === 'number' && + typeof data.join === 'function'; + + return isCompatible; +}; + +EncoderBuffer.prototype.join = function join(out, offset) { + if (!out) + out = Buffer.alloc(this.length); + if (!offset) + offset = 0; + + if (this.length === 0) + return out; + + if (Array.isArray(this.value)) { + this.value.forEach(function(item) { + item.join(out, offset); + offset += item.length; + }); + } else { + if (typeof this.value === 'number') + out[offset] = this.value; + else if (typeof this.value === 'string') + out.write(this.value, offset); + else if (Buffer.isBuffer(this.value)) + this.value.copy(out, offset); + offset += this.length; + } + + return out; +}; + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/base/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/base/index.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +const base = exports; + +base.Reporter = (__webpack_require__(/*! ./reporter */ "./node_modules/asn1.js/lib/asn1/base/reporter.js").Reporter); +base.DecoderBuffer = (__webpack_require__(/*! ./buffer */ "./node_modules/asn1.js/lib/asn1/base/buffer.js").DecoderBuffer); +base.EncoderBuffer = (__webpack_require__(/*! ./buffer */ "./node_modules/asn1.js/lib/asn1/base/buffer.js").EncoderBuffer); +base.Node = __webpack_require__(/*! ./node */ "./node_modules/asn1.js/lib/asn1/base/node.js"); + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/base/node.js": +/*!****************************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/base/node.js ***! + \****************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +const Reporter = (__webpack_require__(/*! ../base/reporter */ "./node_modules/asn1.js/lib/asn1/base/reporter.js").Reporter); +const EncoderBuffer = (__webpack_require__(/*! ../base/buffer */ "./node_modules/asn1.js/lib/asn1/base/buffer.js").EncoderBuffer); +const DecoderBuffer = (__webpack_require__(/*! ../base/buffer */ "./node_modules/asn1.js/lib/asn1/base/buffer.js").DecoderBuffer); +const assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); + +// Supported tags +const tags = [ + 'seq', 'seqof', 'set', 'setof', 'objid', 'bool', + 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc', + 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str', + 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr' +]; + +// Public methods list +const methods = [ + 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice', + 'any', 'contains' +].concat(tags); + +// Overrided methods list +const overrided = [ + '_peekTag', '_decodeTag', '_use', + '_decodeStr', '_decodeObjid', '_decodeTime', + '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList', + + '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime', + '_encodeNull', '_encodeInt', '_encodeBool' +]; + +function Node(enc, parent, name) { + const state = {}; + this._baseState = state; + + state.name = name; + state.enc = enc; + + state.parent = parent || null; + state.children = null; + + // State + state.tag = null; + state.args = null; + state.reverseArgs = null; + state.choice = null; + state.optional = false; + state.any = false; + state.obj = false; + state.use = null; + state.useDecoder = null; + state.key = null; + state['default'] = null; + state.explicit = null; + state.implicit = null; + state.contains = null; + + // Should create new instance on each method + if (!state.parent) { + state.children = []; + this._wrap(); + } +} +module.exports = Node; + +const stateProps = [ + 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice', + 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit', + 'implicit', 'contains' +]; + +Node.prototype.clone = function clone() { + const state = this._baseState; + const cstate = {}; + stateProps.forEach(function(prop) { + cstate[prop] = state[prop]; + }); + const res = new this.constructor(cstate.parent); + res._baseState = cstate; + return res; +}; + +Node.prototype._wrap = function wrap() { + const state = this._baseState; + methods.forEach(function(method) { + this[method] = function _wrappedMethod() { + const clone = new this.constructor(this); + state.children.push(clone); + return clone[method].apply(clone, arguments); + }; + }, this); +}; + +Node.prototype._init = function init(body) { + const state = this._baseState; + + assert(state.parent === null); + body.call(this); + + // Filter children + state.children = state.children.filter(function(child) { + return child._baseState.parent === this; + }, this); + assert.equal(state.children.length, 1, 'Root node can have only one child'); +}; + +Node.prototype._useArgs = function useArgs(args) { + const state = this._baseState; + + // Filter children and args + const children = args.filter(function(arg) { + return arg instanceof this.constructor; + }, this); + args = args.filter(function(arg) { + return !(arg instanceof this.constructor); + }, this); + + if (children.length !== 0) { + assert(state.children === null); + state.children = children; + + // Replace parent to maintain backward link + children.forEach(function(child) { + child._baseState.parent = this; + }, this); + } + if (args.length !== 0) { + assert(state.args === null); + state.args = args; + state.reverseArgs = args.map(function(arg) { + if (typeof arg !== 'object' || arg.constructor !== Object) + return arg; + + const res = {}; + Object.keys(arg).forEach(function(key) { + if (key == (key | 0)) + key |= 0; + const value = arg[key]; + res[value] = key; + }); + return res; + }); + } +}; + +// +// Overrided methods +// + +overrided.forEach(function(method) { + Node.prototype[method] = function _overrided() { + const state = this._baseState; + throw new Error(method + ' not implemented for encoding: ' + state.enc); + }; +}); + +// +// Public methods +// + +tags.forEach(function(tag) { + Node.prototype[tag] = function _tagMethod() { + const state = this._baseState; + const args = Array.prototype.slice.call(arguments); + + assert(state.tag === null); + state.tag = tag; + + this._useArgs(args); + + return this; + }; +}); + +Node.prototype.use = function use(item) { + assert(item); + const state = this._baseState; + + assert(state.use === null); + state.use = item; + + return this; +}; + +Node.prototype.optional = function optional() { + const state = this._baseState; + + state.optional = true; + + return this; +}; + +Node.prototype.def = function def(val) { + const state = this._baseState; + + assert(state['default'] === null); + state['default'] = val; + state.optional = true; + + return this; +}; + +Node.prototype.explicit = function explicit(num) { + const state = this._baseState; + + assert(state.explicit === null && state.implicit === null); + state.explicit = num; + + return this; +}; + +Node.prototype.implicit = function implicit(num) { + const state = this._baseState; + + assert(state.explicit === null && state.implicit === null); + state.implicit = num; + + return this; +}; + +Node.prototype.obj = function obj() { + const state = this._baseState; + const args = Array.prototype.slice.call(arguments); + + state.obj = true; + + if (args.length !== 0) + this._useArgs(args); + + return this; +}; + +Node.prototype.key = function key(newKey) { + const state = this._baseState; + + assert(state.key === null); + state.key = newKey; + + return this; +}; + +Node.prototype.any = function any() { + const state = this._baseState; + + state.any = true; + + return this; +}; + +Node.prototype.choice = function choice(obj) { + const state = this._baseState; + + assert(state.choice === null); + state.choice = obj; + this._useArgs(Object.keys(obj).map(function(key) { + return obj[key]; + })); + + return this; +}; + +Node.prototype.contains = function contains(item) { + const state = this._baseState; + + assert(state.use === null); + state.contains = item; + + return this; +}; + +// +// Decoding +// + +Node.prototype._decode = function decode(input, options) { + const state = this._baseState; + + // Decode root node + if (state.parent === null) + return input.wrapResult(state.children[0]._decode(input, options)); + + let result = state['default']; + let present = true; + + let prevKey = null; + if (state.key !== null) + prevKey = input.enterKey(state.key); + + // Check if tag is there + if (state.optional) { + let tag = null; + if (state.explicit !== null) + tag = state.explicit; + else if (state.implicit !== null) + tag = state.implicit; + else if (state.tag !== null) + tag = state.tag; + + if (tag === null && !state.any) { + // Trial and Error + const save = input.save(); + try { + if (state.choice === null) + this._decodeGeneric(state.tag, input, options); + else + this._decodeChoice(input, options); + present = true; + } catch (e) { + present = false; + } + input.restore(save); + } else { + present = this._peekTag(input, tag, state.any); + + if (input.isError(present)) + return present; + } + } + + // Push object on stack + let prevObj; + if (state.obj && present) + prevObj = input.enterObject(); + + if (present) { + // Unwrap explicit values + if (state.explicit !== null) { + const explicit = this._decodeTag(input, state.explicit); + if (input.isError(explicit)) + return explicit; + input = explicit; + } + + const start = input.offset; + + // Unwrap implicit and normal values + if (state.use === null && state.choice === null) { + let save; + if (state.any) + save = input.save(); + const body = this._decodeTag( + input, + state.implicit !== null ? state.implicit : state.tag, + state.any + ); + if (input.isError(body)) + return body; + + if (state.any) + result = input.raw(save); + else + input = body; + } + + if (options && options.track && state.tag !== null) + options.track(input.path(), start, input.length, 'tagged'); + + if (options && options.track && state.tag !== null) + options.track(input.path(), input.offset, input.length, 'content'); + + // Select proper method for tag + if (state.any) { + // no-op + } else if (state.choice === null) { + result = this._decodeGeneric(state.tag, input, options); + } else { + result = this._decodeChoice(input, options); + } + + if (input.isError(result)) + return result; + + // Decode children + if (!state.any && state.choice === null && state.children !== null) { + state.children.forEach(function decodeChildren(child) { + // NOTE: We are ignoring errors here, to let parser continue with other + // parts of encoded data + child._decode(input, options); + }); + } + + // Decode contained/encoded by schema, only in bit or octet strings + if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) { + const data = new DecoderBuffer(result); + result = this._getUse(state.contains, input._reporterState.obj) + ._decode(data, options); + } + } + + // Pop object + if (state.obj && present) + result = input.leaveObject(prevObj); + + // Set key + if (state.key !== null && (result !== null || present === true)) + input.leaveKey(prevKey, state.key, result); + else if (prevKey !== null) + input.exitKey(prevKey); + + return result; +}; + +Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) { + const state = this._baseState; + + if (tag === 'seq' || tag === 'set') + return null; + if (tag === 'seqof' || tag === 'setof') + return this._decodeList(input, tag, state.args[0], options); + else if (/str$/.test(tag)) + return this._decodeStr(input, tag, options); + else if (tag === 'objid' && state.args) + return this._decodeObjid(input, state.args[0], state.args[1], options); + else if (tag === 'objid') + return this._decodeObjid(input, null, null, options); + else if (tag === 'gentime' || tag === 'utctime') + return this._decodeTime(input, tag, options); + else if (tag === 'null_') + return this._decodeNull(input, options); + else if (tag === 'bool') + return this._decodeBool(input, options); + else if (tag === 'objDesc') + return this._decodeStr(input, tag, options); + else if (tag === 'int' || tag === 'enum') + return this._decodeInt(input, state.args && state.args[0], options); + + if (state.use !== null) { + return this._getUse(state.use, input._reporterState.obj) + ._decode(input, options); + } else { + return input.error('unknown tag: ' + tag); + } +}; + +Node.prototype._getUse = function _getUse(entity, obj) { + + const state = this._baseState; + // Create altered use decoder if implicit is set + state.useDecoder = this._use(entity, obj); + assert(state.useDecoder._baseState.parent === null); + state.useDecoder = state.useDecoder._baseState.children[0]; + if (state.implicit !== state.useDecoder._baseState.implicit) { + state.useDecoder = state.useDecoder.clone(); + state.useDecoder._baseState.implicit = state.implicit; + } + return state.useDecoder; +}; + +Node.prototype._decodeChoice = function decodeChoice(input, options) { + const state = this._baseState; + let result = null; + let match = false; + + Object.keys(state.choice).some(function(key) { + const save = input.save(); + const node = state.choice[key]; + try { + const value = node._decode(input, options); + if (input.isError(value)) + return false; + + result = { type: key, value: value }; + match = true; + } catch (e) { + input.restore(save); + return false; + } + return true; + }, this); + + if (!match) + return input.error('Choice not matched'); + + return result; +}; + +// +// Encoding +// + +Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) { + return new EncoderBuffer(data, this.reporter); +}; + +Node.prototype._encode = function encode(data, reporter, parent) { + const state = this._baseState; + if (state['default'] !== null && state['default'] === data) + return; + + const result = this._encodeValue(data, reporter, parent); + if (result === undefined) + return; + + if (this._skipDefault(result, reporter, parent)) + return; + + return result; +}; + +Node.prototype._encodeValue = function encode(data, reporter, parent) { + const state = this._baseState; + + // Decode root node + if (state.parent === null) + return state.children[0]._encode(data, reporter || new Reporter()); + + let result = null; + + // Set reporter to share it with a child class + this.reporter = reporter; + + // Check if data is there + if (state.optional && data === undefined) { + if (state['default'] !== null) + data = state['default']; + else + return; + } + + // Encode children first + let content = null; + let primitive = false; + if (state.any) { + // Anything that was given is translated to buffer + result = this._createEncoderBuffer(data); + } else if (state.choice) { + result = this._encodeChoice(data, reporter); + } else if (state.contains) { + content = this._getUse(state.contains, parent)._encode(data, reporter); + primitive = true; + } else if (state.children) { + content = state.children.map(function(child) { + if (child._baseState.tag === 'null_') + return child._encode(null, reporter, data); + + if (child._baseState.key === null) + return reporter.error('Child should have a key'); + const prevKey = reporter.enterKey(child._baseState.key); + + if (typeof data !== 'object') + return reporter.error('Child expected, but input is not object'); + + const res = child._encode(data[child._baseState.key], reporter, data); + reporter.leaveKey(prevKey); + + return res; + }, this).filter(function(child) { + return child; + }); + content = this._createEncoderBuffer(content); + } else { + if (state.tag === 'seqof' || state.tag === 'setof') { + // TODO(indutny): this should be thrown on DSL level + if (!(state.args && state.args.length === 1)) + return reporter.error('Too many args for : ' + state.tag); + + if (!Array.isArray(data)) + return reporter.error('seqof/setof, but data is not Array'); + + const child = this.clone(); + child._baseState.implicit = null; + content = this._createEncoderBuffer(data.map(function(item) { + const state = this._baseState; + + return this._getUse(state.args[0], data)._encode(item, reporter); + }, child)); + } else if (state.use !== null) { + result = this._getUse(state.use, parent)._encode(data, reporter); + } else { + content = this._encodePrimitive(state.tag, data); + primitive = true; + } + } + + // Encode data itself + if (!state.any && state.choice === null) { + const tag = state.implicit !== null ? state.implicit : state.tag; + const cls = state.implicit === null ? 'universal' : 'context'; + + if (tag === null) { + if (state.use === null) + reporter.error('Tag could be omitted only for .use()'); + } else { + if (state.use === null) + result = this._encodeComposite(tag, primitive, cls, content); + } + } + + // Wrap in explicit + if (state.explicit !== null) + result = this._encodeComposite(state.explicit, false, 'context', result); + + return result; +}; + +Node.prototype._encodeChoice = function encodeChoice(data, reporter) { + const state = this._baseState; + + const node = state.choice[data.type]; + if (!node) { + assert( + false, + data.type + ' not found in ' + + JSON.stringify(Object.keys(state.choice))); + } + return node._encode(data.value, reporter); +}; + +Node.prototype._encodePrimitive = function encodePrimitive(tag, data) { + const state = this._baseState; + + if (/str$/.test(tag)) + return this._encodeStr(data, tag); + else if (tag === 'objid' && state.args) + return this._encodeObjid(data, state.reverseArgs[0], state.args[1]); + else if (tag === 'objid') + return this._encodeObjid(data, null, null); + else if (tag === 'gentime' || tag === 'utctime') + return this._encodeTime(data, tag); + else if (tag === 'null_') + return this._encodeNull(); + else if (tag === 'int' || tag === 'enum') + return this._encodeInt(data, state.args && state.reverseArgs[0]); + else if (tag === 'bool') + return this._encodeBool(data); + else if (tag === 'objDesc') + return this._encodeStr(data, tag); + else + throw new Error('Unsupported tag: ' + tag); +}; + +Node.prototype._isNumstr = function isNumstr(str) { + return /^[0-9 ]*$/.test(str); +}; + +Node.prototype._isPrintstr = function isPrintstr(str) { + return /^[A-Za-z0-9 '()+,-./:=?]*$/.test(str); +}; + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/base/reporter.js": +/*!********************************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/base/reporter.js ***! + \********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +const inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); + +function Reporter(options) { + this._reporterState = { + obj: null, + path: [], + options: options || {}, + errors: [] + }; +} +exports.Reporter = Reporter; + +Reporter.prototype.isError = function isError(obj) { + return obj instanceof ReporterError; +}; + +Reporter.prototype.save = function save() { + const state = this._reporterState; + + return { obj: state.obj, pathLen: state.path.length }; +}; + +Reporter.prototype.restore = function restore(data) { + const state = this._reporterState; + + state.obj = data.obj; + state.path = state.path.slice(0, data.pathLen); +}; + +Reporter.prototype.enterKey = function enterKey(key) { + return this._reporterState.path.push(key); +}; + +Reporter.prototype.exitKey = function exitKey(index) { + const state = this._reporterState; + + state.path = state.path.slice(0, index - 1); +}; + +Reporter.prototype.leaveKey = function leaveKey(index, key, value) { + const state = this._reporterState; + + this.exitKey(index); + if (state.obj !== null) + state.obj[key] = value; +}; + +Reporter.prototype.path = function path() { + return this._reporterState.path.join('/'); +}; + +Reporter.prototype.enterObject = function enterObject() { + const state = this._reporterState; + + const prev = state.obj; + state.obj = {}; + return prev; +}; + +Reporter.prototype.leaveObject = function leaveObject(prev) { + const state = this._reporterState; + + const now = state.obj; + state.obj = prev; + return now; +}; + +Reporter.prototype.error = function error(msg) { + let err; + const state = this._reporterState; + + const inherited = msg instanceof ReporterError; + if (inherited) { + err = msg; + } else { + err = new ReporterError(state.path.map(function(elem) { + return '[' + JSON.stringify(elem) + ']'; + }).join(''), msg.message || msg, msg.stack); + } + + if (!state.options.partial) + throw err; + + if (!inherited) + state.errors.push(err); + + return err; +}; + +Reporter.prototype.wrapResult = function wrapResult(result) { + const state = this._reporterState; + if (!state.options.partial) + return result; + + return { + result: this.isError(result) ? null : result, + errors: state.errors + }; +}; + +function ReporterError(path, msg) { + this.path = path; + this.rethrow(msg); +} +inherits(ReporterError, Error); + +ReporterError.prototype.rethrow = function rethrow(msg) { + this.message = msg + ' at: ' + (this.path || '(shallow)'); + if (Error.captureStackTrace) + Error.captureStackTrace(this, ReporterError); + + if (!this.stack) { + try { + // IE only adds stack when thrown + throw new Error(this.message); + } catch (e) { + this.stack = e.stack; + } + } + return this; +}; + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/constants/der.js": +/*!********************************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/constants/der.js ***! + \********************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + + +// Helper +function reverse(map) { + const res = {}; + + Object.keys(map).forEach(function(key) { + // Convert key to integer if it is stringified + if ((key | 0) == key) + key = key | 0; + + const value = map[key]; + res[value] = key; + }); + + return res; +} + +exports.tagClass = { + 0: 'universal', + 1: 'application', + 2: 'context', + 3: 'private' +}; +exports.tagClassByName = reverse(exports.tagClass); + +exports.tag = { + 0x00: 'end', + 0x01: 'bool', + 0x02: 'int', + 0x03: 'bitstr', + 0x04: 'octstr', + 0x05: 'null_', + 0x06: 'objid', + 0x07: 'objDesc', + 0x08: 'external', + 0x09: 'real', + 0x0a: 'enum', + 0x0b: 'embed', + 0x0c: 'utf8str', + 0x0d: 'relativeOid', + 0x10: 'seq', + 0x11: 'set', + 0x12: 'numstr', + 0x13: 'printstr', + 0x14: 't61str', + 0x15: 'videostr', + 0x16: 'ia5str', + 0x17: 'utctime', + 0x18: 'gentime', + 0x19: 'graphstr', + 0x1a: 'iso646str', + 0x1b: 'genstr', + 0x1c: 'unistr', + 0x1d: 'charstr', + 0x1e: 'bmpstr' +}; +exports.tagByName = reverse(exports.tag); + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/constants/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/constants/index.js ***! + \**********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +const constants = exports; + +// Helper +constants._reverse = function reverse(map) { + const res = {}; + + Object.keys(map).forEach(function(key) { + // Convert key to integer if it is stringified + if ((key | 0) == key) + key = key | 0; + + const value = map[key]; + res[value] = key; + }); + + return res; +}; + +constants.der = __webpack_require__(/*! ./der */ "./node_modules/asn1.js/lib/asn1/constants/der.js"); + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/decoders/der.js": +/*!*******************************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/decoders/der.js ***! + \*******************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +const inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); + +const bignum = __webpack_require__(/*! bn.js */ "./node_modules/asn1.js/node_modules/bn.js/lib/bn.js"); +const DecoderBuffer = (__webpack_require__(/*! ../base/buffer */ "./node_modules/asn1.js/lib/asn1/base/buffer.js").DecoderBuffer); +const Node = __webpack_require__(/*! ../base/node */ "./node_modules/asn1.js/lib/asn1/base/node.js"); + +// Import DER constants +const der = __webpack_require__(/*! ../constants/der */ "./node_modules/asn1.js/lib/asn1/constants/der.js"); + +function DERDecoder(entity) { + this.enc = 'der'; + this.name = entity.name; + this.entity = entity; + + // Construct base tree + this.tree = new DERNode(); + this.tree._init(entity.body); +} +module.exports = DERDecoder; + +DERDecoder.prototype.decode = function decode(data, options) { + if (!DecoderBuffer.isDecoderBuffer(data)) { + data = new DecoderBuffer(data, options); + } + + return this.tree._decode(data, options); +}; + +// Tree methods + +function DERNode(parent) { + Node.call(this, 'der', parent); +} +inherits(DERNode, Node); + +DERNode.prototype._peekTag = function peekTag(buffer, tag, any) { + if (buffer.isEmpty()) + return false; + + const state = buffer.save(); + const decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"'); + if (buffer.isError(decodedTag)) + return decodedTag; + + buffer.restore(state); + + return decodedTag.tag === tag || decodedTag.tagStr === tag || + (decodedTag.tagStr + 'of') === tag || any; +}; + +DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) { + const decodedTag = derDecodeTag(buffer, + 'Failed to decode tag of "' + tag + '"'); + if (buffer.isError(decodedTag)) + return decodedTag; + + let len = derDecodeLen(buffer, + decodedTag.primitive, + 'Failed to get length of "' + tag + '"'); + + // Failure + if (buffer.isError(len)) + return len; + + if (!any && + decodedTag.tag !== tag && + decodedTag.tagStr !== tag && + decodedTag.tagStr + 'of' !== tag) { + return buffer.error('Failed to match tag: "' + tag + '"'); + } + + if (decodedTag.primitive || len !== null) + return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); + + // Indefinite length... find END tag + const state = buffer.save(); + const res = this._skipUntilEnd( + buffer, + 'Failed to skip indefinite length body: "' + this.tag + '"'); + if (buffer.isError(res)) + return res; + + len = buffer.offset - state.offset; + buffer.restore(state); + return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); +}; + +DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) { + for (;;) { + const tag = derDecodeTag(buffer, fail); + if (buffer.isError(tag)) + return tag; + const len = derDecodeLen(buffer, tag.primitive, fail); + if (buffer.isError(len)) + return len; + + let res; + if (tag.primitive || len !== null) + res = buffer.skip(len); + else + res = this._skipUntilEnd(buffer, fail); + + // Failure + if (buffer.isError(res)) + return res; + + if (tag.tagStr === 'end') + break; + } +}; + +DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder, + options) { + const result = []; + while (!buffer.isEmpty()) { + const possibleEnd = this._peekTag(buffer, 'end'); + if (buffer.isError(possibleEnd)) + return possibleEnd; + + const res = decoder.decode(buffer, 'der', options); + if (buffer.isError(res) && possibleEnd) + break; + result.push(res); + } + return result; +}; + +DERNode.prototype._decodeStr = function decodeStr(buffer, tag) { + if (tag === 'bitstr') { + const unused = buffer.readUInt8(); + if (buffer.isError(unused)) + return unused; + return { unused: unused, data: buffer.raw() }; + } else if (tag === 'bmpstr') { + const raw = buffer.raw(); + if (raw.length % 2 === 1) + return buffer.error('Decoding of string type: bmpstr length mismatch'); + + let str = ''; + for (let i = 0; i < raw.length / 2; i++) { + str += String.fromCharCode(raw.readUInt16BE(i * 2)); + } + return str; + } else if (tag === 'numstr') { + const numstr = buffer.raw().toString('ascii'); + if (!this._isNumstr(numstr)) { + return buffer.error('Decoding of string type: ' + + 'numstr unsupported characters'); + } + return numstr; + } else if (tag === 'octstr') { + return buffer.raw(); + } else if (tag === 'objDesc') { + return buffer.raw(); + } else if (tag === 'printstr') { + const printstr = buffer.raw().toString('ascii'); + if (!this._isPrintstr(printstr)) { + return buffer.error('Decoding of string type: ' + + 'printstr unsupported characters'); + } + return printstr; + } else if (/str$/.test(tag)) { + return buffer.raw().toString(); + } else { + return buffer.error('Decoding of string type: ' + tag + ' unsupported'); + } +}; + +DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) { + let result; + const identifiers = []; + let ident = 0; + let subident = 0; + while (!buffer.isEmpty()) { + subident = buffer.readUInt8(); + ident <<= 7; + ident |= subident & 0x7f; + if ((subident & 0x80) === 0) { + identifiers.push(ident); + ident = 0; + } + } + if (subident & 0x80) + identifiers.push(ident); + + const first = (identifiers[0] / 40) | 0; + const second = identifiers[0] % 40; + + if (relative) + result = identifiers; + else + result = [first, second].concat(identifiers.slice(1)); + + if (values) { + let tmp = values[result.join(' ')]; + if (tmp === undefined) + tmp = values[result.join('.')]; + if (tmp !== undefined) + result = tmp; + } + + return result; +}; + +DERNode.prototype._decodeTime = function decodeTime(buffer, tag) { + const str = buffer.raw().toString(); + + let year; + let mon; + let day; + let hour; + let min; + let sec; + if (tag === 'gentime') { + year = str.slice(0, 4) | 0; + mon = str.slice(4, 6) | 0; + day = str.slice(6, 8) | 0; + hour = str.slice(8, 10) | 0; + min = str.slice(10, 12) | 0; + sec = str.slice(12, 14) | 0; + } else if (tag === 'utctime') { + year = str.slice(0, 2) | 0; + mon = str.slice(2, 4) | 0; + day = str.slice(4, 6) | 0; + hour = str.slice(6, 8) | 0; + min = str.slice(8, 10) | 0; + sec = str.slice(10, 12) | 0; + if (year < 70) + year = 2000 + year; + else + year = 1900 + year; + } else { + return buffer.error('Decoding ' + tag + ' time is not supported yet'); + } + + return Date.UTC(year, mon - 1, day, hour, min, sec, 0); +}; + +DERNode.prototype._decodeNull = function decodeNull() { + return null; +}; + +DERNode.prototype._decodeBool = function decodeBool(buffer) { + const res = buffer.readUInt8(); + if (buffer.isError(res)) + return res; + else + return res !== 0; +}; + +DERNode.prototype._decodeInt = function decodeInt(buffer, values) { + // Bigint, return as it is (assume big endian) + const raw = buffer.raw(); + let res = new bignum(raw); + + if (values) + res = values[res.toString(10)] || res; + + return res; +}; + +DERNode.prototype._use = function use(entity, obj) { + if (typeof entity === 'function') + entity = entity(obj); + return entity._getDecoder('der').tree; +}; + +// Utility methods + +function derDecodeTag(buf, fail) { + let tag = buf.readUInt8(fail); + if (buf.isError(tag)) + return tag; + + const cls = der.tagClass[tag >> 6]; + const primitive = (tag & 0x20) === 0; + + // Multi-octet tag - load + if ((tag & 0x1f) === 0x1f) { + let oct = tag; + tag = 0; + while ((oct & 0x80) === 0x80) { + oct = buf.readUInt8(fail); + if (buf.isError(oct)) + return oct; + + tag <<= 7; + tag |= oct & 0x7f; + } + } else { + tag &= 0x1f; + } + const tagStr = der.tag[tag]; + + return { + cls: cls, + primitive: primitive, + tag: tag, + tagStr: tagStr + }; +} + +function derDecodeLen(buf, primitive, fail) { + let len = buf.readUInt8(fail); + if (buf.isError(len)) + return len; + + // Indefinite form + if (!primitive && len === 0x80) + return null; + + // Definite form + if ((len & 0x80) === 0) { + // Short form + return len; + } + + // Long form + const num = len & 0x7f; + if (num > 4) + return buf.error('length octect is too long'); + + len = 0; + for (let i = 0; i < num; i++) { + len <<= 8; + const j = buf.readUInt8(fail); + if (buf.isError(j)) + return j; + len |= j; + } + + return len; +} + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/decoders/index.js": +/*!*********************************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/decoders/index.js ***! + \*********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +const decoders = exports; + +decoders.der = __webpack_require__(/*! ./der */ "./node_modules/asn1.js/lib/asn1/decoders/der.js"); +decoders.pem = __webpack_require__(/*! ./pem */ "./node_modules/asn1.js/lib/asn1/decoders/pem.js"); + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/decoders/pem.js": +/*!*******************************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/decoders/pem.js ***! + \*******************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +const inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +const Buffer = (__webpack_require__(/*! safer-buffer */ "./node_modules/safer-buffer/safer.js").Buffer); + +const DERDecoder = __webpack_require__(/*! ./der */ "./node_modules/asn1.js/lib/asn1/decoders/der.js"); + +function PEMDecoder(entity) { + DERDecoder.call(this, entity); + this.enc = 'pem'; +} +inherits(PEMDecoder, DERDecoder); +module.exports = PEMDecoder; + +PEMDecoder.prototype.decode = function decode(data, options) { + const lines = data.toString().split(/[\r\n]+/g); + + const label = options.label.toUpperCase(); + + const re = /^-----(BEGIN|END) ([^-]+)-----$/; + let start = -1; + let end = -1; + for (let i = 0; i < lines.length; i++) { + const match = lines[i].match(re); + if (match === null) + continue; + + if (match[2] !== label) + continue; + + if (start === -1) { + if (match[1] !== 'BEGIN') + break; + start = i; + } else { + if (match[1] !== 'END') + break; + end = i; + break; + } + } + if (start === -1 || end === -1) + throw new Error('PEM section not found for: ' + label); + + const base64 = lines.slice(start + 1, end).join(''); + // Remove excessive symbols + base64.replace(/[^a-z0-9+/=]+/gi, ''); + + const input = Buffer.from(base64, 'base64'); + return DERDecoder.prototype.decode.call(this, input, options); +}; + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/encoders/der.js": +/*!*******************************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/encoders/der.js ***! + \*******************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +const inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +const Buffer = (__webpack_require__(/*! safer-buffer */ "./node_modules/safer-buffer/safer.js").Buffer); +const Node = __webpack_require__(/*! ../base/node */ "./node_modules/asn1.js/lib/asn1/base/node.js"); + +// Import DER constants +const der = __webpack_require__(/*! ../constants/der */ "./node_modules/asn1.js/lib/asn1/constants/der.js"); + +function DEREncoder(entity) { + this.enc = 'der'; + this.name = entity.name; + this.entity = entity; + + // Construct base tree + this.tree = new DERNode(); + this.tree._init(entity.body); +} +module.exports = DEREncoder; + +DEREncoder.prototype.encode = function encode(data, reporter) { + return this.tree._encode(data, reporter).join(); +}; + +// Tree methods + +function DERNode(parent) { + Node.call(this, 'der', parent); +} +inherits(DERNode, Node); + +DERNode.prototype._encodeComposite = function encodeComposite(tag, + primitive, + cls, + content) { + const encodedTag = encodeTag(tag, primitive, cls, this.reporter); + + // Short form + if (content.length < 0x80) { + const header = Buffer.alloc(2); + header[0] = encodedTag; + header[1] = content.length; + return this._createEncoderBuffer([ header, content ]); + } + + // Long form + // Count octets required to store length + let lenOctets = 1; + for (let i = content.length; i >= 0x100; i >>= 8) + lenOctets++; + + const header = Buffer.alloc(1 + 1 + lenOctets); + header[0] = encodedTag; + header[1] = 0x80 | lenOctets; + + for (let i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8) + header[i] = j & 0xff; + + return this._createEncoderBuffer([ header, content ]); +}; + +DERNode.prototype._encodeStr = function encodeStr(str, tag) { + if (tag === 'bitstr') { + return this._createEncoderBuffer([ str.unused | 0, str.data ]); + } else if (tag === 'bmpstr') { + const buf = Buffer.alloc(str.length * 2); + for (let i = 0; i < str.length; i++) { + buf.writeUInt16BE(str.charCodeAt(i), i * 2); + } + return this._createEncoderBuffer(buf); + } else if (tag === 'numstr') { + if (!this._isNumstr(str)) { + return this.reporter.error('Encoding of string type: numstr supports ' + + 'only digits and space'); + } + return this._createEncoderBuffer(str); + } else if (tag === 'printstr') { + if (!this._isPrintstr(str)) { + return this.reporter.error('Encoding of string type: printstr supports ' + + 'only latin upper and lower case letters, ' + + 'digits, space, apostrophe, left and rigth ' + + 'parenthesis, plus sign, comma, hyphen, ' + + 'dot, slash, colon, equal sign, ' + + 'question mark'); + } + return this._createEncoderBuffer(str); + } else if (/str$/.test(tag)) { + return this._createEncoderBuffer(str); + } else if (tag === 'objDesc') { + return this._createEncoderBuffer(str); + } else { + return this.reporter.error('Encoding of string type: ' + tag + + ' unsupported'); + } +}; + +DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) { + if (typeof id === 'string') { + if (!values) + return this.reporter.error('string objid given, but no values map found'); + if (!values.hasOwnProperty(id)) + return this.reporter.error('objid not found in values map'); + id = values[id].split(/[\s.]+/g); + for (let i = 0; i < id.length; i++) + id[i] |= 0; + } else if (Array.isArray(id)) { + id = id.slice(); + for (let i = 0; i < id.length; i++) + id[i] |= 0; + } + + if (!Array.isArray(id)) { + return this.reporter.error('objid() should be either array or string, ' + + 'got: ' + JSON.stringify(id)); + } + + if (!relative) { + if (id[1] >= 40) + return this.reporter.error('Second objid identifier OOB'); + id.splice(0, 2, id[0] * 40 + id[1]); + } + + // Count number of octets + let size = 0; + for (let i = 0; i < id.length; i++) { + let ident = id[i]; + for (size++; ident >= 0x80; ident >>= 7) + size++; + } + + const objid = Buffer.alloc(size); + let offset = objid.length - 1; + for (let i = id.length - 1; i >= 0; i--) { + let ident = id[i]; + objid[offset--] = ident & 0x7f; + while ((ident >>= 7) > 0) + objid[offset--] = 0x80 | (ident & 0x7f); + } + + return this._createEncoderBuffer(objid); +}; + +function two(num) { + if (num < 10) + return '0' + num; + else + return num; +} + +DERNode.prototype._encodeTime = function encodeTime(time, tag) { + let str; + const date = new Date(time); + + if (tag === 'gentime') { + str = [ + two(date.getUTCFullYear()), + two(date.getUTCMonth() + 1), + two(date.getUTCDate()), + two(date.getUTCHours()), + two(date.getUTCMinutes()), + two(date.getUTCSeconds()), + 'Z' + ].join(''); + } else if (tag === 'utctime') { + str = [ + two(date.getUTCFullYear() % 100), + two(date.getUTCMonth() + 1), + two(date.getUTCDate()), + two(date.getUTCHours()), + two(date.getUTCMinutes()), + two(date.getUTCSeconds()), + 'Z' + ].join(''); + } else { + this.reporter.error('Encoding ' + tag + ' time is not supported yet'); + } + + return this._encodeStr(str, 'octstr'); +}; + +DERNode.prototype._encodeNull = function encodeNull() { + return this._createEncoderBuffer(''); +}; + +DERNode.prototype._encodeInt = function encodeInt(num, values) { + if (typeof num === 'string') { + if (!values) + return this.reporter.error('String int or enum given, but no values map'); + if (!values.hasOwnProperty(num)) { + return this.reporter.error('Values map doesn\'t contain: ' + + JSON.stringify(num)); + } + num = values[num]; + } + + // Bignum, assume big endian + if (typeof num !== 'number' && !Buffer.isBuffer(num)) { + const numArray = num.toArray(); + if (!num.sign && numArray[0] & 0x80) { + numArray.unshift(0); + } + num = Buffer.from(numArray); + } + + if (Buffer.isBuffer(num)) { + let size = num.length; + if (num.length === 0) + size++; + + const out = Buffer.alloc(size); + num.copy(out); + if (num.length === 0) + out[0] = 0; + return this._createEncoderBuffer(out); + } + + if (num < 0x80) + return this._createEncoderBuffer(num); + + if (num < 0x100) + return this._createEncoderBuffer([0, num]); + + let size = 1; + for (let i = num; i >= 0x100; i >>= 8) + size++; + + const out = new Array(size); + for (let i = out.length - 1; i >= 0; i--) { + out[i] = num & 0xff; + num >>= 8; + } + if(out[0] & 0x80) { + out.unshift(0); + } + + return this._createEncoderBuffer(Buffer.from(out)); +}; + +DERNode.prototype._encodeBool = function encodeBool(value) { + return this._createEncoderBuffer(value ? 0xff : 0); +}; + +DERNode.prototype._use = function use(entity, obj) { + if (typeof entity === 'function') + entity = entity(obj); + return entity._getEncoder('der').tree; +}; + +DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) { + const state = this._baseState; + let i; + if (state['default'] === null) + return false; + + const data = dataBuffer.join(); + if (state.defaultBuffer === undefined) + state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join(); + + if (data.length !== state.defaultBuffer.length) + return false; + + for (i=0; i < data.length; i++) + if (data[i] !== state.defaultBuffer[i]) + return false; + + return true; +}; + +// Utility methods + +function encodeTag(tag, primitive, cls, reporter) { + let res; + + if (tag === 'seqof') + tag = 'seq'; + else if (tag === 'setof') + tag = 'set'; + + if (der.tagByName.hasOwnProperty(tag)) + res = der.tagByName[tag]; + else if (typeof tag === 'number' && (tag | 0) === tag) + res = tag; + else + return reporter.error('Unknown tag: ' + tag); + + if (res >= 0x1f) + return reporter.error('Multi-octet tag encoding unsupported'); + + if (!primitive) + res |= 0x20; + + res |= (der.tagClassByName[cls || 'universal'] << 6); + + return res; +} + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/encoders/index.js": +/*!*********************************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/encoders/index.js ***! + \*********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +const encoders = exports; + +encoders.der = __webpack_require__(/*! ./der */ "./node_modules/asn1.js/lib/asn1/encoders/der.js"); +encoders.pem = __webpack_require__(/*! ./pem */ "./node_modules/asn1.js/lib/asn1/encoders/pem.js"); + + +/***/ }), + +/***/ "./node_modules/asn1.js/lib/asn1/encoders/pem.js": +/*!*******************************************************!*\ + !*** ./node_modules/asn1.js/lib/asn1/encoders/pem.js ***! + \*******************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +const inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); + +const DEREncoder = __webpack_require__(/*! ./der */ "./node_modules/asn1.js/lib/asn1/encoders/der.js"); + +function PEMEncoder(entity) { + DEREncoder.call(this, entity); + this.enc = 'pem'; +} +inherits(PEMEncoder, DEREncoder); +module.exports = PEMEncoder; + +PEMEncoder.prototype.encode = function encode(data, options) { + const buf = DEREncoder.prototype.encode.call(this, data); + + const p = buf.toString('base64'); + const out = [ '-----BEGIN ' + options.label + '-----' ]; + for (let i = 0; i < p.length; i += 64) + out.push(p.slice(i, i + 64)); + out.push('-----END ' + options.label + '-----'); + return out.join('\n'); +}; + + +/***/ }), + +/***/ "./node_modules/asn1.js/node_modules/bn.js/lib/bn.js": +/*!***********************************************************!*\ + !*** ./node_modules/asn1.js/node_modules/bn.js/lib/bn.js ***! + \***********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(/*! buffer */ "?d546").Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [ 0 ]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // 'A' - 'F' + if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + // '0' - '9' + } else { + return (c - 48) & 0xf; + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this.strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + r += c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + r += c - 17 + 0xa; + + // '0' - '9' + } else { + r += c; + } + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this.strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype.strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + BN.prototype.inspect = function inspect () { + return (this.red ? ''; + }; + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16); + }; + + BN.prototype.toBuffer = function toBuffer (endian, length) { + assert(typeof Buffer !== 'undefined'); + return this.toArrayLike(Buffer, endian, length); + }; + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + this.strip(); + var littleEndian = endian === 'le'; + var res = new ArrayType(reqLength); + + var b, i; + var q = this.clone(); + if (!littleEndian) { + // Assume big-endian + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[i] = b; + } + + for (; i < reqLength; i++) { + res[i] = 0; + } + } + + return res; + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] & (1 << wbit)) >>> wbit; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this.strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this.strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this.strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this.strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this.strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this.strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out.strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); + } + + function jumboMulTo (self, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; + + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out.strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this.strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this.strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this.strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) < num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this.strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this.strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q.strip(); + } + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modn = function modn (num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return acc; + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is BN v4 instance + r.strip(); + } else { + // r is BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + return a.umod(this.m)._forceRed(this); + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ "./node_modules/assert/build/assert.js": +/*!*********************************************!*\ + !*** ./node_modules/assert/build/assert.js ***! + \*********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Currently in sync with Node.js lib/assert.js +// https://github.com/nodejs/node/commit/2a51ae424a513ec9a6aa3466baa0cc1d55dd4f3b +// Originally from narwhal.js (http://narwhaljs.org) +// Copyright (c) 2009 Thomas Robinson <280north.com> +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the 'Software'), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var _require = __webpack_require__(/*! ./internal/errors */ "./node_modules/assert/build/internal/errors.js"), + _require$codes = _require.codes, + ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE, + ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE, + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; + +var AssertionError = __webpack_require__(/*! ./internal/assert/assertion_error */ "./node_modules/assert/build/internal/assert/assertion_error.js"); + +var _require2 = __webpack_require__(/*! util/ */ "./node_modules/assert/node_modules/util/util.js"), + inspect = _require2.inspect; + +var _require$types = (__webpack_require__(/*! util/ */ "./node_modules/assert/node_modules/util/util.js").types), + isPromise = _require$types.isPromise, + isRegExp = _require$types.isRegExp; + +var objectAssign = Object.assign ? Object.assign : (__webpack_require__(/*! es6-object-assign */ "./node_modules/es6-object-assign/index.js").assign); +var objectIs = Object.is ? Object.is : __webpack_require__(/*! object-is */ "./node_modules/object-is/index.js"); +var errorCache = new Map(); +var isDeepEqual; +var isDeepStrictEqual; +var parseExpressionAt; +var findNodeAround; +var decoder; + +function lazyLoadComparison() { + var comparison = __webpack_require__(/*! ./internal/util/comparisons */ "./node_modules/assert/build/internal/util/comparisons.js"); + + isDeepEqual = comparison.isDeepEqual; + isDeepStrictEqual = comparison.isDeepStrictEqual; +} // Escape control characters but not \n and \t to keep the line breaks and +// indentation intact. +// eslint-disable-next-line no-control-regex + + +var escapeSequencesRegExp = /[\x00-\x08\x0b\x0c\x0e-\x1f]/g; +var meta = ["\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", "\\u0006", "\\u0007", '\\b', '', '', "\\u000b", '\\f', '', "\\u000e", "\\u000f", "\\u0010", "\\u0011", "\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", "\\u001a", "\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f"]; + +var escapeFn = function escapeFn(str) { + return meta[str.charCodeAt(0)]; +}; + +var warned = false; // The assert module provides functions that throw +// AssertionError's when particular conditions are not met. The +// assert module must conform to the following interface. + +var assert = module.exports = ok; +var NO_EXCEPTION_SENTINEL = {}; // All of the following functions must throw an AssertionError +// when a corresponding condition is not met, with a message that +// may be undefined if not provided. All assertion methods provide +// both the actual and expected values to the assertion error for +// display purposes. + +function innerFail(obj) { + if (obj.message instanceof Error) throw obj.message; + throw new AssertionError(obj); +} + +function fail(actual, expected, message, operator, stackStartFn) { + var argsLen = arguments.length; + var internalMessage; + + if (argsLen === 0) { + internalMessage = 'Failed'; + } else if (argsLen === 1) { + message = actual; + actual = undefined; + } else { + if (warned === false) { + warned = true; + var warn = ({"env":{"NODE_ENV":"production"}}).emitWarning ? ({"env":{"NODE_ENV":"production"}}).emitWarning : console.warn.bind(console); + warn('assert.fail() with more than one argument is deprecated. ' + 'Please use assert.strictEqual() instead or only pass a message.', 'DeprecationWarning', 'DEP0094'); + } + + if (argsLen === 2) operator = '!='; + } + + if (message instanceof Error) throw message; + var errArgs = { + actual: actual, + expected: expected, + operator: operator === undefined ? 'fail' : operator, + stackStartFn: stackStartFn || fail + }; + + if (message !== undefined) { + errArgs.message = message; + } + + var err = new AssertionError(errArgs); + + if (internalMessage) { + err.message = internalMessage; + err.generatedMessage = true; + } + + throw err; +} + +assert.fail = fail; // The AssertionError is defined in internal/error. + +assert.AssertionError = AssertionError; + +function innerOk(fn, argLen, value, message) { + if (!value) { + var generatedMessage = false; + + if (argLen === 0) { + generatedMessage = true; + message = 'No value argument passed to `assert.ok()`'; + } else if (message instanceof Error) { + throw message; + } + + var err = new AssertionError({ + actual: value, + expected: true, + message: message, + operator: '==', + stackStartFn: fn + }); + err.generatedMessage = generatedMessage; + throw err; + } +} // Pure assertion tests whether a value is truthy, as determined +// by !!value. + + +function ok() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + innerOk.apply(void 0, [ok, args.length].concat(args)); +} + +assert.ok = ok; // The equality assertion tests shallow, coercive equality with ==. + +/* eslint-disable no-restricted-properties */ + +assert.equal = function equal(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } // eslint-disable-next-line eqeqeq + + + if (actual != expected) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: '==', + stackStartFn: equal + }); + } +}; // The non-equality assertion tests for whether two objects are not +// equal with !=. + + +assert.notEqual = function notEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } // eslint-disable-next-line eqeqeq + + + if (actual == expected) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: '!=', + stackStartFn: notEqual + }); + } +}; // The equivalence assertion tests a deep equality relation. + + +assert.deepEqual = function deepEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } + + if (isDeepEqual === undefined) lazyLoadComparison(); + + if (!isDeepEqual(actual, expected)) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: 'deepEqual', + stackStartFn: deepEqual + }); + } +}; // The non-equivalence assertion tests for any deep inequality. + + +assert.notDeepEqual = function notDeepEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } + + if (isDeepEqual === undefined) lazyLoadComparison(); + + if (isDeepEqual(actual, expected)) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: 'notDeepEqual', + stackStartFn: notDeepEqual + }); + } +}; +/* eslint-enable */ + + +assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } + + if (isDeepEqual === undefined) lazyLoadComparison(); + + if (!isDeepStrictEqual(actual, expected)) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: 'deepStrictEqual', + stackStartFn: deepStrictEqual + }); + } +}; + +assert.notDeepStrictEqual = notDeepStrictEqual; + +function notDeepStrictEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } + + if (isDeepEqual === undefined) lazyLoadComparison(); + + if (isDeepStrictEqual(actual, expected)) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: 'notDeepStrictEqual', + stackStartFn: notDeepStrictEqual + }); + } +} + +assert.strictEqual = function strictEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } + + if (!objectIs(actual, expected)) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: 'strictEqual', + stackStartFn: strictEqual + }); + } +}; + +assert.notStrictEqual = function notStrictEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } + + if (objectIs(actual, expected)) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: 'notStrictEqual', + stackStartFn: notStrictEqual + }); + } +}; + +var Comparison = function Comparison(obj, keys, actual) { + var _this = this; + + _classCallCheck(this, Comparison); + + keys.forEach(function (key) { + if (key in obj) { + if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && obj[key].test(actual[key])) { + _this[key] = actual[key]; + } else { + _this[key] = obj[key]; + } + } + }); +}; + +function compareExceptionKey(actual, expected, key, message, keys, fn) { + if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) { + if (!message) { + // Create placeholder objects to create a nice output. + var a = new Comparison(actual, keys); + var b = new Comparison(expected, keys, actual); + var err = new AssertionError({ + actual: a, + expected: b, + operator: 'deepStrictEqual', + stackStartFn: fn + }); + err.actual = actual; + err.expected = expected; + err.operator = fn.name; + throw err; + } + + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: fn.name, + stackStartFn: fn + }); + } +} + +function expectedException(actual, expected, msg, fn) { + if (typeof expected !== 'function') { + if (isRegExp(expected)) return expected.test(actual); // assert.doesNotThrow does not accept objects. + + if (arguments.length === 2) { + throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected); + } // Handle primitives properly. + + + if (_typeof(actual) !== 'object' || actual === null) { + var err = new AssertionError({ + actual: actual, + expected: expected, + message: msg, + operator: 'deepStrictEqual', + stackStartFn: fn + }); + err.operator = fn.name; + throw err; + } + + var keys = Object.keys(expected); // Special handle errors to make sure the name and the message are compared + // as well. + + if (expected instanceof Error) { + keys.push('name', 'message'); + } else if (keys.length === 0) { + throw new ERR_INVALID_ARG_VALUE('error', expected, 'may not be an empty object'); + } + + if (isDeepEqual === undefined) lazyLoadComparison(); + keys.forEach(function (key) { + if (typeof actual[key] === 'string' && isRegExp(expected[key]) && expected[key].test(actual[key])) { + return; + } + + compareExceptionKey(actual, expected, key, msg, keys, fn); + }); + return true; + } // Guard instanceof against arrow functions as they don't have a prototype. + + + if (expected.prototype !== undefined && actual instanceof expected) { + return true; + } + + if (Error.isPrototypeOf(expected)) { + return false; + } + + return expected.call({}, actual) === true; +} + +function getActual(fn) { + if (typeof fn !== 'function') { + throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn); + } + + try { + fn(); + } catch (e) { + return e; + } + + return NO_EXCEPTION_SENTINEL; +} + +function checkIsPromise(obj) { + // Accept native ES6 promises and promises that are implemented in a similar + // way. Do not accept thenables that use a function as `obj` and that have no + // `catch` handler. + // TODO: thenables are checked up until they have the correct methods, + // but according to documentation, the `then` method should receive + // the `fulfill` and `reject` arguments as well or it may be never resolved. + return isPromise(obj) || obj !== null && _typeof(obj) === 'object' && typeof obj.then === 'function' && typeof obj.catch === 'function'; +} + +function waitForActual(promiseFn) { + return Promise.resolve().then(function () { + var resultPromise; + + if (typeof promiseFn === 'function') { + // Return a rejected promise if `promiseFn` throws synchronously. + resultPromise = promiseFn(); // Fail in case no promise is returned. + + if (!checkIsPromise(resultPromise)) { + throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise); + } + } else if (checkIsPromise(promiseFn)) { + resultPromise = promiseFn; + } else { + throw new ERR_INVALID_ARG_TYPE('promiseFn', ['Function', 'Promise'], promiseFn); + } + + return Promise.resolve().then(function () { + return resultPromise; + }).then(function () { + return NO_EXCEPTION_SENTINEL; + }).catch(function (e) { + return e; + }); + }); +} + +function expectsError(stackStartFn, actual, error, message) { + if (typeof error === 'string') { + if (arguments.length === 4) { + throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error); + } + + if (_typeof(actual) === 'object' && actual !== null) { + if (actual.message === error) { + throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error message \"".concat(actual.message, "\" is identical to the message.")); + } + } else if (actual === error) { + throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error \"".concat(actual, "\" is identical to the message.")); + } + + message = error; + error = undefined; + } else if (error != null && _typeof(error) !== 'object' && typeof error !== 'function') { + throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error); + } + + if (actual === NO_EXCEPTION_SENTINEL) { + var details = ''; + + if (error && error.name) { + details += " (".concat(error.name, ")"); + } + + details += message ? ": ".concat(message) : '.'; + var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception'; + innerFail({ + actual: undefined, + expected: error, + operator: stackStartFn.name, + message: "Missing expected ".concat(fnType).concat(details), + stackStartFn: stackStartFn + }); + } + + if (error && !expectedException(actual, error, message, stackStartFn)) { + throw actual; + } +} + +function expectsNoError(stackStartFn, actual, error, message) { + if (actual === NO_EXCEPTION_SENTINEL) return; + + if (typeof error === 'string') { + message = error; + error = undefined; + } + + if (!error || expectedException(actual, error)) { + var details = message ? ": ".concat(message) : '.'; + var fnType = stackStartFn.name === 'doesNotReject' ? 'rejection' : 'exception'; + innerFail({ + actual: actual, + expected: error, + operator: stackStartFn.name, + message: "Got unwanted ".concat(fnType).concat(details, "\n") + "Actual message: \"".concat(actual && actual.message, "\""), + stackStartFn: stackStartFn + }); + } + + throw actual; +} + +assert.throws = function throws(promiseFn) { + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + + expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args)); +}; + +assert.rejects = function rejects(promiseFn) { + for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + args[_key3 - 1] = arguments[_key3]; + } + + return waitForActual(promiseFn).then(function (result) { + return expectsError.apply(void 0, [rejects, result].concat(args)); + }); +}; + +assert.doesNotThrow = function doesNotThrow(fn) { + for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { + args[_key4 - 1] = arguments[_key4]; + } + + expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args)); +}; + +assert.doesNotReject = function doesNotReject(fn) { + for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { + args[_key5 - 1] = arguments[_key5]; + } + + return waitForActual(fn).then(function (result) { + return expectsNoError.apply(void 0, [doesNotReject, result].concat(args)); + }); +}; + +assert.ifError = function ifError(err) { + if (err !== null && err !== undefined) { + var message = 'ifError got unwanted exception: '; + + if (_typeof(err) === 'object' && typeof err.message === 'string') { + if (err.message.length === 0 && err.constructor) { + message += err.constructor.name; + } else { + message += err.message; + } + } else { + message += inspect(err); + } + + var newErr = new AssertionError({ + actual: err, + expected: null, + operator: 'ifError', + message: message, + stackStartFn: ifError + }); // Make sure we actually have a stack trace! + + var origStack = err.stack; + + if (typeof origStack === 'string') { + // This will remove any duplicated frames from the error frames taken + // from within `ifError` and add the original error frames to the newly + // created ones. + var tmp2 = origStack.split('\n'); + tmp2.shift(); // Filter all frames existing in err.stack. + + var tmp1 = newErr.stack.split('\n'); + + for (var i = 0; i < tmp2.length; i++) { + // Find the first occurrence of the frame. + var pos = tmp1.indexOf(tmp2[i]); + + if (pos !== -1) { + // Only keep new frames. + tmp1 = tmp1.slice(0, pos); + break; + } + } + + newErr.stack = "".concat(tmp1.join('\n'), "\n").concat(tmp2.join('\n')); + } + + throw newErr; + } +}; // Expose a strict only variant of assert + + +function strict() { + for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { + args[_key6] = arguments[_key6]; + } + + innerOk.apply(void 0, [strict, args.length].concat(args)); +} + +assert.strict = objectAssign(strict, assert, { + equal: assert.strictEqual, + deepEqual: assert.deepStrictEqual, + notEqual: assert.notStrictEqual, + notDeepEqual: assert.notDeepStrictEqual +}); +assert.strict.strict = assert.strict; + +/***/ }), + +/***/ "./node_modules/assert/build/internal/assert/assertion_error.js": +/*!**********************************************************************!*\ + !*** ./node_modules/assert/build/internal/assert/assertion_error.js ***! + \**********************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Currently in sync with Node.js lib/internal/assert/assertion_error.js +// https://github.com/nodejs/node/commit/0817840f775032169ddd70c85ac059f18ffcc81c + + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } + +function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } + +function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +var _require = __webpack_require__(/*! util/ */ "./node_modules/assert/node_modules/util/util.js"), + inspect = _require.inspect; + +var _require2 = __webpack_require__(/*! ../errors */ "./node_modules/assert/build/internal/errors.js"), + ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat + + +function repeat(str, count) { + count = Math.floor(count); + if (str.length == 0 || count == 0) return ''; + var maxCount = str.length * count; + count = Math.floor(Math.log(count) / Math.log(2)); + + while (count) { + str += str; + count--; + } + + str += str.substring(0, maxCount - str.length); + return str; +} + +var blue = ''; +var green = ''; +var red = ''; +var white = ''; +var kReadableOperator = { + deepStrictEqual: 'Expected values to be strictly deep-equal:', + strictEqual: 'Expected values to be strictly equal:', + strictEqualObject: 'Expected "actual" to be reference-equal to "expected":', + deepEqual: 'Expected values to be loosely deep-equal:', + equal: 'Expected values to be loosely equal:', + notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:', + notStrictEqual: 'Expected "actual" to be strictly unequal to:', + notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":', + notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:', + notEqual: 'Expected "actual" to be loosely unequal to:', + notIdentical: 'Values identical but not reference-equal:' +}; // Comparing short primitives should just show === / !== instead of using the +// diff. + +var kMaxShortLength = 10; + +function copyError(source) { + var keys = Object.keys(source); + var target = Object.create(Object.getPrototypeOf(source)); + keys.forEach(function (key) { + target[key] = source[key]; + }); + Object.defineProperty(target, 'message', { + value: source.message + }); + return target; +} + +function inspectValue(val) { + // The util.inspect default values could be changed. This makes sure the + // error messages contain the necessary information nevertheless. + return inspect(val, { + compact: false, + customInspect: false, + depth: 1000, + maxArrayLength: Infinity, + // Assert compares only enumerable properties (with a few exceptions). + showHidden: false, + // Having a long line as error is better than wrapping the line for + // comparison for now. + // TODO(BridgeAR): `breakLength` should be limited as soon as soon as we + // have meta information about the inspected properties (i.e., know where + // in what line the property starts and ends). + breakLength: Infinity, + // Assert does not detect proxies currently. + showProxy: false, + sorted: true, + // Inspect getters as we also check them when comparing entries. + getters: true + }); +} + +function createErrDiff(actual, expected, operator) { + var other = ''; + var res = ''; + var lastPos = 0; + var end = ''; + var skipped = false; + var actualInspected = inspectValue(actual); + var actualLines = actualInspected.split('\n'); + var expectedLines = inspectValue(expected).split('\n'); + var i = 0; + var indicator = ''; // In case both values are objects explicitly mark them as not reference equal + // for the `strictEqual` operator. + + if (operator === 'strictEqual' && _typeof(actual) === 'object' && _typeof(expected) === 'object' && actual !== null && expected !== null) { + operator = 'strictEqualObject'; + } // If "actual" and "expected" fit on a single line and they are not strictly + // equal, check further special handling. + + + if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) { + var inputLength = actualLines[0].length + expectedLines[0].length; // If the character length of "actual" and "expected" together is less than + // kMaxShortLength and if neither is an object and at least one of them is + // not `zero`, use the strict equal comparison to visualize the output. + + if (inputLength <= kMaxShortLength) { + if ((_typeof(actual) !== 'object' || actual === null) && (_typeof(expected) !== 'object' || expected === null) && (actual !== 0 || expected !== 0)) { + // -0 === +0 + return "".concat(kReadableOperator[operator], "\n\n") + "".concat(actualLines[0], " !== ").concat(expectedLines[0], "\n"); + } + } else if (operator !== 'strictEqualObject') { + // If the stderr is a tty and the input length is lower than the current + // columns per line, add a mismatch indicator below the output. If it is + // not a tty, use a default value of 80 characters. + var maxLength = ({"env":{"NODE_ENV":"production"}}).stderr && ({"env":{"NODE_ENV":"production"}}).stderr.isTTY ? ({"env":{"NODE_ENV":"production"}}).stderr.columns : 80; + + if (inputLength < maxLength) { + while (actualLines[0][i] === expectedLines[0][i]) { + i++; + } // Ignore the first characters. + + + if (i > 2) { + // Add position indicator for the first mismatch in case it is a + // single line and the input length is less than the column length. + indicator = "\n ".concat(repeat(' ', i), "^"); + i = 0; + } + } + } + } // Remove all ending lines that match (this optimizes the output for + // readability by reducing the number of total changed lines). + + + var a = actualLines[actualLines.length - 1]; + var b = expectedLines[expectedLines.length - 1]; + + while (a === b) { + if (i++ < 2) { + end = "\n ".concat(a).concat(end); + } else { + other = a; + } + + actualLines.pop(); + expectedLines.pop(); + if (actualLines.length === 0 || expectedLines.length === 0) break; + a = actualLines[actualLines.length - 1]; + b = expectedLines[expectedLines.length - 1]; + } + + var maxLines = Math.max(actualLines.length, expectedLines.length); // Strict equal with identical objects that are not identical by reference. + // E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() }) + + if (maxLines === 0) { + // We have to get the result again. The lines were all removed before. + var _actualLines = actualInspected.split('\n'); // Only remove lines in case it makes sense to collapse those. + // TODO: Accept env to always show the full error. + + + if (_actualLines.length > 30) { + _actualLines[26] = "".concat(blue, "...").concat(white); + + while (_actualLines.length > 27) { + _actualLines.pop(); + } + } + + return "".concat(kReadableOperator.notIdentical, "\n\n").concat(_actualLines.join('\n'), "\n"); + } + + if (i > 3) { + end = "\n".concat(blue, "...").concat(white).concat(end); + skipped = true; + } + + if (other !== '') { + end = "\n ".concat(other).concat(end); + other = ''; + } + + var printedLines = 0; + var msg = kReadableOperator[operator] + "\n".concat(green, "+ actual").concat(white, " ").concat(red, "- expected").concat(white); + var skippedMsg = " ".concat(blue, "...").concat(white, " Lines skipped"); + + for (i = 0; i < maxLines; i++) { + // Only extra expected lines exist + var cur = i - lastPos; + + if (actualLines.length < i + 1) { + // If the last diverging line is more than one line above and the + // current line is at least line three, add some of the former lines and + // also add dots to indicate skipped entries. + if (cur > 1 && i > 2) { + if (cur > 4) { + res += "\n".concat(blue, "...").concat(white); + skipped = true; + } else if (cur > 3) { + res += "\n ".concat(expectedLines[i - 2]); + printedLines++; + } + + res += "\n ".concat(expectedLines[i - 1]); + printedLines++; + } // Mark the current line as the last diverging one. + + + lastPos = i; // Add the expected line to the cache. + + other += "\n".concat(red, "-").concat(white, " ").concat(expectedLines[i]); + printedLines++; // Only extra actual lines exist + } else if (expectedLines.length < i + 1) { + // If the last diverging line is more than one line above and the + // current line is at least line three, add some of the former lines and + // also add dots to indicate skipped entries. + if (cur > 1 && i > 2) { + if (cur > 4) { + res += "\n".concat(blue, "...").concat(white); + skipped = true; + } else if (cur > 3) { + res += "\n ".concat(actualLines[i - 2]); + printedLines++; + } + + res += "\n ".concat(actualLines[i - 1]); + printedLines++; + } // Mark the current line as the last diverging one. + + + lastPos = i; // Add the actual line to the result. + + res += "\n".concat(green, "+").concat(white, " ").concat(actualLines[i]); + printedLines++; // Lines diverge + } else { + var expectedLine = expectedLines[i]; + var actualLine = actualLines[i]; // If the lines diverge, specifically check for lines that only diverge by + // a trailing comma. In that case it is actually identical and we should + // mark it as such. + + var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ',') || actualLine.slice(0, -1) !== expectedLine); // If the expected line has a trailing comma but is otherwise identical, + // add a comma at the end of the actual line. Otherwise the output could + // look weird as in: + // + // [ + // 1 // No comma at the end! + // + 2 + // ] + // + + if (divergingLines && endsWith(expectedLine, ',') && expectedLine.slice(0, -1) === actualLine) { + divergingLines = false; + actualLine += ','; + } + + if (divergingLines) { + // If the last diverging line is more than one line above and the + // current line is at least line three, add some of the former lines and + // also add dots to indicate skipped entries. + if (cur > 1 && i > 2) { + if (cur > 4) { + res += "\n".concat(blue, "...").concat(white); + skipped = true; + } else if (cur > 3) { + res += "\n ".concat(actualLines[i - 2]); + printedLines++; + } + + res += "\n ".concat(actualLines[i - 1]); + printedLines++; + } // Mark the current line as the last diverging one. + + + lastPos = i; // Add the actual line to the result and cache the expected diverging + // line so consecutive diverging lines show up as +++--- and not +-+-+-. + + res += "\n".concat(green, "+").concat(white, " ").concat(actualLine); + other += "\n".concat(red, "-").concat(white, " ").concat(expectedLine); + printedLines += 2; // Lines are identical + } else { + // Add all cached information to the result before adding other things + // and reset the cache. + res += other; + other = ''; // If the last diverging line is exactly one line above or if it is the + // very first line, add the line to the result. + + if (cur === 1 || i === 0) { + res += "\n ".concat(actualLine); + printedLines++; + } + } + } // Inspected object to big (Show ~20 rows max) + + + if (printedLines > 20 && i < maxLines - 2) { + return "".concat(msg).concat(skippedMsg, "\n").concat(res, "\n").concat(blue, "...").concat(white).concat(other, "\n") + "".concat(blue, "...").concat(white); + } + } + + return "".concat(msg).concat(skipped ? skippedMsg : '', "\n").concat(res).concat(other).concat(end).concat(indicator); +} + +var AssertionError = +/*#__PURE__*/ +function (_Error) { + _inherits(AssertionError, _Error); + + function AssertionError(options) { + var _this; + + _classCallCheck(this, AssertionError); + + if (_typeof(options) !== 'object' || options === null) { + throw new ERR_INVALID_ARG_TYPE('options', 'Object', options); + } + + var message = options.message, + operator = options.operator, + stackStartFn = options.stackStartFn; + var actual = options.actual, + expected = options.expected; + var limit = Error.stackTraceLimit; + Error.stackTraceLimit = 0; + + if (message != null) { + _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, String(message))); + } else { + if (({"env":{"NODE_ENV":"production"}}).stderr && ({"env":{"NODE_ENV":"production"}}).stderr.isTTY) { + // Reset on each call to make sure we handle dynamically set environment + // variables correct. + if (({"env":{"NODE_ENV":"production"}}).stderr && ({"env":{"NODE_ENV":"production"}}).stderr.getColorDepth && ({"env":{"NODE_ENV":"production"}}).stderr.getColorDepth() !== 1) { + blue = "\x1B[34m"; + green = "\x1B[32m"; + white = "\x1B[39m"; + red = "\x1B[31m"; + } else { + blue = ''; + green = ''; + white = ''; + red = ''; + } + } // Prevent the error stack from being visible by duplicating the error + // in a very close way to the original in case both sides are actually + // instances of Error. + + + if (_typeof(actual) === 'object' && actual !== null && _typeof(expected) === 'object' && expected !== null && 'stack' in actual && actual instanceof Error && 'stack' in expected && expected instanceof Error) { + actual = copyError(actual); + expected = copyError(expected); + } + + if (operator === 'deepStrictEqual' || operator === 'strictEqual') { + _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, createErrDiff(actual, expected, operator))); + } else if (operator === 'notDeepStrictEqual' || operator === 'notStrictEqual') { + // In case the objects are equal but the operator requires unequal, show + // the first object and say A equals B + var base = kReadableOperator[operator]; + var res = inspectValue(actual).split('\n'); // In case "actual" is an object, it should not be reference equal. + + if (operator === 'notStrictEqual' && _typeof(actual) === 'object' && actual !== null) { + base = kReadableOperator.notStrictEqualObject; + } // Only remove lines in case it makes sense to collapse those. + // TODO: Accept env to always show the full error. + + + if (res.length > 30) { + res[26] = "".concat(blue, "...").concat(white); + + while (res.length > 27) { + res.pop(); + } + } // Only print a single input. + + + if (res.length === 1) { + _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, " ").concat(res[0]))); + } else { + _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, "\n\n").concat(res.join('\n'), "\n"))); + } + } else { + var _res = inspectValue(actual); + + var other = ''; + var knownOperators = kReadableOperator[operator]; + + if (operator === 'notDeepEqual' || operator === 'notEqual') { + _res = "".concat(kReadableOperator[operator], "\n\n").concat(_res); + + if (_res.length > 1024) { + _res = "".concat(_res.slice(0, 1021), "..."); + } + } else { + other = "".concat(inspectValue(expected)); + + if (_res.length > 512) { + _res = "".concat(_res.slice(0, 509), "..."); + } + + if (other.length > 512) { + other = "".concat(other.slice(0, 509), "..."); + } + + if (operator === 'deepEqual' || operator === 'equal') { + _res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n"); + } else { + other = " ".concat(operator, " ").concat(other); + } + } + + _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(_res).concat(other))); + } + } + + Error.stackTraceLimit = limit; + _this.generatedMessage = !message; + Object.defineProperty(_assertThisInitialized(_this), 'name', { + value: 'AssertionError [ERR_ASSERTION]', + enumerable: false, + writable: true, + configurable: true + }); + _this.code = 'ERR_ASSERTION'; + _this.actual = actual; + _this.expected = expected; + _this.operator = operator; + + if (Error.captureStackTrace) { + // eslint-disable-next-line no-restricted-syntax + Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn); + } // Create error message including the error code in the name. + + + _this.stack; // Reset the name. + + _this.name = 'AssertionError'; + return _possibleConstructorReturn(_this); + } + + _createClass(AssertionError, [{ + key: "toString", + value: function toString() { + return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message); + } + }, { + key: inspect.custom, + value: function value(recurseTimes, ctx) { + // This limits the `actual` and `expected` property default inspection to + // the minimum depth. Otherwise those values would be too verbose compared + // to the actual error message which contains a combined view of these two + // input values. + return inspect(this, _objectSpread({}, ctx, { + customInspect: false, + depth: 0 + })); + } + }]); + + return AssertionError; +}(_wrapNativeSuper(Error)); + +module.exports = AssertionError; + +/***/ }), + +/***/ "./node_modules/assert/build/internal/errors.js": +/*!******************************************************!*\ + !*** ./node_modules/assert/build/internal/errors.js ***! + \******************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Currently in sync with Node.js lib/internal/errors.js +// https://github.com/nodejs/node/commit/3b044962c48fe313905877a96b5d0894a5404f6f + +/* eslint node-core/documented-errors: "error" */ + +/* eslint node-core/alphabetize-errors: "error" */ + +/* eslint node-core/prefer-util-format-errors: "error" */ + // The whole point behind this internal module is to allow Node.js to no +// longer be forced to treat every error message change as a semver-major +// change. The NodeError classes here all expose a `code` property whose +// value statically and permanently identifies the error. While the error +// message may change, the code should not. + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +var codes = {}; // Lazy loaded + +var assert; +var util; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } + + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inherits(NodeError, _Base); + + function NodeError(arg1, arg2, arg3) { + var _this; + + _classCallCheck(this, NodeError); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError).call(this, getMessage(arg1, arg2, arg3))); + _this.code = code; + return _this; + } + + return NodeError; + }(Base); + + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js + + +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith + + +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_AMBIGUOUS_ARGUMENT', 'The "%s" argument is ambiguous. %s', TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + if (assert === undefined) assert = __webpack_require__(/*! ../assert */ "./node_modules/assert/build/assert.js"); + assert(typeof name === 'string', "'name' must be a string"); // determiner: 'must be' or 'must not be' + + var determiner; + + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + var msg; + + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } // TODO(BridgeAR): Improve the output by showing `null` and similar. + + + msg += ". Received type ".concat(_typeof(actual)); + return msg; +}, TypeError); +createErrorType('ERR_INVALID_ARG_VALUE', function (name, value) { + var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid'; + if (util === undefined) util = __webpack_require__(/*! util/ */ "./node_modules/assert/node_modules/util/util.js"); + var inspected = util.inspect(value); + + if (inspected.length > 128) { + inspected = "".concat(inspected.slice(0, 128), "..."); + } + + return "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected); +}, TypeError, RangeError); +createErrorType('ERR_INVALID_RETURN_VALUE', function (input, name, value) { + var type; + + if (value && value.constructor && value.constructor.name) { + type = "instance of ".concat(value.constructor.name); + } else { + type = "type ".concat(_typeof(value)); + } + + return "Expected ".concat(input, " to be returned from the \"").concat(name, "\"") + " function but got ".concat(type, "."); +}, TypeError); +createErrorType('ERR_MISSING_ARGS', function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (assert === undefined) assert = __webpack_require__(/*! ../assert */ "./node_modules/assert/build/assert.js"); + assert(args.length > 0, 'At least one arg needs to be specified'); + var msg = 'The '; + var len = args.length; + args = args.map(function (a) { + return "\"".concat(a, "\""); + }); + + switch (len) { + case 1: + msg += "".concat(args[0], " argument"); + break; + + case 2: + msg += "".concat(args[0], " and ").concat(args[1], " arguments"); + break; + + default: + msg += args.slice(0, len - 1).join(', '); + msg += ", and ".concat(args[len - 1], " arguments"); + break; + } + + return "".concat(msg, " must be specified"); +}, TypeError); +module.exports.codes = codes; + +/***/ }), + +/***/ "./node_modules/assert/build/internal/util/comparisons.js": +/*!****************************************************************!*\ + !*** ./node_modules/assert/build/internal/util/comparisons.js ***! + \****************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Currently in sync with Node.js lib/internal/util/comparisons.js +// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 + + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +var regexFlagsSupported = /a/g.flags !== undefined; + +var arrayFromSet = function arrayFromSet(set) { + var array = []; + set.forEach(function (value) { + return array.push(value); + }); + return array; +}; + +var arrayFromMap = function arrayFromMap(map) { + var array = []; + map.forEach(function (value, key) { + return array.push([key, value]); + }); + return array; +}; + +var objectIs = Object.is ? Object.is : __webpack_require__(/*! object-is */ "./node_modules/object-is/index.js"); +var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function () { + return []; +}; +var numberIsNaN = Number.isNaN ? Number.isNaN : __webpack_require__(/*! is-nan */ "./node_modules/is-nan/index.js"); + +function uncurryThis(f) { + return f.call.bind(f); +} + +var hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty); +var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable); +var objectToString = uncurryThis(Object.prototype.toString); + +var _require$types = (__webpack_require__(/*! util/ */ "./node_modules/assert/node_modules/util/util.js").types), + isAnyArrayBuffer = _require$types.isAnyArrayBuffer, + isArrayBufferView = _require$types.isArrayBufferView, + isDate = _require$types.isDate, + isMap = _require$types.isMap, + isRegExp = _require$types.isRegExp, + isSet = _require$types.isSet, + isNativeError = _require$types.isNativeError, + isBoxedPrimitive = _require$types.isBoxedPrimitive, + isNumberObject = _require$types.isNumberObject, + isStringObject = _require$types.isStringObject, + isBooleanObject = _require$types.isBooleanObject, + isBigIntObject = _require$types.isBigIntObject, + isSymbolObject = _require$types.isSymbolObject, + isFloat32Array = _require$types.isFloat32Array, + isFloat64Array = _require$types.isFloat64Array; + +function isNonIndex(key) { + if (key.length === 0 || key.length > 10) return true; + + for (var i = 0; i < key.length; i++) { + var code = key.charCodeAt(i); + if (code < 48 || code > 57) return true; + } // The maximum size for an array is 2 ** 32 -1. + + + return key.length === 10 && key >= Math.pow(2, 32); +} + +function getOwnNonIndexProperties(value) { + return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value))); +} // Taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js +// original notice: + +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + + +function compare(a, b) { + if (a === b) { + return 0; + } + + var x = a.length; + var y = b.length; + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i]; + y = b[i]; + break; + } + } + + if (x < y) { + return -1; + } + + if (y < x) { + return 1; + } + + return 0; +} + +var ONLY_ENUMERABLE = undefined; +var kStrict = true; +var kLoose = false; +var kNoIterator = 0; +var kIsArray = 1; +var kIsSet = 2; +var kIsMap = 3; // Check if they have the same source and flags + +function areSimilarRegExps(a, b) { + return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b); +} + +function areSimilarFloatArrays(a, b) { + if (a.byteLength !== b.byteLength) { + return false; + } + + for (var offset = 0; offset < a.byteLength; offset++) { + if (a[offset] !== b[offset]) { + return false; + } + } + + return true; +} + +function areSimilarTypedArrays(a, b) { + if (a.byteLength !== b.byteLength) { + return false; + } + + return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0; +} + +function areEqualArrayBuffers(buf1, buf2) { + return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0; +} + +function isEqualBoxedPrimitive(val1, val2) { + if (isNumberObject(val1)) { + return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2)); + } + + if (isStringObject(val1)) { + return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2); + } + + if (isBooleanObject(val1)) { + return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2); + } + + if (isBigIntObject(val1)) { + return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2); + } + + return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2); +} // Notes: Type tags are historical [[Class]] properties that can be set by +// FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS +// and retrieved using Object.prototype.toString.call(obj) in JS +// See https://tc39.github.io/ecma262/#sec-object.prototype.tostring +// for a list of tags pre-defined in the spec. +// There are some unspecified tags in the wild too (e.g. typed array tags). +// Since tags can be altered, they only serve fast failures +// +// Typed arrays and buffers are checked by comparing the content in their +// underlying ArrayBuffer. This optimization requires that it's +// reasonable to interpret their underlying memory in the same way, +// which is checked by comparing their type tags. +// (e.g. a Uint8Array and a Uint16Array with the same memory content +// could still be different because they will be interpreted differently). +// +// For strict comparison, objects should have +// a) The same built-in type tags +// b) The same prototypes. + + +function innerDeepEqual(val1, val2, strict, memos) { + // All identical values are equivalent, as determined by ===. + if (val1 === val2) { + if (val1 !== 0) return true; + return strict ? objectIs(val1, val2) : true; + } // Check more closely if val1 and val2 are equal. + + + if (strict) { + if (_typeof(val1) !== 'object') { + return typeof val1 === 'number' && numberIsNaN(val1) && numberIsNaN(val2); + } + + if (_typeof(val2) !== 'object' || val1 === null || val2 === null) { + return false; + } + + if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) { + return false; + } + } else { + if (val1 === null || _typeof(val1) !== 'object') { + if (val2 === null || _typeof(val2) !== 'object') { + // eslint-disable-next-line eqeqeq + return val1 == val2; + } + + return false; + } + + if (val2 === null || _typeof(val2) !== 'object') { + return false; + } + } + + var val1Tag = objectToString(val1); + var val2Tag = objectToString(val2); + + if (val1Tag !== val2Tag) { + return false; + } + + if (Array.isArray(val1)) { + // Check for sparse arrays and general fast path + if (val1.length !== val2.length) { + return false; + } + + var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE); + var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE); + + if (keys1.length !== keys2.length) { + return false; + } + + return keyCheck(val1, val2, strict, memos, kIsArray, keys1); + } // [browserify] This triggers on certain types in IE (Map/Set) so we don't + // wan't to early return out of the rest of the checks. However we can check + // if the second value is one of these values and the first isn't. + + + if (val1Tag === '[object Object]') { + // return keyCheck(val1, val2, strict, memos, kNoIterator); + if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) { + return false; + } + } + + if (isDate(val1)) { + if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) { + return false; + } + } else if (isRegExp(val1)) { + if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) { + return false; + } + } else if (isNativeError(val1) || val1 instanceof Error) { + // Do not compare the stack as it might differ even though the error itself + // is otherwise identical. + if (val1.message !== val2.message || val1.name !== val2.name) { + return false; + } + } else if (isArrayBufferView(val1)) { + if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) { + if (!areSimilarFloatArrays(val1, val2)) { + return false; + } + } else if (!areSimilarTypedArrays(val1, val2)) { + return false; + } // Buffer.compare returns true, so val1.length === val2.length. If they both + // only contain numeric keys, we don't need to exam further than checking + // the symbols. + + + var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE); + + var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE); + + if (_keys.length !== _keys2.length) { + return false; + } + + return keyCheck(val1, val2, strict, memos, kNoIterator, _keys); + } else if (isSet(val1)) { + if (!isSet(val2) || val1.size !== val2.size) { + return false; + } + + return keyCheck(val1, val2, strict, memos, kIsSet); + } else if (isMap(val1)) { + if (!isMap(val2) || val1.size !== val2.size) { + return false; + } + + return keyCheck(val1, val2, strict, memos, kIsMap); + } else if (isAnyArrayBuffer(val1)) { + if (!areEqualArrayBuffers(val1, val2)) { + return false; + } + } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) { + return false; + } + + return keyCheck(val1, val2, strict, memos, kNoIterator); +} + +function getEnumerables(val, keys) { + return keys.filter(function (k) { + return propertyIsEnumerable(val, k); + }); +} + +function keyCheck(val1, val2, strict, memos, iterationType, aKeys) { + // For all remaining Object pairs, including Array, objects and Maps, + // equivalence is determined by having: + // a) The same number of owned enumerable properties + // b) The same set of keys/indexes (although not necessarily the same order) + // c) Equivalent values for every corresponding key/index + // d) For Sets and Maps, equal contents + // Note: this accounts for both named and indexed properties on Arrays. + if (arguments.length === 5) { + aKeys = Object.keys(val1); + var bKeys = Object.keys(val2); // The pair must have the same number of owned properties. + + if (aKeys.length !== bKeys.length) { + return false; + } + } // Cheap key test + + + var i = 0; + + for (; i < aKeys.length; i++) { + if (!hasOwnProperty(val2, aKeys[i])) { + return false; + } + } + + if (strict && arguments.length === 5) { + var symbolKeysA = objectGetOwnPropertySymbols(val1); + + if (symbolKeysA.length !== 0) { + var count = 0; + + for (i = 0; i < symbolKeysA.length; i++) { + var key = symbolKeysA[i]; + + if (propertyIsEnumerable(val1, key)) { + if (!propertyIsEnumerable(val2, key)) { + return false; + } + + aKeys.push(key); + count++; + } else if (propertyIsEnumerable(val2, key)) { + return false; + } + } + + var symbolKeysB = objectGetOwnPropertySymbols(val2); + + if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) { + return false; + } + } else { + var _symbolKeysB = objectGetOwnPropertySymbols(val2); + + if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) { + return false; + } + } + } + + if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) { + return true; + } // Use memos to handle cycles. + + + if (memos === undefined) { + memos = { + val1: new Map(), + val2: new Map(), + position: 0 + }; + } else { + // We prevent up to two map.has(x) calls by directly retrieving the value + // and checking for undefined. The map can only contain numbers, so it is + // safe to check for undefined only. + var val2MemoA = memos.val1.get(val1); + + if (val2MemoA !== undefined) { + var val2MemoB = memos.val2.get(val2); + + if (val2MemoB !== undefined) { + return val2MemoA === val2MemoB; + } + } + + memos.position++; + } + + memos.val1.set(val1, memos.position); + memos.val2.set(val2, memos.position); + var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType); + memos.val1.delete(val1); + memos.val2.delete(val2); + return areEq; +} + +function setHasEqualElement(set, val1, strict, memo) { + // Go looking. + var setValues = arrayFromSet(set); + + for (var i = 0; i < setValues.length; i++) { + var val2 = setValues[i]; + + if (innerDeepEqual(val1, val2, strict, memo)) { + // Remove the matching element to make sure we do not check that again. + set.delete(val2); + return true; + } + } + + return false; +} // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using +// Sadly it is not possible to detect corresponding values properly in case the +// type is a string, number, bigint or boolean. The reason is that those values +// can match lots of different string values (e.g., 1n == '+00001'). + + +function findLooseMatchingPrimitives(prim) { + switch (_typeof(prim)) { + case 'undefined': + return null; + + case 'object': + // Only pass in null as object! + return undefined; + + case 'symbol': + return false; + + case 'string': + prim = +prim; + // Loose equal entries exist only if the string is possible to convert to + // a regular number and not NaN. + // Fall through + + case 'number': + if (numberIsNaN(prim)) { + return false; + } + + } + + return true; +} + +function setMightHaveLoosePrim(a, b, prim) { + var altValue = findLooseMatchingPrimitives(prim); + if (altValue != null) return altValue; + return b.has(altValue) && !a.has(altValue); +} + +function mapMightHaveLoosePrim(a, b, prim, item, memo) { + var altValue = findLooseMatchingPrimitives(prim); + + if (altValue != null) { + return altValue; + } + + var curB = b.get(altValue); + + if (curB === undefined && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) { + return false; + } + + return !a.has(altValue) && innerDeepEqual(item, curB, false, memo); +} + +function setEquiv(a, b, strict, memo) { + // This is a lazily initiated Set of entries which have to be compared + // pairwise. + var set = null; + var aValues = arrayFromSet(a); + + for (var i = 0; i < aValues.length; i++) { + var val = aValues[i]; // Note: Checking for the objects first improves the performance for object + // heavy sets but it is a minor slow down for primitives. As they are fast + // to check this improves the worst case scenario instead. + + if (_typeof(val) === 'object' && val !== null) { + if (set === null) { + set = new Set(); + } // If the specified value doesn't exist in the second set its an not null + // object (or non strict only: a not matching primitive) we'll need to go + // hunting for something thats deep-(strict-)equal to it. To make this + // O(n log n) complexity we have to copy these values in a new set first. + + + set.add(val); + } else if (!b.has(val)) { + if (strict) return false; // Fast path to detect missing string, symbol, undefined and null values. + + if (!setMightHaveLoosePrim(a, b, val)) { + return false; + } + + if (set === null) { + set = new Set(); + } + + set.add(val); + } + } + + if (set !== null) { + var bValues = arrayFromSet(b); + + for (var _i = 0; _i < bValues.length; _i++) { + var _val = bValues[_i]; // We have to check if a primitive value is already + // matching and only if it's not, go hunting for it. + + if (_typeof(_val) === 'object' && _val !== null) { + if (!setHasEqualElement(set, _val, strict, memo)) return false; + } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) { + return false; + } + } + + return set.size === 0; + } + + return true; +} + +function mapHasEqualEntry(set, map, key1, item1, strict, memo) { + // To be able to handle cases like: + // Map([[{}, 'a'], [{}, 'b']]) vs Map([[{}, 'b'], [{}, 'a']]) + // ... we need to consider *all* matching keys, not just the first we find. + var setValues = arrayFromSet(set); + + for (var i = 0; i < setValues.length; i++) { + var key2 = setValues[i]; + + if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) { + set.delete(key2); + return true; + } + } + + return false; +} + +function mapEquiv(a, b, strict, memo) { + var set = null; + var aEntries = arrayFromMap(a); + + for (var i = 0; i < aEntries.length; i++) { + var _aEntries$i = _slicedToArray(aEntries[i], 2), + key = _aEntries$i[0], + item1 = _aEntries$i[1]; + + if (_typeof(key) === 'object' && key !== null) { + if (set === null) { + set = new Set(); + } + + set.add(key); + } else { + // By directly retrieving the value we prevent another b.has(key) check in + // almost all possible cases. + var item2 = b.get(key); + + if (item2 === undefined && !b.has(key) || !innerDeepEqual(item1, item2, strict, memo)) { + if (strict) return false; // Fast path to detect missing string, symbol, undefined and null + // keys. + + if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false; + + if (set === null) { + set = new Set(); + } + + set.add(key); + } + } + } + + if (set !== null) { + var bEntries = arrayFromMap(b); + + for (var _i2 = 0; _i2 < bEntries.length; _i2++) { + var _bEntries$_i = _slicedToArray(bEntries[_i2], 2), + key = _bEntries$_i[0], + item = _bEntries$_i[1]; + + if (_typeof(key) === 'object' && key !== null) { + if (!mapHasEqualEntry(set, a, key, item, strict, memo)) return false; + } else if (!strict && (!a.has(key) || !innerDeepEqual(a.get(key), item, false, memo)) && !mapHasEqualEntry(set, a, key, item, false, memo)) { + return false; + } + } + + return set.size === 0; + } + + return true; +} + +function objEquiv(a, b, strict, keys, memos, iterationType) { + // Sets and maps don't have their entries accessible via normal object + // properties. + var i = 0; + + if (iterationType === kIsSet) { + if (!setEquiv(a, b, strict, memos)) { + return false; + } + } else if (iterationType === kIsMap) { + if (!mapEquiv(a, b, strict, memos)) { + return false; + } + } else if (iterationType === kIsArray) { + for (; i < a.length; i++) { + if (hasOwnProperty(a, i)) { + if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) { + return false; + } + } else if (hasOwnProperty(b, i)) { + return false; + } else { + // Array is sparse. + var keysA = Object.keys(a); + + for (; i < keysA.length; i++) { + var key = keysA[i]; + + if (!hasOwnProperty(b, key) || !innerDeepEqual(a[key], b[key], strict, memos)) { + return false; + } + } + + if (keysA.length !== Object.keys(b).length) { + return false; + } + + return true; + } + } + } // The pair must have equivalent values for every corresponding key. + // Possibly expensive deep test: + + + for (i = 0; i < keys.length; i++) { + var _key = keys[i]; + + if (!innerDeepEqual(a[_key], b[_key], strict, memos)) { + return false; + } + } + + return true; +} + +function isDeepEqual(val1, val2) { + return innerDeepEqual(val1, val2, kLoose); +} + +function isDeepStrictEqual(val1, val2) { + return innerDeepEqual(val1, val2, kStrict); +} + +module.exports = { + isDeepEqual: isDeepEqual, + isDeepStrictEqual: isDeepStrictEqual +}; + +/***/ }), + +/***/ "./node_modules/assert/node_modules/util/support/isBufferBrowser.js": +/*!**************************************************************************!*\ + !*** ./node_modules/assert/node_modules/util/support/isBufferBrowser.js ***! + \**************************************************************************/ +/***/ (function(module) { + +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; +} + +/***/ }), + +/***/ "./node_modules/assert/node_modules/util/support/types.js": +/*!****************************************************************!*\ + !*** ./node_modules/assert/node_modules/util/support/types.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +// Currently in sync with Node.js lib/internal/util/types.js +// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 + + + +var isArgumentsObject = __webpack_require__(/*! is-arguments */ "./node_modules/is-arguments/index.js"); +var isGeneratorFunction = __webpack_require__(/*! is-generator-function */ "./node_modules/is-generator-function/index.js"); +var whichTypedArray = __webpack_require__(/*! which-typed-array */ "./node_modules/which-typed-array/index.js"); +var isTypedArray = __webpack_require__(/*! is-typed-array */ "./node_modules/is-typed-array/index.js"); + +function uncurryThis(f) { + return f.call.bind(f); +} + +var BigIntSupported = typeof BigInt !== 'undefined'; +var SymbolSupported = typeof Symbol !== 'undefined'; + +var ObjectToString = uncurryThis(Object.prototype.toString); + +var numberValue = uncurryThis(Number.prototype.valueOf); +var stringValue = uncurryThis(String.prototype.valueOf); +var booleanValue = uncurryThis(Boolean.prototype.valueOf); + +if (BigIntSupported) { + var bigIntValue = uncurryThis(BigInt.prototype.valueOf); +} + +if (SymbolSupported) { + var symbolValue = uncurryThis(Symbol.prototype.valueOf); +} + +function checkBoxedPrimitive(value, prototypeValueOf) { + if (typeof value !== 'object') { + return false; + } + try { + prototypeValueOf(value); + return true; + } catch(e) { + return false; + } +} + +exports.isArgumentsObject = isArgumentsObject; +exports.isGeneratorFunction = isGeneratorFunction; +exports.isTypedArray = isTypedArray; + +// Taken from here and modified for better browser support +// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js +function isPromise(input) { + return ( + ( + typeof Promise !== 'undefined' && + input instanceof Promise + ) || + ( + input !== null && + typeof input === 'object' && + typeof input.then === 'function' && + typeof input.catch === 'function' + ) + ); +} +exports.isPromise = isPromise; + +function isArrayBufferView(value) { + if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) { + return ArrayBuffer.isView(value); + } + + return ( + isTypedArray(value) || + isDataView(value) + ); +} +exports.isArrayBufferView = isArrayBufferView; + + +function isUint8Array(value) { + return whichTypedArray(value) === 'Uint8Array'; +} +exports.isUint8Array = isUint8Array; + +function isUint8ClampedArray(value) { + return whichTypedArray(value) === 'Uint8ClampedArray'; +} +exports.isUint8ClampedArray = isUint8ClampedArray; + +function isUint16Array(value) { + return whichTypedArray(value) === 'Uint16Array'; +} +exports.isUint16Array = isUint16Array; + +function isUint32Array(value) { + return whichTypedArray(value) === 'Uint32Array'; +} +exports.isUint32Array = isUint32Array; + +function isInt8Array(value) { + return whichTypedArray(value) === 'Int8Array'; +} +exports.isInt8Array = isInt8Array; + +function isInt16Array(value) { + return whichTypedArray(value) === 'Int16Array'; +} +exports.isInt16Array = isInt16Array; + +function isInt32Array(value) { + return whichTypedArray(value) === 'Int32Array'; +} +exports.isInt32Array = isInt32Array; + +function isFloat32Array(value) { + return whichTypedArray(value) === 'Float32Array'; +} +exports.isFloat32Array = isFloat32Array; + +function isFloat64Array(value) { + return whichTypedArray(value) === 'Float64Array'; +} +exports.isFloat64Array = isFloat64Array; + +function isBigInt64Array(value) { + return whichTypedArray(value) === 'BigInt64Array'; +} +exports.isBigInt64Array = isBigInt64Array; + +function isBigUint64Array(value) { + return whichTypedArray(value) === 'BigUint64Array'; +} +exports.isBigUint64Array = isBigUint64Array; + +function isMapToString(value) { + return ObjectToString(value) === '[object Map]'; +} +isMapToString.working = ( + typeof Map !== 'undefined' && + isMapToString(new Map()) +); + +function isMap(value) { + if (typeof Map === 'undefined') { + return false; + } + + return isMapToString.working + ? isMapToString(value) + : value instanceof Map; +} +exports.isMap = isMap; + +function isSetToString(value) { + return ObjectToString(value) === '[object Set]'; +} +isSetToString.working = ( + typeof Set !== 'undefined' && + isSetToString(new Set()) +); +function isSet(value) { + if (typeof Set === 'undefined') { + return false; + } + + return isSetToString.working + ? isSetToString(value) + : value instanceof Set; +} +exports.isSet = isSet; + +function isWeakMapToString(value) { + return ObjectToString(value) === '[object WeakMap]'; +} +isWeakMapToString.working = ( + typeof WeakMap !== 'undefined' && + isWeakMapToString(new WeakMap()) +); +function isWeakMap(value) { + if (typeof WeakMap === 'undefined') { + return false; + } + + return isWeakMapToString.working + ? isWeakMapToString(value) + : value instanceof WeakMap; +} +exports.isWeakMap = isWeakMap; + +function isWeakSetToString(value) { + return ObjectToString(value) === '[object WeakSet]'; +} +isWeakSetToString.working = ( + typeof WeakSet !== 'undefined' && + isWeakSetToString(new WeakSet()) +); +function isWeakSet(value) { + return isWeakSetToString(value); +} +exports.isWeakSet = isWeakSet; + +function isArrayBufferToString(value) { + return ObjectToString(value) === '[object ArrayBuffer]'; +} +isArrayBufferToString.working = ( + typeof ArrayBuffer !== 'undefined' && + isArrayBufferToString(new ArrayBuffer()) +); +function isArrayBuffer(value) { + if (typeof ArrayBuffer === 'undefined') { + return false; + } + + return isArrayBufferToString.working + ? isArrayBufferToString(value) + : value instanceof ArrayBuffer; +} +exports.isArrayBuffer = isArrayBuffer; + +function isDataViewToString(value) { + return ObjectToString(value) === '[object DataView]'; +} +isDataViewToString.working = ( + typeof ArrayBuffer !== 'undefined' && + typeof DataView !== 'undefined' && + isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)) +); +function isDataView(value) { + if (typeof DataView === 'undefined') { + return false; + } + + return isDataViewToString.working + ? isDataViewToString(value) + : value instanceof DataView; +} +exports.isDataView = isDataView; + +// Store a copy of SharedArrayBuffer in case it's deleted elsewhere +var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined; +function isSharedArrayBufferToString(value) { + return ObjectToString(value) === '[object SharedArrayBuffer]'; +} +function isSharedArrayBuffer(value) { + if (typeof SharedArrayBufferCopy === 'undefined') { + return false; + } + + if (typeof isSharedArrayBufferToString.working === 'undefined') { + isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); + } + + return isSharedArrayBufferToString.working + ? isSharedArrayBufferToString(value) + : value instanceof SharedArrayBufferCopy; +} +exports.isSharedArrayBuffer = isSharedArrayBuffer; + +function isAsyncFunction(value) { + return ObjectToString(value) === '[object AsyncFunction]'; +} +exports.isAsyncFunction = isAsyncFunction; + +function isMapIterator(value) { + return ObjectToString(value) === '[object Map Iterator]'; +} +exports.isMapIterator = isMapIterator; + +function isSetIterator(value) { + return ObjectToString(value) === '[object Set Iterator]'; +} +exports.isSetIterator = isSetIterator; + +function isGeneratorObject(value) { + return ObjectToString(value) === '[object Generator]'; +} +exports.isGeneratorObject = isGeneratorObject; + +function isWebAssemblyCompiledModule(value) { + return ObjectToString(value) === '[object WebAssembly.Module]'; +} +exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; + +function isNumberObject(value) { + return checkBoxedPrimitive(value, numberValue); +} +exports.isNumberObject = isNumberObject; + +function isStringObject(value) { + return checkBoxedPrimitive(value, stringValue); +} +exports.isStringObject = isStringObject; + +function isBooleanObject(value) { + return checkBoxedPrimitive(value, booleanValue); +} +exports.isBooleanObject = isBooleanObject; + +function isBigIntObject(value) { + return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); +} +exports.isBigIntObject = isBigIntObject; + +function isSymbolObject(value) { + return SymbolSupported && checkBoxedPrimitive(value, symbolValue); +} +exports.isSymbolObject = isSymbolObject; + +function isBoxedPrimitive(value) { + return ( + isNumberObject(value) || + isStringObject(value) || + isBooleanObject(value) || + isBigIntObject(value) || + isSymbolObject(value) + ); +} +exports.isBoxedPrimitive = isBoxedPrimitive; + +function isAnyArrayBuffer(value) { + return typeof Uint8Array !== 'undefined' && ( + isArrayBuffer(value) || + isSharedArrayBuffer(value) + ); +} +exports.isAnyArrayBuffer = isAnyArrayBuffer; + +['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) { + Object.defineProperty(exports, method, { + enumerable: false, + value: function() { + throw new Error(method + ' is not supported in userland'); + } + }); +}); + + +/***/ }), + +/***/ "./node_modules/assert/node_modules/util/util.js": +/*!*******************************************************!*\ + !*** ./node_modules/assert/node_modules/util/util.js ***! + \*******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || + function getOwnPropertyDescriptors(obj) { + var keys = Object.keys(obj); + var descriptors = {}; + for (var i = 0; i < keys.length; i++) { + descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); + } + return descriptors; + }; + +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; + + +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + if ( true && ({"env":{"NODE_ENV":"production"}}).noDeprecation === true) { + return fn; + } + + // Allow for deprecating things in the process of starting up. + if (false) {} + + var warned = false; + function deprecated() { + if (!warned) { + if (({"env":{"NODE_ENV":"production"}}).throwDeprecation) { + throw new Error(msg); + } else if (({"env":{"NODE_ENV":"production"}}).traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +}; + + +var debugs = {}; +var debugEnvRegex = /^$/; + +if (({"NODE_ENV":"production"}).NODE_DEBUG) { + var debugEnv = ({"NODE_ENV":"production"}).NODE_DEBUG; + debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&') + .replace(/\*/g, '.*') + .replace(/,/g, '$|^') + .toUpperCase(); + debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i'); +} +exports.debuglog = function(set) { + set = set.toUpperCase(); + if (!debugs[set]) { + if (debugEnvRegex.test(set)) { + var pid = ({"env":{"NODE_ENV":"production"}}).pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; +}; + + +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); +} +exports.inspect = inspect; + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; + +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; + + +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } +} + + +function stylizeNoColor(str, styleType) { + return str; +} + + +function arrayToHash(array) { + var hash = {}; + + array.forEach(function(val, idx) { + hash[val] = true; + }); + + return hash; +} + + +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } + + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', array = false, braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); +} + + +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + + +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} + + +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; +} + + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').slice(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.slice(1, -1); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; +} + + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} + + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +exports.types = __webpack_require__(/*! ./support/types */ "./node_modules/assert/node_modules/util/support/types.js"); + +function isArray(ar) { + return Array.isArray(ar); +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; +exports.types.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; +exports.types.isDate = isDate; + +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; +exports.types.isNativeError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = __webpack_require__(/*! ./support/isBuffer */ "./node_modules/assert/node_modules/util/support/isBufferBrowser.js"); + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} + + +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; + +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} + + +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; + + +/** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ +exports.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); + +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +}; + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined; + +exports.promisify = function promisify(original) { + if (typeof original !== 'function') + throw new TypeError('The "original" argument must be of type Function'); + + if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { + var fn = original[kCustomPromisifiedSymbol]; + if (typeof fn !== 'function') { + throw new TypeError('The "util.promisify.custom" argument must be of type Function'); + } + Object.defineProperty(fn, kCustomPromisifiedSymbol, { + value: fn, enumerable: false, writable: false, configurable: true + }); + return fn; + } + + function fn() { + var promiseResolve, promiseReject; + var promise = new Promise(function (resolve, reject) { + promiseResolve = resolve; + promiseReject = reject; + }); + + var args = []; + for (var i = 0; i < arguments.length; i++) { + args.push(arguments[i]); + } + args.push(function (err, value) { + if (err) { + promiseReject(err); + } else { + promiseResolve(value); + } + }); + + try { + original.apply(this, args); + } catch (err) { + promiseReject(err); + } + + return promise; + } + + Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); + + if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, { + value: fn, enumerable: false, writable: false, configurable: true + }); + return Object.defineProperties( + fn, + getOwnPropertyDescriptors(original) + ); +} + +exports.promisify.custom = kCustomPromisifiedSymbol + +function callbackifyOnRejected(reason, cb) { + // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M). + // Because `null` is a special error value in callbacks which means "no error + // occurred", we error-wrap so the callback consumer can distinguish between + // "the promise rejected with null" or "the promise fulfilled with undefined". + if (!reason) { + var newReason = new Error('Promise was rejected with a falsy value'); + newReason.reason = reason; + reason = newReason; + } + return cb(reason); +} + +function callbackify(original) { + if (typeof original !== 'function') { + throw new TypeError('The "original" argument must be of type Function'); + } + + // We DO NOT return the promise as it gives the user a false sense that + // the promise is actually somehow related to the callback's execution + // and that the callback throwing will reject the promise. + function callbackified() { + var args = []; + for (var i = 0; i < arguments.length; i++) { + args.push(arguments[i]); + } + + var maybeCb = args.pop(); + if (typeof maybeCb !== 'function') { + throw new TypeError('The last argument must be of type Function'); + } + var self = this; + var cb = function() { + return maybeCb.apply(self, arguments); + }; + // In true node style we process the callback on `nextTick` with all the + // implications (stack, `uncaughtException`, `async_hooks`) + original.apply(this, args) + .then(function(ret) { ({"env":{"NODE_ENV":"production"}}).nextTick(cb.bind(null, null, ret)) }, + function(rej) { ({"env":{"NODE_ENV":"production"}}).nextTick(callbackifyOnRejected.bind(null, rej, cb)) }); + } + + Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); + Object.defineProperties(callbackified, + getOwnPropertyDescriptors(original)); + return callbackified; +} +exports.callbackify = callbackify; + + +/***/ }), + +/***/ "./node_modules/axios/node_modules/form-data/lib/browser.js": +/*!******************************************************************!*\ + !*** ./node_modules/axios/node_modules/form-data/lib/browser.js ***! + \******************************************************************/ +/***/ (function(module) { + +/* eslint-env browser */ +module.exports = typeof self == 'object' ? self.FormData : window.FormData; + + +/***/ }), + +/***/ "./node_modules/base64-js/index.js": +/*!*****************************************!*\ + !*** ./node_modules/base64-js/index.js ***! + \*****************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + + +exports.byteLength = byteLength +exports.toByteArray = toByteArray +exports.fromByteArray = fromByteArray + +var lookup = [] +var revLookup = [] +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array + +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i +} + +// Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 + +function getLens (b64) { + var len = b64.length + + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len + + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + + return [validLen, placeHoldersLen] +} + +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + + var curByte = 0 + + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + return arr +} + +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] +} + +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + output.push(tripletToBase64(tmp)) + } + return output.join('') +} + +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) + } + + return parts.join('') +} + + +/***/ }), + +/***/ "./node_modules/bech32/index.js": +/*!**************************************!*\ + !*** ./node_modules/bech32/index.js ***! + \**************************************/ +/***/ (function(module) { + +"use strict"; + +var ALPHABET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l' + +// pre-compute lookup table +var ALPHABET_MAP = {} +for (var z = 0; z < ALPHABET.length; z++) { + var x = ALPHABET.charAt(z) + + if (ALPHABET_MAP[x] !== undefined) throw new TypeError(x + ' is ambiguous') + ALPHABET_MAP[x] = z +} + +function polymodStep (pre) { + var b = pre >> 25 + return ((pre & 0x1FFFFFF) << 5) ^ + (-((b >> 0) & 1) & 0x3b6a57b2) ^ + (-((b >> 1) & 1) & 0x26508e6d) ^ + (-((b >> 2) & 1) & 0x1ea119fa) ^ + (-((b >> 3) & 1) & 0x3d4233dd) ^ + (-((b >> 4) & 1) & 0x2a1462b3) +} + +function prefixChk (prefix) { + var chk = 1 + for (var i = 0; i < prefix.length; ++i) { + var c = prefix.charCodeAt(i) + if (c < 33 || c > 126) return 'Invalid prefix (' + prefix + ')' + + chk = polymodStep(chk) ^ (c >> 5) + } + chk = polymodStep(chk) + + for (i = 0; i < prefix.length; ++i) { + var v = prefix.charCodeAt(i) + chk = polymodStep(chk) ^ (v & 0x1f) + } + return chk +} + +function encode (prefix, words, LIMIT) { + LIMIT = LIMIT || 90 + if ((prefix.length + 7 + words.length) > LIMIT) throw new TypeError('Exceeds length limit') + + prefix = prefix.toLowerCase() + + // determine chk mod + var chk = prefixChk(prefix) + if (typeof chk === 'string') throw new Error(chk) + + var result = prefix + '1' + for (var i = 0; i < words.length; ++i) { + var x = words[i] + if ((x >> 5) !== 0) throw new Error('Non 5-bit word') + + chk = polymodStep(chk) ^ x + result += ALPHABET.charAt(x) + } + + for (i = 0; i < 6; ++i) { + chk = polymodStep(chk) + } + chk ^= 1 + + for (i = 0; i < 6; ++i) { + var v = (chk >> ((5 - i) * 5)) & 0x1f + result += ALPHABET.charAt(v) + } + + return result +} + +function __decode (str, LIMIT) { + LIMIT = LIMIT || 90 + if (str.length < 8) return str + ' too short' + if (str.length > LIMIT) return 'Exceeds length limit' + + // don't allow mixed case + var lowered = str.toLowerCase() + var uppered = str.toUpperCase() + if (str !== lowered && str !== uppered) return 'Mixed-case string ' + str + str = lowered + + var split = str.lastIndexOf('1') + if (split === -1) return 'No separator character for ' + str + if (split === 0) return 'Missing prefix for ' + str + + var prefix = str.slice(0, split) + var wordChars = str.slice(split + 1) + if (wordChars.length < 6) return 'Data too short' + + var chk = prefixChk(prefix) + if (typeof chk === 'string') return chk + + var words = [] + for (var i = 0; i < wordChars.length; ++i) { + var c = wordChars.charAt(i) + var v = ALPHABET_MAP[c] + if (v === undefined) return 'Unknown character ' + c + chk = polymodStep(chk) ^ v + + // not in the checksum? + if (i + 6 >= wordChars.length) continue + words.push(v) + } + + if (chk !== 1) return 'Invalid checksum for ' + str + return { prefix: prefix, words: words } +} + +function decodeUnsafe () { + var res = __decode.apply(null, arguments) + if (typeof res === 'object') return res +} + +function decode (str) { + var res = __decode.apply(null, arguments) + if (typeof res === 'object') return res + + throw new Error(res) +} + +function convert (data, inBits, outBits, pad) { + var value = 0 + var bits = 0 + var maxV = (1 << outBits) - 1 + + var result = [] + for (var i = 0; i < data.length; ++i) { + value = (value << inBits) | data[i] + bits += inBits + + while (bits >= outBits) { + bits -= outBits + result.push((value >> bits) & maxV) + } + } + + if (pad) { + if (bits > 0) { + result.push((value << (outBits - bits)) & maxV) + } + } else { + if (bits >= inBits) return 'Excess padding' + if ((value << (outBits - bits)) & maxV) return 'Non-zero padding' + } + + return result +} + +function toWordsUnsafe (bytes) { + var res = convert(bytes, 8, 5, true) + if (Array.isArray(res)) return res +} + +function toWords (bytes) { + var res = convert(bytes, 8, 5, true) + if (Array.isArray(res)) return res + + throw new Error(res) +} + +function fromWordsUnsafe (words) { + var res = convert(words, 5, 8, false) + if (Array.isArray(res)) return res +} + +function fromWords (words) { + var res = convert(words, 5, 8, false) + if (Array.isArray(res)) return res + + throw new Error(res) +} + +module.exports = { + decodeUnsafe: decodeUnsafe, + decode: decode, + encode: encode, + toWordsUnsafe: toWordsUnsafe, + toWords: toWords, + fromWordsUnsafe: fromWordsUnsafe, + fromWords: fromWords +} + + +/***/ }), + +/***/ "./node_modules/bignumber.js/bignumber.js": +/*!************************************************!*\ + !*** ./node_modules/bignumber.js/bignumber.js ***! + \************************************************/ +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_RESULT__;;(function (globalObject) { + 'use strict'; + +/* + * bignumber.js v9.1.1 + * A JavaScript library for arbitrary-precision arithmetic. + * https://github.com/MikeMcl/bignumber.js + * Copyright (c) 2022 Michael Mclaughlin + * MIT Licensed. + * + * BigNumber.prototype methods | BigNumber methods + * | + * absoluteValue abs | clone + * comparedTo | config set + * decimalPlaces dp | DECIMAL_PLACES + * dividedBy div | ROUNDING_MODE + * dividedToIntegerBy idiv | EXPONENTIAL_AT + * exponentiatedBy pow | RANGE + * integerValue | CRYPTO + * isEqualTo eq | MODULO_MODE + * isFinite | POW_PRECISION + * isGreaterThan gt | FORMAT + * isGreaterThanOrEqualTo gte | ALPHABET + * isInteger | isBigNumber + * isLessThan lt | maximum max + * isLessThanOrEqualTo lte | minimum min + * isNaN | random + * isNegative | sum + * isPositive | + * isZero | + * minus | + * modulo mod | + * multipliedBy times | + * negated | + * plus | + * precision sd | + * shiftedBy | + * squareRoot sqrt | + * toExponential | + * toFixed | + * toFormat | + * toFraction | + * toJSON | + * toNumber | + * toPrecision | + * toString | + * valueOf | + * + */ + + + var BigNumber, + isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, + mathceil = Math.ceil, + mathfloor = Math.floor, + + bignumberError = '[BigNumber Error] ', + tooManyDigits = bignumberError + 'Number primitive has more than 15 significant digits: ', + + BASE = 1e14, + LOG_BASE = 14, + MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1 + // MAX_INT32 = 0x7fffffff, // 2^31 - 1 + POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], + SQRT_BASE = 1e7, + + // EDITABLE + // The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and + // the arguments to toExponential, toFixed, toFormat, and toPrecision. + MAX = 1E9; // 0 to MAX_INT32 + + + /* + * Create and return a BigNumber constructor. + */ + function clone(configObject) { + var div, convertBase, parseNumeric, + P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null }, + ONE = new BigNumber(1), + + + //----------------------------- EDITABLE CONFIG DEFAULTS ------------------------------- + + + // The default values below must be integers within the inclusive ranges stated. + // The values can also be changed at run-time using BigNumber.set. + + // The maximum number of decimal places for operations involving division. + DECIMAL_PLACES = 20, // 0 to MAX + + // The rounding mode used when rounding to the above decimal places, and when using + // toExponential, toFixed, toFormat and toPrecision, and round (default value). + // UP 0 Away from zero. + // DOWN 1 Towards zero. + // CEIL 2 Towards +Infinity. + // FLOOR 3 Towards -Infinity. + // HALF_UP 4 Towards nearest neighbour. If equidistant, up. + // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. + // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. + // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. + // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. + ROUNDING_MODE = 4, // 0 to 8 + + // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS] + + // The exponent value at and beneath which toString returns exponential notation. + // Number type: -7 + TO_EXP_NEG = -7, // 0 to -MAX + + // The exponent value at and above which toString returns exponential notation. + // Number type: 21 + TO_EXP_POS = 21, // 0 to MAX + + // RANGE : [MIN_EXP, MAX_EXP] + + // The minimum exponent value, beneath which underflow to zero occurs. + // Number type: -324 (5e-324) + MIN_EXP = -1e7, // -1 to -MAX + + // The maximum exponent value, above which overflow to Infinity occurs. + // Number type: 308 (1.7976931348623157e+308) + // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow. + MAX_EXP = 1e7, // 1 to MAX + + // Whether to use cryptographically-secure random number generation, if available. + CRYPTO = false, // true or false + + // 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. + // This modulo mode is commonly known as 'truncated division' and is + // equivalent to (a % n) in JavaScript. + // FLOOR 3 The remainder has the same sign as the divisor (Python %). + // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function. + // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). + // The remainder is always positive. + // + // The truncated division, floored division, Euclidian division and IEEE 754 remainder + // modes are commonly used for the modulus operation. + // Although the other rounding modes can also be used, they may not give useful results. + MODULO_MODE = 1, // 0 to 9 + + // The maximum number of significant digits of the result of the exponentiatedBy operation. + // If POW_PRECISION is 0, there will be unlimited significant digits. + POW_PRECISION = 0, // 0 to MAX + + // The format specification used by the BigNumber.prototype.toFormat method. + FORMAT = { + prefix: '', + groupSize: 3, + secondaryGroupSize: 0, + groupSeparator: ',', + decimalSeparator: '.', + fractionGroupSize: 0, + fractionGroupSeparator: '\xA0', // non-breaking space + suffix: '' + }, + + // The alphabet used for base conversion. It must be at least 2 characters long, with no '+', + // '-', '.', whitespace, or repeated character. + // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_' + ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz', + alphabetHasNormalDecimalDigits = true; + + + //------------------------------------------------------------------------------------------ + + + // CONSTRUCTOR + + + /* + * The BigNumber constructor and exported function. + * Create and return a new instance of a BigNumber object. + * + * v {number|string|BigNumber} A numeric value. + * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive. + */ + function BigNumber(v, b) { + var alphabet, c, caseChanged, e, i, isNum, len, str, + x = this; + + // Enable constructor call without `new`. + if (!(x instanceof BigNumber)) return new BigNumber(v, b); + + if (b == null) { + + if (v && v._isBigNumber === true) { + x.s = v.s; + + if (!v.c || v.e > MAX_EXP) { + x.c = x.e = null; + } else if (v.e < MIN_EXP) { + x.c = [x.e = 0]; + } else { + x.e = v.e; + x.c = v.c.slice(); + } + + return; + } + + if ((isNum = typeof v == 'number') && v * 0 == 0) { + + // Use `1 / n` to handle minus zero also. + x.s = 1 / v < 0 ? (v = -v, -1) : 1; + + // Fast path for integers, where n < 2147483648 (2**31). + if (v === ~~v) { + for (e = 0, i = v; i >= 10; i /= 10, e++); + + if (e > MAX_EXP) { + x.c = x.e = null; + } else { + x.e = e; + x.c = [v]; + } + + return; + } + + str = String(v); + } else { + + if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum); + + x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1; + } + + // Decimal point? + if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); + + // Exponential form? + if ((i = str.search(/e/i)) > 0) { + + // Determine exponent. + if (e < 0) e = i; + e += +str.slice(i + 1); + str = str.substring(0, i); + } else if (e < 0) { + + // Integer. + e = str.length; + } + + } else { + + // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}' + intCheck(b, 2, ALPHABET.length, 'Base'); + + // Allow exponential notation to be used with base 10 argument, while + // also rounding to DECIMAL_PLACES as with other bases. + if (b == 10 && alphabetHasNormalDecimalDigits) { + x = new BigNumber(v); + return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE); + } + + str = String(v); + + if (isNum = typeof v == 'number') { + + // Avoid potential interpretation of Infinity and NaN as base 44+ values. + if (v * 0 != 0) return parseNumeric(x, str, isNum, b); + + x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1; + + // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}' + if (BigNumber.DEBUG && str.replace(/^0\.0*|\./, '').length > 15) { + throw Error + (tooManyDigits + v); + } + } else { + x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1; + } + + alphabet = ALPHABET.slice(0, b); + e = i = 0; + + // Check that str is a valid base b number. + // Don't use RegExp, so alphabet can contain special characters. + for (len = str.length; i < len; i++) { + if (alphabet.indexOf(c = str.charAt(i)) < 0) { + if (c == '.') { + + // If '.' is not the first character and it has not be found before. + if (i > e) { + e = len; + continue; + } + } else if (!caseChanged) { + + // Allow e.g. hexadecimal 'FF' as well as 'ff'. + if (str == str.toUpperCase() && (str = str.toLowerCase()) || + str == str.toLowerCase() && (str = str.toUpperCase())) { + caseChanged = true; + i = -1; + e = 0; + continue; + } + } + + return parseNumeric(x, String(v), isNum, b); + } + } + + // Prevent later check for length on converted number. + isNum = false; + str = convertBase(str, b, 10, x.s); + + // Decimal point? + if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); + else e = str.length; + } + + // Determine leading zeros. + for (i = 0; str.charCodeAt(i) === 48; i++); + + // Determine trailing zeros. + for (len = str.length; str.charCodeAt(--len) === 48;); + + if (str = str.slice(i, ++len)) { + len -= i; + + // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}' + if (isNum && BigNumber.DEBUG && + len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) { + throw Error + (tooManyDigits + (x.s * v)); + } + + // Overflow? + if ((e = e - i - 1) > MAX_EXP) { + + // Infinity. + x.c = x.e = null; + + // Underflow? + } else if (e < MIN_EXP) { + + // Zero. + x.c = [x.e = 0]; + } else { + x.e = e; + x.c = []; + + // Transform base + + // e is the base 10 exponent. + // i is where to slice str to get the first element of the coefficient array. + i = (e + 1) % LOG_BASE; + if (e < 0) i += LOG_BASE; // i < 1 + + if (i < len) { + if (i) x.c.push(+str.slice(0, i)); + + for (len -= LOG_BASE; i < len;) { + x.c.push(+str.slice(i, i += LOG_BASE)); + } + + i = LOG_BASE - (str = str.slice(i)).length; + } else { + i -= len; + } + + for (; i--; str += '0'); + x.c.push(+str); + } + } else { + + // Zero. + x.c = [x.e = 0]; + } + } + + + // CONSTRUCTOR PROPERTIES + + + BigNumber.clone = clone; + + BigNumber.ROUND_UP = 0; + BigNumber.ROUND_DOWN = 1; + BigNumber.ROUND_CEIL = 2; + BigNumber.ROUND_FLOOR = 3; + BigNumber.ROUND_HALF_UP = 4; + BigNumber.ROUND_HALF_DOWN = 5; + BigNumber.ROUND_HALF_EVEN = 6; + BigNumber.ROUND_HALF_CEIL = 7; + BigNumber.ROUND_HALF_FLOOR = 8; + BigNumber.EUCLID = 9; + + + /* + * Configure infrequently-changing library-wide settings. + * + * Accept an object with the following optional properties (if the value of a property is + * a number, it must be an integer within the inclusive range stated): + * + * DECIMAL_PLACES {number} 0 to MAX + * ROUNDING_MODE {number} 0 to 8 + * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX] + * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX] + * CRYPTO {boolean} true or false + * MODULO_MODE {number} 0 to 9 + * POW_PRECISION {number} 0 to MAX + * ALPHABET {string} A string of two or more unique characters which does + * not contain '.'. + * FORMAT {object} An object with some of the following properties: + * prefix {string} + * groupSize {number} + * secondaryGroupSize {number} + * groupSeparator {string} + * decimalSeparator {string} + * fractionGroupSize {number} + * fractionGroupSeparator {string} + * suffix {string} + * + * (The values assigned to the above FORMAT object properties are not checked for validity.) + * + * E.g. + * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 }) + * + * Ignore properties/parameters set to null or undefined, except for ALPHABET. + * + * Return an object with the properties current values. + */ + BigNumber.config = BigNumber.set = function (obj) { + var p, v; + + if (obj != null) { + + if (typeof obj == 'object') { + + // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive. + // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}' + if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) { + v = obj[p]; + intCheck(v, 0, MAX, p); + DECIMAL_PLACES = v; + } + + // ROUNDING_MODE {number} Integer, 0 to 8 inclusive. + // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}' + if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) { + v = obj[p]; + intCheck(v, 0, 8, p); + ROUNDING_MODE = v; + } + + // EXPONENTIAL_AT {number|number[]} + // Integer, -MAX to MAX inclusive or + // [integer -MAX to 0 inclusive, 0 to MAX inclusive]. + // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}' + if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) { + v = obj[p]; + if (v && v.pop) { + intCheck(v[0], -MAX, 0, p); + intCheck(v[1], 0, MAX, p); + TO_EXP_NEG = v[0]; + TO_EXP_POS = v[1]; + } else { + intCheck(v, -MAX, MAX, p); + TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v); + } + } + + // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or + // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive]. + // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}' + if (obj.hasOwnProperty(p = 'RANGE')) { + v = obj[p]; + if (v && v.pop) { + intCheck(v[0], -MAX, -1, p); + intCheck(v[1], 1, MAX, p); + MIN_EXP = v[0]; + MAX_EXP = v[1]; + } else { + intCheck(v, -MAX, MAX, p); + if (v) { + MIN_EXP = -(MAX_EXP = v < 0 ? -v : v); + } else { + throw Error + (bignumberError + p + ' cannot be zero: ' + v); + } + } + } + + // CRYPTO {boolean} true or false. + // '[BigNumber Error] CRYPTO not true or false: {v}' + // '[BigNumber Error] crypto unavailable' + if (obj.hasOwnProperty(p = 'CRYPTO')) { + v = obj[p]; + if (v === !!v) { + if (v) { + if (typeof crypto != 'undefined' && crypto && + (crypto.getRandomValues || crypto.randomBytes)) { + CRYPTO = v; + } else { + CRYPTO = !v; + throw Error + (bignumberError + 'crypto unavailable'); + } + } else { + CRYPTO = v; + } + } else { + throw Error + (bignumberError + p + ' not true or false: ' + v); + } + } + + // MODULO_MODE {number} Integer, 0 to 9 inclusive. + // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}' + if (obj.hasOwnProperty(p = 'MODULO_MODE')) { + v = obj[p]; + intCheck(v, 0, 9, p); + MODULO_MODE = v; + } + + // POW_PRECISION {number} Integer, 0 to MAX inclusive. + // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}' + if (obj.hasOwnProperty(p = 'POW_PRECISION')) { + v = obj[p]; + intCheck(v, 0, MAX, p); + POW_PRECISION = v; + } + + // FORMAT {object} + // '[BigNumber Error] FORMAT not an object: {v}' + if (obj.hasOwnProperty(p = 'FORMAT')) { + v = obj[p]; + if (typeof v == 'object') FORMAT = v; + else throw Error + (bignumberError + p + ' not an object: ' + v); + } + + // ALPHABET {string} + // '[BigNumber Error] ALPHABET invalid: {v}' + if (obj.hasOwnProperty(p = 'ALPHABET')) { + v = obj[p]; + + // Disallow if less than two characters, + // or if it contains '+', '-', '.', whitespace, or a repeated character. + if (typeof v == 'string' && !/^.?$|[+\-.\s]|(.).*\1/.test(v)) { + alphabetHasNormalDecimalDigits = v.slice(0, 10) == '0123456789'; + ALPHABET = v; + } else { + throw Error + (bignumberError + p + ' invalid: ' + v); + } + } + + } else { + + // '[BigNumber Error] Object expected: {v}' + throw Error + (bignumberError + 'Object expected: ' + obj); + } + } + + return { + DECIMAL_PLACES: DECIMAL_PLACES, + ROUNDING_MODE: ROUNDING_MODE, + EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS], + RANGE: [MIN_EXP, MAX_EXP], + CRYPTO: CRYPTO, + MODULO_MODE: MODULO_MODE, + POW_PRECISION: POW_PRECISION, + FORMAT: FORMAT, + ALPHABET: ALPHABET + }; + }; + + + /* + * Return true if v is a BigNumber instance, otherwise return false. + * + * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed. + * + * v {any} + * + * '[BigNumber Error] Invalid BigNumber: {v}' + */ + BigNumber.isBigNumber = function (v) { + if (!v || v._isBigNumber !== true) return false; + if (!BigNumber.DEBUG) return true; + + var i, n, + c = v.c, + e = v.e, + s = v.s; + + out: if ({}.toString.call(c) == '[object Array]') { + + if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) { + + // If the first element is zero, the BigNumber value must be zero. + if (c[0] === 0) { + if (e === 0 && c.length === 1) return true; + break out; + } + + // Calculate number of digits that c[0] should have, based on the exponent. + i = (e + 1) % LOG_BASE; + if (i < 1) i += LOG_BASE; + + // Calculate number of digits of c[0]. + //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) { + if (String(c[0]).length == i) { + + for (i = 0; i < c.length; i++) { + n = c[i]; + if (n < 0 || n >= BASE || n !== mathfloor(n)) break out; + } + + // Last element cannot be zero, unless it is the only element. + if (n !== 0) return true; + } + } + + // Infinity/NaN + } else if (c === null && e === null && (s === null || s === 1 || s === -1)) { + return true; + } + + throw Error + (bignumberError + 'Invalid BigNumber: ' + v); + }; + + + /* + * Return a new BigNumber whose value is the maximum of the arguments. + * + * arguments {number|string|BigNumber} + */ + BigNumber.maximum = BigNumber.max = function () { + return maxOrMin(arguments, P.lt); + }; + + + /* + * Return a new BigNumber whose value is the minimum of the arguments. + * + * arguments {number|string|BigNumber} + */ + BigNumber.minimum = BigNumber.min = function () { + return maxOrMin(arguments, P.gt); + }; + + + /* + * Return a new BigNumber with a random value equal to or greater than 0 and less than 1, + * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing + * zeros are produced). + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}' + * '[BigNumber Error] crypto unavailable' + */ + BigNumber.random = (function () { + var pow2_53 = 0x20000000000000; + + // Return a 53 bit integer n, where 0 <= n < 9007199254740992. + // Check if Math.random() produces more than 32 bits of randomness. + // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits. + // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1. + var random53bitInt = (Math.random() * pow2_53) & 0x1fffff + ? function () { return mathfloor(Math.random() * pow2_53); } + : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) + + (Math.random() * 0x800000 | 0); }; + + return function (dp) { + var a, b, e, k, v, + i = 0, + c = [], + rand = new BigNumber(ONE); + + if (dp == null) dp = DECIMAL_PLACES; + else intCheck(dp, 0, MAX); + + k = mathceil(dp / LOG_BASE); + + if (CRYPTO) { + + // Browsers supporting crypto.getRandomValues. + if (crypto.getRandomValues) { + + a = crypto.getRandomValues(new Uint32Array(k *= 2)); + + for (; i < k;) { + + // 53 bits: + // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2) + // 11111 11111111 11111111 11111111 11100000 00000000 00000000 + // ((Math.pow(2, 32) - 1) >>> 11).toString(2) + // 11111 11111111 11111111 + // 0x20000 is 2^21. + v = a[i] * 0x20000 + (a[i + 1] >>> 11); + + // Rejection sampling: + // 0 <= v < 9007199254740992 + // Probability that v >= 9e15, is + // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251 + if (v >= 9e15) { + b = crypto.getRandomValues(new Uint32Array(2)); + a[i] = b[0]; + a[i + 1] = b[1]; + } else { + + // 0 <= v <= 8999999999999999 + // 0 <= (v % 1e14) <= 99999999999999 + c.push(v % 1e14); + i += 2; + } + } + i = k / 2; + + // Node.js supporting crypto.randomBytes. + } else if (crypto.randomBytes) { + + // buffer + a = crypto.randomBytes(k *= 7); + + for (; i < k;) { + + // 0x1000000000000 is 2^48, 0x10000000000 is 2^40 + // 0x100000000 is 2^32, 0x1000000 is 2^24 + // 11111 11111111 11111111 11111111 11111111 11111111 11111111 + // 0 <= v < 9007199254740992 + v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) + + (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) + + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6]; + + if (v >= 9e15) { + crypto.randomBytes(7).copy(a, i); + } else { + + // 0 <= (v % 1e14) <= 99999999999999 + c.push(v % 1e14); + i += 7; + } + } + i = k / 7; + } else { + CRYPTO = false; + throw Error + (bignumberError + 'crypto unavailable'); + } + } + + // Use Math.random. + if (!CRYPTO) { + + for (; i < k;) { + v = random53bitInt(); + if (v < 9e15) c[i++] = v % 1e14; + } + } + + k = c[--i]; + dp %= LOG_BASE; + + // Convert trailing digits to zeros according to dp. + if (k && dp) { + v = POWS_TEN[LOG_BASE - dp]; + c[i] = mathfloor(k / v) * v; + } + + // Remove trailing elements which are zero. + for (; c[i] === 0; c.pop(), i--); + + // Zero? + if (i < 0) { + c = [e = 0]; + } else { + + // Remove leading elements which are zero and adjust exponent accordingly. + for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE); + + // Count the digits of the first element of c to determine leading zeros, and... + for (i = 1, v = c[0]; v >= 10; v /= 10, i++); + + // adjust the exponent accordingly. + if (i < LOG_BASE) e -= LOG_BASE - i; + } + + rand.e = e; + rand.c = c; + return rand; + }; + })(); + + + /* + * Return a BigNumber whose value is the sum of the arguments. + * + * arguments {number|string|BigNumber} + */ + BigNumber.sum = function () { + var i = 1, + args = arguments, + sum = new BigNumber(args[0]); + for (; i < args.length;) sum = sum.plus(args[i++]); + return sum; + }; + + + // PRIVATE FUNCTIONS + + + // Called by BigNumber and BigNumber.prototype.toString. + convertBase = (function () { + var decimal = '0123456789'; + + /* + * Convert string of baseIn to an array of numbers of baseOut. + * Eg. toBaseOut('255', 10, 16) returns [15, 15]. + * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5]. + */ + function toBaseOut(str, baseIn, baseOut, alphabet) { + var j, + arr = [0], + arrL, + i = 0, + len = str.length; + + for (; i < len;) { + for (arrL = arr.length; arrL--; arr[arrL] *= baseIn); + + arr[0] += alphabet.indexOf(str.charAt(i++)); + + for (j = 0; j < arr.length; j++) { + + if (arr[j] > baseOut - 1) { + if (arr[j + 1] == null) arr[j + 1] = 0; + arr[j + 1] += arr[j] / baseOut | 0; + arr[j] %= baseOut; + } + } + } + + return arr.reverse(); + } + + // Convert a numeric string of baseIn to a numeric string of baseOut. + // If the caller is toString, we are converting from base 10 to baseOut. + // If the caller is BigNumber, we are converting from baseIn to base 10. + return function (str, baseIn, baseOut, sign, callerIsToString) { + var alphabet, d, e, k, r, x, xc, y, + i = str.indexOf('.'), + dp = DECIMAL_PLACES, + rm = ROUNDING_MODE; + + // Non-integer. + if (i >= 0) { + k = POW_PRECISION; + + // Unlimited precision. + POW_PRECISION = 0; + str = str.replace('.', ''); + y = new BigNumber(baseIn); + x = y.pow(str.length - i); + POW_PRECISION = k; + + // Convert str as if an integer, then restore the fraction part by dividing the + // result by its base raised to a power. + + y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'), + 10, baseOut, decimal); + y.e = y.c.length; + } + + // Convert the number as integer. + + xc = toBaseOut(str, baseIn, baseOut, callerIsToString + ? (alphabet = ALPHABET, decimal) + : (alphabet = decimal, ALPHABET)); + + // xc now represents str as an integer and converted to baseOut. e is the exponent. + e = k = xc.length; + + // Remove trailing zeros. + for (; xc[--k] == 0; xc.pop()); + + // Zero? + if (!xc[0]) return alphabet.charAt(0); + + // Does str represent an integer? If so, no need for the division. + if (i < 0) { + --e; + } else { + x.c = xc; + x.e = e; + + // The sign is needed for correct rounding. + x.s = sign; + x = div(x, y, dp, rm, baseOut); + xc = x.c; + r = x.r; + e = x.e; + } + + // xc now represents str converted to baseOut. + + // THe index of the rounding digit. + d = e + dp + 1; + + // The rounding digit: the digit to the right of the digit that may be rounded up. + i = xc[d]; + + // Look at the rounding digits and mode to determine whether to round up. + + k = baseOut / 2; + r = r || d < 0 || xc[d + 1] != null; + + r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) + : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 || + rm == (x.s < 0 ? 8 : 7)); + + // If the index of the rounding digit is not greater than zero, or xc represents + // zero, then the result of the base conversion is zero or, if rounding up, a value + // such as 0.00001. + if (d < 1 || !xc[0]) { + + // 1^-dp or 0 + str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0); + } else { + + // Truncate xc to the required number of decimal places. + xc.length = d; + + // Round up? + if (r) { + + // Rounding up may mean the previous digit has to be rounded up and so on. + for (--baseOut; ++xc[--d] > baseOut;) { + xc[d] = 0; + + if (!d) { + ++e; + xc = [1].concat(xc); + } + } + } + + // Determine trailing zeros. + for (k = xc.length; !xc[--k];); + + // E.g. [4, 11, 15] becomes 4bf. + for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++])); + + // Add leading zeros, decimal point and trailing zeros as required. + str = toFixedPoint(str, e, alphabet.charAt(0)); + } + + // The caller will add the sign. + return str; + }; + })(); + + + // Perform division in the specified base. Called by div and convertBase. + div = (function () { + + // Assume non-zero x and k. + function multiply(x, k, base) { + var m, temp, xlo, xhi, + carry = 0, + i = x.length, + klo = k % SQRT_BASE, + khi = k / SQRT_BASE | 0; + + for (x = x.slice(); i--;) { + xlo = x[i] % SQRT_BASE; + xhi = x[i] / SQRT_BASE | 0; + m = khi * xlo + xhi * klo; + temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry; + carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi; + x[i] = temp % base; + } + + if (carry) x = [carry].concat(x); + + return x; + } + + function compare(a, b, aL, bL) { + var i, cmp; + + if (aL != bL) { + cmp = aL > bL ? 1 : -1; + } else { + + for (i = cmp = 0; i < aL; i++) { + + if (a[i] != b[i]) { + cmp = a[i] > b[i] ? 1 : -1; + break; + } + } + } + + return cmp; + } + + function subtract(a, b, aL, base) { + var i = 0; + + // Subtract b from a. + for (; aL--;) { + a[aL] -= i; + i = a[aL] < b[aL] ? 1 : 0; + a[aL] = i * base + a[aL] - b[aL]; + } + + // Remove leading zeros. + for (; !a[0] && a.length > 1; a.splice(0, 1)); + } + + // x: dividend, y: divisor. + return function (x, y, dp, rm, base) { + var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, + yL, yz, + s = x.s == y.s ? 1 : -1, + xc = x.c, + yc = y.c; + + // Either NaN, Infinity or 0? + if (!xc || !xc[0] || !yc || !yc[0]) { + + return new BigNumber( + + // Return NaN if either NaN, or both Infinity or 0. + !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : + + // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0. + xc && xc[0] == 0 || !yc ? s * 0 : s / 0 + ); + } + + q = new BigNumber(s); + qc = q.c = []; + e = x.e - y.e; + s = dp + e + 1; + + if (!base) { + base = BASE; + e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE); + s = s / LOG_BASE | 0; + } + + // Result exponent may be one less then the current value of e. + // The coefficients of the BigNumbers from convertBase may have trailing zeros. + for (i = 0; yc[i] == (xc[i] || 0); i++); + + if (yc[i] > (xc[i] || 0)) e--; + + if (s < 0) { + qc.push(1); + more = true; + } else { + xL = xc.length; + yL = yc.length; + i = 0; + s += 2; + + // Normalise xc and yc so highest order digit of yc is >= base / 2. + + n = mathfloor(base / (yc[0] + 1)); + + // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1. + // if (n > 1 || n++ == 1 && yc[0] < base / 2) { + if (n > 1) { + yc = multiply(yc, n, base); + xc = multiply(xc, n, base); + yL = yc.length; + xL = xc.length; + } + + xi = yL; + rem = xc.slice(0, yL); + remL = rem.length; + + // Add zeros to make remainder as long as divisor. + for (; remL < yL; rem[remL++] = 0); + yz = yc.slice(); + yz = [0].concat(yz); + yc0 = yc[0]; + if (yc[1] >= base / 2) yc0++; + // Not necessary, but to prevent trial digit n > base, when using base 3. + // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15; + + do { + n = 0; + + // Compare divisor and remainder. + cmp = compare(yc, rem, yL, remL); + + // If divisor < remainder. + if (cmp < 0) { + + // Calculate trial digit, n. + + rem0 = rem[0]; + if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); + + // n is how many times the divisor goes into the current remainder. + n = mathfloor(rem0 / yc0); + + // Algorithm: + // product = divisor multiplied by trial digit (n). + // Compare product and remainder. + // If product is greater than remainder: + // Subtract divisor from product, decrement trial digit. + // Subtract product from remainder. + // If product was less than remainder at the last compare: + // Compare new remainder and divisor. + // If remainder is greater than divisor: + // Subtract divisor from remainder, increment trial digit. + + if (n > 1) { + + // n may be > base only when base is 3. + if (n >= base) n = base - 1; + + // product = divisor * trial digit. + prod = multiply(yc, n, base); + prodL = prod.length; + remL = rem.length; + + // Compare product and remainder. + // If product > remainder then trial digit n too high. + // n is 1 too high about 5% of the time, and is not known to have + // ever been more than 1 too high. + while (compare(prod, rem, prodL, remL) == 1) { + n--; + + // Subtract divisor from product. + subtract(prod, yL < prodL ? yz : yc, prodL, base); + prodL = prod.length; + cmp = 1; + } + } else { + + // n is 0 or 1, cmp is -1. + // If n is 0, there is no need to compare yc and rem again below, + // so change cmp to 1 to avoid it. + // If n is 1, leave cmp as -1, so yc and rem are compared again. + if (n == 0) { + + // divisor < remainder, so n must be at least 1. + cmp = n = 1; + } + + // product = divisor + prod = yc.slice(); + prodL = prod.length; + } + + if (prodL < remL) prod = [0].concat(prod); + + // Subtract product from remainder. + subtract(rem, prod, remL, base); + remL = rem.length; + + // If product was < remainder. + if (cmp == -1) { + + // Compare divisor and new remainder. + // If divisor < new remainder, subtract divisor from remainder. + // Trial digit n too low. + // n is 1 too low about 5% of the time, and very rarely 2 too low. + while (compare(yc, rem, yL, remL) < 1) { + n++; + + // Subtract divisor from remainder. + subtract(rem, yL < remL ? yz : yc, remL, base); + remL = rem.length; + } + } + } else if (cmp === 0) { + n++; + rem = [0]; + } // else cmp === 1 and n will be 0 + + // Add the next digit, n, to the result array. + qc[i++] = n; + + // Update the remainder. + if (rem[0]) { + rem[remL++] = xc[xi] || 0; + } else { + rem = [xc[xi]]; + remL = 1; + } + } while ((xi++ < xL || rem[0] != null) && s--); + + more = rem[0] != null; + + // Leading zero? + if (!qc[0]) qc.splice(0, 1); + } + + if (base == BASE) { + + // To calculate q.e, first get the number of digits of qc[0]. + for (i = 1, s = qc[0]; s >= 10; s /= 10, i++); + + round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more); + + // Caller is convertBase. + } else { + q.e = e; + q.r = +more; + } + + return q; + }; + })(); + + + /* + * Return a string representing the value of BigNumber n in fixed-point or exponential + * notation rounded to the specified decimal places or significant digits. + * + * n: a BigNumber. + * i: the index of the last digit required (i.e. the digit that may be rounded up). + * rm: the rounding mode. + * id: 1 (toExponential) or 2 (toPrecision). + */ + function format(n, i, rm, id) { + var c0, e, ne, len, str; + + if (rm == null) rm = ROUNDING_MODE; + else intCheck(rm, 0, 8); + + if (!n.c) return n.toString(); + + c0 = n.c[0]; + ne = n.e; + + if (i == null) { + str = coeffToString(n.c); + str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) + ? toExponential(str, ne) + : toFixedPoint(str, ne, '0'); + } else { + n = round(new BigNumber(n), i, rm); + + // n.e may have changed if the value was rounded up. + e = n.e; + + str = coeffToString(n.c); + len = str.length; + + // toPrecision returns exponential notation if the number of significant digits + // specified is less than the number of digits necessary to represent the integer + // part of the value in fixed-point notation. + + // Exponential notation. + if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) { + + // Append zeros? + for (; len < i; str += '0', len++); + str = toExponential(str, e); + + // Fixed-point notation. + } else { + i -= ne; + str = toFixedPoint(str, e, '0'); + + // Append zeros? + if (e + 1 > len) { + if (--i > 0) for (str += '.'; i--; str += '0'); + } else { + i += e - len; + if (i > 0) { + if (e + 1 == len) str += '.'; + for (; i--; str += '0'); + } + } + } + } + + return n.s < 0 && c0 ? '-' + str : str; + } + + + // Handle BigNumber.max and BigNumber.min. + function maxOrMin(args, method) { + var n, + i = 1, + m = new BigNumber(args[0]); + + for (; i < args.length; i++) { + n = new BigNumber(args[i]); + + // If any number is NaN, return NaN. + if (!n.s) { + m = n; + break; + } else if (method.call(m, n)) { + m = n; + } + } + + return m; + } + + + /* + * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP. + * Called by minus, plus and times. + */ + function normalise(n, c, e) { + var i = 1, + j = c.length; + + // Remove trailing zeros. + for (; !c[--j]; c.pop()); + + // Calculate the base 10 exponent. First get the number of digits of c[0]. + for (j = c[0]; j >= 10; j /= 10, i++); + + // Overflow? + if ((e = i + e * LOG_BASE - 1) > MAX_EXP) { + + // Infinity. + n.c = n.e = null; + + // Underflow? + } else if (e < MIN_EXP) { + + // Zero. + n.c = [n.e = 0]; + } else { + n.e = e; + n.c = c; + } + + return n; + } + + + // Handle values that fail the validity test in BigNumber. + parseNumeric = (function () { + var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, + dotAfter = /^([^.]+)\.$/, + dotBefore = /^\.([^.]+)$/, + isInfinityOrNaN = /^-?(Infinity|NaN)$/, + whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g; + + return function (x, str, isNum, b) { + var base, + s = isNum ? str : str.replace(whitespaceOrPlus, ''); + + // No exception on ±Infinity or NaN. + if (isInfinityOrNaN.test(s)) { + x.s = isNaN(s) ? null : s < 0 ? -1 : 1; + } else { + if (!isNum) { + + // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i + s = s.replace(basePrefix, function (m, p1, p2) { + base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8; + return !b || b == base ? p1 : m; + }); + + if (b) { + base = b; + + // E.g. '1.' to '1', '.1' to '0.1' + s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1'); + } + + if (str != s) return new BigNumber(s, base); + } + + // '[BigNumber Error] Not a number: {n}' + // '[BigNumber Error] Not a base {b} number: {n}' + if (BigNumber.DEBUG) { + throw Error + (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str); + } + + // NaN + x.s = null; + } + + x.c = x.e = null; + } + })(); + + + /* + * Round x to sd significant digits using rounding mode rm. Check for over/under-flow. + * If r is truthy, it is known that there are more digits after the rounding digit. + */ + function round(x, sd, rm, r) { + var d, i, j, k, n, ni, rd, + xc = x.c, + pows10 = POWS_TEN; + + // if x is not Infinity or NaN... + if (xc) { + + // rd is the rounding digit, i.e. the digit after the digit that may be rounded up. + // n is a base 1e14 number, the value of the element of array x.c containing rd. + // ni is the index of n within x.c. + // d is the number of digits of n. + // i is the index of rd within n including leading zeros. + // j is the actual index of rd within n (if < 0, rd is a leading zero). + out: { + + // Get the number of digits of the first element of xc. + for (d = 1, k = xc[0]; k >= 10; k /= 10, d++); + i = sd - d; + + // If the rounding digit is in the first element of xc... + if (i < 0) { + i += LOG_BASE; + j = sd; + n = xc[ni = 0]; + + // Get the rounding digit at index j of n. + rd = n / pows10[d - j - 1] % 10 | 0; + } else { + ni = mathceil((i + 1) / LOG_BASE); + + if (ni >= xc.length) { + + if (r) { + + // Needed by sqrt. + for (; xc.length <= ni; xc.push(0)); + n = rd = 0; + d = 1; + i %= LOG_BASE; + j = i - LOG_BASE + 1; + } else { + break out; + } + } else { + n = k = xc[ni]; + + // Get the number of digits of n. + for (d = 1; k >= 10; k /= 10, d++); + + // Get the index of rd within n. + i %= LOG_BASE; + + // Get the index of rd within n, adjusted for leading zeros. + // The number of leading zeros of n is given by LOG_BASE - d. + j = i - LOG_BASE + d; + + // Get the rounding digit at index j of n. + rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0; + } + } + + r = r || sd < 0 || + + // Are there any non-zero digits after the rounding digit? + // The expression n % pows10[d - j - 1] returns all digits of n to the right + // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714. + xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]); + + r = rm < 4 + ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) + : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && + + // Check whether the digit to the left of the rounding digit is odd. + ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 || + rm == (x.s < 0 ? 8 : 7)); + + if (sd < 1 || !xc[0]) { + xc.length = 0; + + if (r) { + + // Convert sd to decimal places. + sd -= x.e + 1; + + // 1, 0.1, 0.01, 0.001, 0.0001 etc. + xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE]; + x.e = -sd || 0; + } else { + + // Zero. + xc[0] = x.e = 0; + } + + return x; + } + + // Remove excess digits. + if (i == 0) { + xc.length = ni; + k = 1; + ni--; + } else { + xc.length = ni + 1; + k = pows10[LOG_BASE - i]; + + // E.g. 56700 becomes 56000 if 7 is the rounding digit. + // j > 0 means i > number of leading zeros of n. + xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0; + } + + // Round up? + if (r) { + + for (; ;) { + + // If the digit to be rounded up is in the first element of xc... + if (ni == 0) { + + // i will be the length of xc[0] before k is added. + for (i = 1, j = xc[0]; j >= 10; j /= 10, i++); + j = xc[0] += k; + for (k = 1; j >= 10; j /= 10, k++); + + // if i != k the length has increased. + if (i != k) { + x.e++; + if (xc[0] == BASE) xc[0] = 1; + } + + break; + } else { + xc[ni] += k; + if (xc[ni] != BASE) break; + xc[ni--] = 0; + k = 1; + } + } + } + + // Remove trailing zeros. + for (i = xc.length; xc[--i] === 0; xc.pop()); + } + + // Overflow? Infinity. + if (x.e > MAX_EXP) { + x.c = x.e = null; + + // Underflow? Zero. + } else if (x.e < MIN_EXP) { + x.c = [x.e = 0]; + } + } + + return x; + } + + + function valueOf(n) { + var str, + e = n.e; + + if (e === null) return n.toString(); + + str = coeffToString(n.c); + + str = e <= TO_EXP_NEG || e >= TO_EXP_POS + ? toExponential(str, e) + : toFixedPoint(str, e, '0'); + + return n.s < 0 ? '-' + str : str; + } + + + // PROTOTYPE/INSTANCE METHODS + + + /* + * Return a new BigNumber whose value is the absolute value of this BigNumber. + */ + P.absoluteValue = P.abs = function () { + var x = new BigNumber(this); + if (x.s < 0) x.s = 1; + return x; + }; + + + /* + * Return + * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b), + * -1 if the value of this BigNumber is less than the value of BigNumber(y, b), + * 0 if they have the same value, + * or null if the value of either is NaN. + */ + P.comparedTo = function (y, b) { + return compare(this, new BigNumber(y, b)); + }; + + + /* + * If dp is undefined or null or true or false, return the number of decimal places of the + * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN. + * + * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this + * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or + * ROUNDING_MODE if rm is omitted. + * + * [dp] {number} Decimal places: integer, 0 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' + */ + P.decimalPlaces = P.dp = function (dp, rm) { + var c, n, v, + x = this; + + if (dp != null) { + intCheck(dp, 0, MAX); + if (rm == null) rm = ROUNDING_MODE; + else intCheck(rm, 0, 8); + + return round(new BigNumber(x), dp + x.e + 1, rm); + } + + if (!(c = x.c)) return null; + n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE; + + // Subtract the number of trailing zeros of the last number. + if (v = c[v]) for (; v % 10 == 0; v /= 10, n--); + if (n < 0) n = 0; + + return n; + }; + + + /* + * n / 0 = I + * n / N = N + * n / I = 0 + * 0 / n = 0 + * 0 / 0 = N + * 0 / N = N + * 0 / I = 0 + * N / n = N + * N / 0 = N + * N / N = N + * N / I = N + * I / n = I + * I / 0 = I + * I / N = N + * I / I = N + * + * Return a new BigNumber whose value is the value of this BigNumber divided by the value of + * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE. + */ + P.dividedBy = P.div = function (y, b) { + return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE); + }; + + + /* + * Return a new BigNumber whose value is the integer part of dividing the value of this + * BigNumber by the value of BigNumber(y, b). + */ + P.dividedToIntegerBy = P.idiv = function (y, b) { + return div(this, new BigNumber(y, b), 0, 1); + }; + + + /* + * Return a BigNumber whose value is the value of this BigNumber exponentiated by n. + * + * If m is present, return the result modulo m. + * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE. + * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE. + * + * The modular power operation works efficiently when x, n, and m are integers, otherwise it + * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0. + * + * n {number|string|BigNumber} The exponent. An integer. + * [m] {number|string|BigNumber} The modulus. + * + * '[BigNumber Error] Exponent not an integer: {n}' + */ + P.exponentiatedBy = P.pow = function (n, m) { + var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, + x = this; + + n = new BigNumber(n); + + // Allow NaN and ±Infinity, but not other non-integers. + if (n.c && !n.isInteger()) { + throw Error + (bignumberError + 'Exponent not an integer: ' + valueOf(n)); + } + + if (m != null) m = new BigNumber(m); + + // Exponent of MAX_SAFE_INTEGER is 15. + nIsBig = n.e > 14; + + // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0. + if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) { + + // The sign of the result of pow when x is negative depends on the evenness of n. + // If +n overflows to ±Infinity, the evenness of n would be not be known. + y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n))); + return m ? y.mod(m) : y; + } + + nIsNeg = n.s < 0; + + if (m) { + + // x % m returns NaN if abs(m) is zero, or m is NaN. + if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN); + + isModExp = !nIsNeg && x.isInteger() && m.isInteger(); + + if (isModExp) x = x.mod(m); + + // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15. + // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15. + } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 + // [1, 240000000] + ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 + // [80000000000000] [99999750000000] + : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) { + + // If x is negative and n is odd, k = -0, else k = 0. + k = x.s < 0 && isOdd(n) ? -0 : 0; + + // If x >= 1, k = ±Infinity. + if (x.e > -1) k = 1 / k; + + // If n is negative return ±0, else return ±Infinity. + return new BigNumber(nIsNeg ? 1 / k : k); + + } else if (POW_PRECISION) { + + // Truncating each coefficient array to a length of k after each multiplication + // equates to truncating significant digits to POW_PRECISION + [28, 41], + // i.e. there will be a minimum of 28 guard digits retained. + k = mathceil(POW_PRECISION / LOG_BASE + 2); + } + + if (nIsBig) { + half = new BigNumber(0.5); + if (nIsNeg) n.s = 1; + nIsOdd = isOdd(n); + } else { + i = Math.abs(+valueOf(n)); + nIsOdd = i % 2; + } + + y = new BigNumber(ONE); + + // Performs 54 loop iterations for n of 9007199254740991. + for (; ;) { + + if (nIsOdd) { + y = y.times(x); + if (!y.c) break; + + if (k) { + if (y.c.length > k) y.c.length = k; + } else if (isModExp) { + y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m)); + } + } + + if (i) { + i = mathfloor(i / 2); + if (i === 0) break; + nIsOdd = i % 2; + } else { + n = n.times(half); + round(n, n.e + 1, 1); + + if (n.e > 14) { + nIsOdd = isOdd(n); + } else { + i = +valueOf(n); + if (i === 0) break; + nIsOdd = i % 2; + } + } + + x = x.times(x); + + if (k) { + if (x.c && x.c.length > k) x.c.length = k; + } else if (isModExp) { + x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m)); + } + } + + if (isModExp) return y; + if (nIsNeg) y = ONE.div(y); + + return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y; + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer + * using rounding mode rm, or ROUNDING_MODE if rm is omitted. + * + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}' + */ + P.integerValue = function (rm) { + var n = new BigNumber(this); + if (rm == null) rm = ROUNDING_MODE; + else intCheck(rm, 0, 8); + return round(n, n.e + 1, rm); + }; + + + /* + * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b), + * otherwise return false. + */ + P.isEqualTo = P.eq = function (y, b) { + return compare(this, new BigNumber(y, b)) === 0; + }; + + + /* + * Return true if the value of this BigNumber is a finite number, otherwise return false. + */ + P.isFinite = function () { + return !!this.c; + }; + + + /* + * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b), + * otherwise return false. + */ + P.isGreaterThan = P.gt = function (y, b) { + return compare(this, new BigNumber(y, b)) > 0; + }; + + + /* + * Return true if the value of this BigNumber is greater than or equal to the value of + * BigNumber(y, b), otherwise return false. + */ + P.isGreaterThanOrEqualTo = P.gte = function (y, b) { + return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0; + + }; + + + /* + * Return true if the value of this BigNumber is an integer, otherwise return false. + */ + P.isInteger = function () { + return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2; + }; + + + /* + * Return true if the value of this BigNumber is less than the value of BigNumber(y, b), + * otherwise return false. + */ + P.isLessThan = P.lt = function (y, b) { + return compare(this, new BigNumber(y, b)) < 0; + }; + + + /* + * Return true if the value of this BigNumber is less than or equal to the value of + * BigNumber(y, b), otherwise return false. + */ + P.isLessThanOrEqualTo = P.lte = function (y, b) { + return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0; + }; + + + /* + * Return true if the value of this BigNumber is NaN, otherwise return false. + */ + P.isNaN = function () { + return !this.s; + }; + + + /* + * Return true if the value of this BigNumber is negative, otherwise return false. + */ + P.isNegative = function () { + return this.s < 0; + }; + + + /* + * Return true if the value of this BigNumber is positive, otherwise return false. + */ + P.isPositive = function () { + return this.s > 0; + }; + + + /* + * Return true if the value of this BigNumber is 0 or -0, otherwise return false. + */ + P.isZero = function () { + return !!this.c && this.c[0] == 0; + }; + + + /* + * n - 0 = n + * n - N = N + * n - I = -I + * 0 - n = -n + * 0 - 0 = 0 + * 0 - N = N + * 0 - I = -I + * N - n = N + * N - 0 = N + * N - N = N + * N - I = N + * I - n = I + * I - 0 = I + * I - N = N + * I - I = N + * + * Return a new BigNumber whose value is the value of this BigNumber minus the value of + * BigNumber(y, b). + */ + P.minus = function (y, b) { + var i, j, t, xLTy, + x = this, + a = x.s; + + y = new BigNumber(y, b); + b = y.s; + + // Either NaN? + if (!a || !b) return new BigNumber(NaN); + + // Signs differ? + if (a != b) { + y.s = -b; + return x.plus(y); + } + + var xe = x.e / LOG_BASE, + ye = y.e / LOG_BASE, + xc = x.c, + yc = y.c; + + if (!xe || !ye) { + + // Either Infinity? + if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN); + + // Either zero? + if (!xc[0] || !yc[0]) { + + // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. + return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x : + + // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity + ROUNDING_MODE == 3 ? -0 : 0); + } + } + + xe = bitFloor(xe); + ye = bitFloor(ye); + xc = xc.slice(); + + // Determine which is the bigger number. + if (a = xe - ye) { + + if (xLTy = a < 0) { + a = -a; + t = xc; + } else { + ye = xe; + t = yc; + } + + t.reverse(); + + // Prepend zeros to equalise exponents. + for (b = a; b--; t.push(0)); + t.reverse(); + } else { + + // Exponents equal. Check digit by digit. + j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b; + + for (a = b = 0; b < j; b++) { + + if (xc[b] != yc[b]) { + xLTy = xc[b] < yc[b]; + break; + } + } + } + + // x < y? Point xc to the array of the bigger number. + if (xLTy) { + t = xc; + xc = yc; + yc = t; + y.s = -y.s; + } + + b = (j = yc.length) - (i = xc.length); + + // Append zeros to xc if shorter. + // No need to add zeros to yc if shorter as subtract only needs to start at yc.length. + if (b > 0) for (; b--; xc[i++] = 0); + b = BASE - 1; + + // Subtract yc from xc. + for (; j > a;) { + + if (xc[--j] < yc[j]) { + for (i = j; i && !xc[--i]; xc[i] = b); + --xc[i]; + xc[j] += BASE; + } + + xc[j] -= yc[j]; + } + + // Remove leading zeros and adjust exponent accordingly. + for (; xc[0] == 0; xc.splice(0, 1), --ye); + + // Zero? + if (!xc[0]) { + + // Following IEEE 754 (2008) 6.3, + // n - n = +0 but n - n = -0 when rounding towards -Infinity. + y.s = ROUNDING_MODE == 3 ? -1 : 1; + y.c = [y.e = 0]; + return y; + } + + // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity + // for finite x and y. + return normalise(y, xc, ye); + }; + + + /* + * n % 0 = N + * n % N = N + * n % I = n + * 0 % n = 0 + * -0 % n = -0 + * 0 % 0 = N + * 0 % N = N + * 0 % I = 0 + * N % n = N + * N % 0 = N + * N % N = N + * N % I = N + * I % n = N + * I % 0 = N + * I % N = N + * I % I = N + * + * Return a new BigNumber whose value is the value of this BigNumber modulo the value of + * BigNumber(y, b). The result depends on the value of MODULO_MODE. + */ + P.modulo = P.mod = function (y, b) { + var q, s, + x = this; + + y = new BigNumber(y, b); + + // Return NaN if x is Infinity or NaN, or y is NaN or zero. + if (!x.c || !y.s || y.c && !y.c[0]) { + return new BigNumber(NaN); + + // Return x if y is Infinity or x is zero. + } else if (!y.c || x.c && !x.c[0]) { + return new BigNumber(x); + } + + if (MODULO_MODE == 9) { + + // Euclidian division: q = sign(y) * floor(x / abs(y)) + // r = x - qy where 0 <= r < abs(y) + s = y.s; + y.s = 1; + q = div(x, y, 0, 3); + y.s = s; + q.s *= s; + } else { + q = div(x, y, 0, MODULO_MODE); + } + + y = x.minus(q.times(y)); + + // To match JavaScript %, ensure sign of zero is sign of dividend. + if (!y.c[0] && MODULO_MODE == 1) y.s = x.s; + + return y; + }; + + + /* + * n * 0 = 0 + * n * N = N + * n * I = I + * 0 * n = 0 + * 0 * 0 = 0 + * 0 * N = N + * 0 * I = N + * N * n = N + * N * 0 = N + * N * N = N + * N * I = N + * I * n = I + * I * 0 = N + * I * N = N + * I * I = I + * + * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value + * of BigNumber(y, b). + */ + P.multipliedBy = P.times = function (y, b) { + var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, + base, sqrtBase, + x = this, + xc = x.c, + yc = (y = new BigNumber(y, b)).c; + + // Either NaN, ±Infinity or ±0? + if (!xc || !yc || !xc[0] || !yc[0]) { + + // Return NaN if either is NaN, or one is 0 and the other is Infinity. + if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) { + y.c = y.e = y.s = null; + } else { + y.s *= x.s; + + // Return ±Infinity if either is ±Infinity. + if (!xc || !yc) { + y.c = y.e = null; + + // Return ±0 if either is ±0. + } else { + y.c = [0]; + y.e = 0; + } + } + + return y; + } + + e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE); + y.s *= x.s; + xcL = xc.length; + ycL = yc.length; + + // Ensure xc points to longer array and xcL to its length. + if (xcL < ycL) { + zc = xc; + xc = yc; + yc = zc; + i = xcL; + xcL = ycL; + ycL = i; + } + + // Initialise the result array with zeros. + for (i = xcL + ycL, zc = []; i--; zc.push(0)); + + base = BASE; + sqrtBase = SQRT_BASE; + + for (i = ycL; --i >= 0;) { + c = 0; + ylo = yc[i] % sqrtBase; + yhi = yc[i] / sqrtBase | 0; + + for (k = xcL, j = i + k; j > i;) { + xlo = xc[--k] % sqrtBase; + xhi = xc[k] / sqrtBase | 0; + m = yhi * xlo + xhi * ylo; + xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c; + c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi; + zc[j--] = xlo % base; + } + + zc[j] = c; + } + + if (c) { + ++e; + } else { + zc.splice(0, 1); + } + + return normalise(y, zc, e); + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber negated, + * i.e. multiplied by -1. + */ + P.negated = function () { + var x = new BigNumber(this); + x.s = -x.s || null; + return x; + }; + + + /* + * n + 0 = n + * n + N = N + * n + I = I + * 0 + n = n + * 0 + 0 = 0 + * 0 + N = N + * 0 + I = I + * N + n = N + * N + 0 = N + * N + N = N + * N + I = N + * I + n = I + * I + 0 = I + * I + N = N + * I + I = I + * + * Return a new BigNumber whose value is the value of this BigNumber plus the value of + * BigNumber(y, b). + */ + P.plus = function (y, b) { + var t, + x = this, + a = x.s; + + y = new BigNumber(y, b); + b = y.s; + + // Either NaN? + if (!a || !b) return new BigNumber(NaN); + + // Signs differ? + if (a != b) { + y.s = -b; + return x.minus(y); + } + + var xe = x.e / LOG_BASE, + ye = y.e / LOG_BASE, + xc = x.c, + yc = y.c; + + if (!xe || !ye) { + + // Return ±Infinity if either ±Infinity. + if (!xc || !yc) return new BigNumber(a / 0); + + // Either zero? + // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. + if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0); + } + + xe = bitFloor(xe); + ye = bitFloor(ye); + xc = xc.slice(); + + // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts. + 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(); + } + + a = xc.length; + b = yc.length; + + // Point xc to the longer array, and b to the shorter length. + if (a - b < 0) { + t = yc; + yc = xc; + xc = t; + b = a; + } + + // Only start adding at yc.length - 1 as the further digits of xc can be ignored. + for (a = 0; b;) { + a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0; + xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE; + } + + if (a) { + xc = [a].concat(xc); + ++ye; + } + + // No need to check for zero, as +x + +y != 0 && -x + -y != 0 + // ye = MAX_EXP + 1 possible + return normalise(y, xc, ye); + }; + + + /* + * If sd is undefined or null or true or false, return the number of significant digits of + * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN. + * If sd is true include integer-part trailing zeros in the count. + * + * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this + * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or + * ROUNDING_MODE if rm is omitted. + * + * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive. + * boolean: whether to count integer-part trailing zeros: true or false. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}' + */ + P.precision = P.sd = function (sd, rm) { + var c, n, v, + x = this; + + if (sd != null && sd !== !!sd) { + intCheck(sd, 1, MAX); + if (rm == null) rm = ROUNDING_MODE; + else intCheck(rm, 0, 8); + + return round(new BigNumber(x), sd, rm); + } + + if (!(c = x.c)) return null; + v = c.length - 1; + n = v * LOG_BASE + 1; + + if (v = c[v]) { + + // Subtract the number of trailing zeros of the last element. + for (; v % 10 == 0; v /= 10, n--); + + // Add the number of digits of the first element. + for (v = c[0]; v >= 10; v /= 10, n++); + } + + if (sd && x.e + 1 > n) n = x.e + 1; + + return n; + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber shifted by k places + * (powers of 10). Shift to the right if n > 0, and to the left if n < 0. + * + * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}' + */ + P.shiftedBy = function (k) { + intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); + return this.times('1e' + k); + }; + + + /* + * sqrt(-n) = N + * sqrt(N) = N + * sqrt(-I) = N + * sqrt(I) = I + * sqrt(0) = 0 + * sqrt(-0) = -0 + * + * Return a new BigNumber whose value is the square root of the value of this BigNumber, + * rounded according to DECIMAL_PLACES and ROUNDING_MODE. + */ + P.squareRoot = P.sqrt = function () { + var m, n, r, rep, t, + x = this, + c = x.c, + s = x.s, + e = x.e, + dp = DECIMAL_PLACES + 4, + half = new BigNumber('0.5'); + + // Negative/NaN/Infinity/zero? + if (s !== 1 || !c || !c[0]) { + return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0); + } + + // Initial estimate. + s = Math.sqrt(+valueOf(x)); + + // Math.sqrt underflow/overflow? + // Pass x to Math.sqrt as integer, then adjust the exponent of the result. + if (s == 0 || s == 1 / 0) { + n = coeffToString(c); + if ((n.length + e) % 2 == 0) n += '0'; + s = Math.sqrt(+n); + e = bitFloor((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 BigNumber(n); + } else { + r = new BigNumber(s + ''); + } + + // Check for zero. + // r could be zero if MIN_EXP is changed after the this value was created. + // This would cause a division by zero (x/t) and hence Infinity below, which would cause + // coeffToString to throw. + if (r.c[0]) { + e = r.e; + s = e + dp; + if (s < 3) s = 0; + + // Newton-Raphson iteration. + for (; ;) { + t = r; + r = half.times(t.plus(div(x, t, dp, 1))); + + if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) { + + // The exponent of r may here be one less than the final result exponent, + // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits + // are indexed correctly. + if (r.e < e) --s; + n = n.slice(s - 3, s + 1); + + // The 4th rounding digit may be in error by -1 so if the 4 rounding digits + // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the + // iteration. + if (n == '9999' || !rep && n == '4999') { + + // On the first iteration only, check to see if rounding up gives the + // exact result as the nines may infinitely repeat. + if (!rep) { + round(t, t.e + DECIMAL_PLACES + 2, 0); + + if (t.times(t).eq(x)) { + r = t; + break; + } + } + + dp += 4; + s += 4; + rep = 1; + } else { + + // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact + // result. If not, then there are further digits and m will be truthy. + if (!+n || !+n.slice(1) && n.charAt(0) == '5') { + + // Truncate to the first rounding digit. + round(r, r.e + DECIMAL_PLACES + 2, 1); + m = !r.times(r).eq(x); + } + + break; + } + } + } + } + + return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m); + }; + + + /* + * Return a string representing the value of this BigNumber in exponential notation and + * rounded using ROUNDING_MODE to dp fixed decimal places. + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' + */ + P.toExponential = function (dp, rm) { + if (dp != null) { + intCheck(dp, 0, MAX); + dp++; + } + return format(this, dp, rm, 1); + }; + + + /* + * Return a string representing the value of this BigNumber in fixed-point notation rounding + * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted. + * + * Note: as with JavaScript's number type, (-0).toFixed(0) is '0', + * but e.g. (-0.00001).toFixed(0) is '-0'. + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' + */ + P.toFixed = function (dp, rm) { + if (dp != null) { + intCheck(dp, 0, MAX); + dp = dp + this.e + 1; + } + return format(this, dp, rm); + }; + + + /* + * Return a string representing the value of this BigNumber in fixed-point notation rounded + * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties + * of the format or FORMAT object (see BigNumber.set). + * + * The formatting object may contain some or all of the properties shown below. + * + * FORMAT = { + * prefix: '', + * groupSize: 3, + * secondaryGroupSize: 0, + * groupSeparator: ',', + * decimalSeparator: '.', + * fractionGroupSize: 0, + * fractionGroupSeparator: '\xA0', // non-breaking space + * suffix: '' + * }; + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * [format] {object} Formatting options. See FORMAT pbject above. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' + * '[BigNumber Error] Argument not an object: {format}' + */ + P.toFormat = function (dp, rm, format) { + var str, + x = this; + + if (format == null) { + if (dp != null && rm && typeof rm == 'object') { + format = rm; + rm = null; + } else if (dp && typeof dp == 'object') { + format = dp; + dp = rm = null; + } else { + format = FORMAT; + } + } else if (typeof format != 'object') { + throw Error + (bignumberError + 'Argument not an object: ' + format); + } + + str = x.toFixed(dp, rm); + + if (x.c) { + var i, + arr = str.split('.'), + g1 = +format.groupSize, + g2 = +format.secondaryGroupSize, + groupSeparator = format.groupSeparator || '', + intPart = arr[0], + fractionPart = arr[1], + isNeg = x.s < 0, + intDigits = isNeg ? intPart.slice(1) : intPart, + len = intDigits.length; + + if (g2) { + i = g1; + g1 = g2; + g2 = i; + len -= i; + } + + if (g1 > 0 && len > 0) { + i = len % g1 || g1; + intPart = intDigits.substr(0, i); + for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1); + if (g2 > 0) intPart += groupSeparator + intDigits.slice(i); + if (isNeg) intPart = '-' + intPart; + } + + str = fractionPart + ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize) + ? fractionPart.replace(new RegExp('\\d{' + g2 + '}\\B', 'g'), + '$&' + (format.fractionGroupSeparator || '')) + : fractionPart) + : intPart; + } + + return (format.prefix || '') + str + (format.suffix || ''); + }; + + + /* + * Return an array of two BigNumbers representing the value of this BigNumber as a simple + * fraction with an integer numerator and an integer denominator. + * The denominator will be a positive non-zero value less than or equal to the specified + * maximum denominator. If a maximum denominator is not specified, the denominator will be + * the lowest value necessary to represent the number exactly. + * + * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator. + * + * '[BigNumber Error] Argument {not an integer|out of range} : {md}' + */ + P.toFraction = function (md) { + var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, + x = this, + xc = x.c; + + if (md != null) { + n = new BigNumber(md); + + // Throw if md is less than one or is not an integer, unless it is Infinity. + if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) { + throw Error + (bignumberError + 'Argument ' + + (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n)); + } + } + + if (!xc) return new BigNumber(x); + + d = new BigNumber(ONE); + n1 = d0 = new BigNumber(ONE); + d1 = n0 = new BigNumber(ONE); + s = coeffToString(xc); + + // Determine initial denominator. + // d is a power of 10 and the minimum max denominator that specifies the value exactly. + e = d.e = s.length - x.e - 1; + d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp]; + md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n; + + exp = MAX_EXP; + MAX_EXP = 1 / 0; + n = new BigNumber(s); + + // n0 = d1 = 0 + n0.c[0] = 0; + + for (; ;) { + q = div(n, d, 0, 1); + d2 = d0.plus(q.times(d1)); + if (d2.comparedTo(md) == 1) break; + d0 = d1; + d1 = d2; + n1 = n0.plus(q.times(d2 = n1)); + n0 = d2; + d = n.minus(q.times(d2 = d)); + n = d2; + } + + d2 = div(md.minus(d0), d1, 0, 1); + n0 = n0.plus(d2.times(n1)); + d0 = d0.plus(d2.times(d1)); + n0.s = n1.s = x.s; + e = e * 2; + + // Determine which fraction is closer to x, n0/d0 or n1/d1 + r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo( + div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0]; + + MAX_EXP = exp; + + return r; + }; + + + /* + * Return the value of this BigNumber converted to a number primitive. + */ + P.toNumber = function () { + return +valueOf(this); + }; + + + /* + * Return a string representing the value of this BigNumber rounded to sd significant digits + * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits + * necessary to represent the integer part of the value in fixed-point notation, then use + * exponential notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}' + */ + P.toPrecision = function (sd, rm) { + if (sd != null) intCheck(sd, 1, MAX); + return format(this, sd, rm, 2); + }; + + + /* + * Return a string representing the value of this BigNumber in base b, or base 10 if b is + * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and + * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent + * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than + * TO_EXP_NEG, return exponential notation. + * + * [b] {number} Integer, 2 to ALPHABET.length inclusive. + * + * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}' + */ + P.toString = function (b) { + var str, + n = this, + s = n.s, + e = n.e; + + // Infinity or NaN? + if (e === null) { + if (s) { + str = 'Infinity'; + if (s < 0) str = '-' + str; + } else { + str = 'NaN'; + } + } else { + if (b == null) { + str = e <= TO_EXP_NEG || e >= TO_EXP_POS + ? toExponential(coeffToString(n.c), e) + : toFixedPoint(coeffToString(n.c), e, '0'); + } else if (b === 10 && alphabetHasNormalDecimalDigits) { + n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE); + str = toFixedPoint(coeffToString(n.c), n.e, '0'); + } else { + intCheck(b, 2, ALPHABET.length, 'Base'); + str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true); + } + + if (s < 0 && n.c[0]) str = '-' + str; + } + + return str; + }; + + + /* + * Return as toString, but do not accept a base argument, and include the minus sign for + * negative zero. + */ + P.valueOf = P.toJSON = function () { + return valueOf(this); + }; + + + P._isBigNumber = true; + + if (configObject != null) BigNumber.set(configObject); + + return BigNumber; + } + + + // PRIVATE HELPER FUNCTIONS + + // These functions don't need access to variables, + // e.g. DECIMAL_PLACES, in the scope of the `clone` function above. + + + function bitFloor(n) { + var i = n | 0; + return n > 0 || n === i ? i : i - 1; + } + + + // Return a coefficient array as a string of base 10 digits. + function coeffToString(a) { + var s, z, + i = 1, + j = a.length, + r = a[0] + ''; + + for (; i < j;) { + s = a[i++] + ''; + z = LOG_BASE - s.length; + for (; z--; s = '0' + s); + r += s; + } + + // Determine trailing zeros. + for (j = r.length; r.charCodeAt(--j) === 48;); + + return r.slice(0, j + 1 || 1); + } + + + // Compare the value of BigNumbers x and y. + function compare(x, y) { + var a, b, + xc = x.c, + yc = y.c, + i = x.s, + j = y.s, + k = x.e, + l = y.e; + + // Either NaN? + if (!i || !j) return null; + + a = xc && !xc[0]; + b = yc && !yc[0]; + + // Either zero? + if (a || b) return a ? b ? 0 : -j : i; + + // Signs differ? + if (i != j) return i; + + a = i < 0; + b = k == l; + + // Either Infinity? + if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1; + + // Compare exponents. + if (!b) return k > l ^ a ? 1 : -1; + + j = (k = xc.length) < (l = yc.length) ? k : l; + + // Compare digit by digit. + for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1; + + // Compare lengths. + return k == l ? 0 : k > l ^ a ? 1 : -1; + } + + + /* + * Check that n is a primitive number, an integer, and in range, otherwise throw. + */ + function intCheck(n, min, max, name) { + if (n < min || n > max || n !== mathfloor(n)) { + throw Error + (bignumberError + (name || 'Argument') + (typeof n == 'number' + ? n < min || n > max ? ' out of range: ' : ' not an integer: ' + : ' not a primitive number: ') + String(n)); + } + } + + + // Assumes finite n. + function isOdd(n) { + var k = n.c.length - 1; + return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0; + } + + + function toExponential(str, e) { + return (str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str) + + (e < 0 ? 'e' : 'e+') + e; + } + + + function toFixedPoint(str, e, z) { + var len, zs; + + // Negative exponent? + if (e < 0) { + + // Prepend zeros. + for (zs = z + '.'; ++e; zs += z); + str = zs + str; + + // Positive exponent + } else { + len = str.length; + + // Append zeros. + if (++e > len) { + for (zs = z, e -= len; --e; zs += z); + str += zs; + } else if (e < len) { + str = str.slice(0, e) + '.' + str.slice(e); + } + } + + return str; + } + + + // EXPORT + + + BigNumber = clone(); + BigNumber['default'] = BigNumber.BigNumber = BigNumber; + + // AMD. + if (true) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { return BigNumber; }).call(exports, __webpack_require__, exports, module), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + + // Node.js and other environments that support module.exports. + } else {} +})(this); + + +/***/ }), + +/***/ "./node_modules/bn.js/lib/bn.js": +/*!**************************************!*\ + !*** ./node_modules/bn.js/lib/bn.js ***! + \**************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(/*! buffer */ "?8131").Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [number & 0x3ffffff]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this._strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // '0' - '9' + if (c >= 48 && c <= 57) { + return c - 48; + // 'A' - 'F' + } else if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + } else { + assert(false, 'Invalid character in ' + string); + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this._strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var b = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + b = c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + b = c - 17 + 0xa; + + // '0' - '9' + } else { + b = c; + } + assert(c >= 0 && b < mul, 'Invalid character'); + r += b; + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [0]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this._strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + function move (dest, src) { + dest.words = src.words; + dest.length = src.length; + dest.negative = src.negative; + dest.red = src.red; + } + + BN.prototype._move = function _move (dest) { + move(dest, this); + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype._strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + // Check Symbol.for because not everywhere where Symbol defined + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility + if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') { + try { + BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect; + } catch (e) { + BN.prototype.inspect = inspect; + } + } else { + BN.prototype.inspect = inspect; + } + + function inspect () { + return (this.red ? ''; + } + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modrn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16, 2); + }; + + if (Buffer) { + BN.prototype.toBuffer = function toBuffer (endian, length) { + return this.toArrayLike(Buffer, endian, length); + }; + } + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + var allocate = function allocate (ArrayType, size) { + if (ArrayType.allocUnsafe) { + return ArrayType.allocUnsafe(size); + } + return new ArrayType(size); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + this._strip(); + + 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'); + + var res = allocate(ArrayType, reqLength); + var postfix = endian === 'le' ? 'LE' : 'BE'; + this['_toArrayLike' + postfix](res, byteLength); + return res; + }; + + BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) { + var position = 0; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position++] = word & 0xff; + if (position < res.length) { + res[position++] = (word >> 8) & 0xff; + } + if (position < res.length) { + res[position++] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position < res.length) { + res[position++] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position < res.length) { + res[position++] = carry; + + while (position < res.length) { + res[position++] = 0; + } + } + }; + + BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) { + var position = res.length - 1; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position--] = word & 0xff; + if (position >= 0) { + res[position--] = (word >> 8) & 0xff; + } + if (position >= 0) { + res[position--] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position >= 0) { + res[position--] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position >= 0) { + res[position--] = carry; + + while (position >= 0) { + res[position--] = 0; + } + } + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] >>> wbit) & 0x01; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this._strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this._strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this._strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this._strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this._strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this._strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out._strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out._strip(); + } + + function jumboMulTo (self, num, out) { + // Temporary disable, see https://github.com/indutny/bn.js/issues/211 + // var fftm = new FFTM(); + // return fftm.mulp(self, num, out); + return bigMulTo(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; + + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out._strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this._strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this._strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this._strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) <= num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this._strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this._strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this._strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q._strip(); + } + a._strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modrn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modrn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modrn = function modrn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return isNegNum ? -acc : acc; + }; + + // WARNING: DEPRECATED + BN.prototype.modn = function modn (num) { + return this.modrn(num); + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + this._strip(); + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this._strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is a BN v4 instance + r.strip(); + } else { + // r is a BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + + move(a, a.umod(this.m)._forceRed(this)); + return a; + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ "./node_modules/brorand/index.js": +/*!***************************************!*\ + !*** ./node_modules/brorand/index.js ***! + \***************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var r; + +module.exports = function rand(len) { + if (!r) + r = new Rand(null); + + return r.generate(len); +}; + +function Rand(rand) { + this.rand = rand; +} +module.exports.Rand = Rand; + +Rand.prototype.generate = function generate(len) { + return this._rand(len); +}; + +// Emulate crypto API using randy +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) { + // Modern browsers + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + self.crypto.getRandomValues(arr); + return arr; + }; + } else if (self.msCrypto && self.msCrypto.getRandomValues) { + // IE + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + self.msCrypto.getRandomValues(arr); + return arr; + }; + + // Safari's WebWorkers do not have `crypto` + } else if (typeof window === 'object') { + // Old junk + Rand.prototype._rand = function() { + throw new Error('Not implemented yet'); + }; + } +} else { + // Node.js or Web worker with no crypto support + try { + var crypto = __webpack_require__(/*! crypto */ "?3fc0"); + if (typeof crypto.randomBytes !== 'function') + throw new Error('Not supported'); + + Rand.prototype._rand = function _rand(n) { + return crypto.randomBytes(n); + }; + } catch (e) { + } +} + + +/***/ }), + +/***/ "./node_modules/browserify-aes/aes.js": +/*!********************************************!*\ + !*** ./node_modules/browserify-aes/aes.js ***! + \********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +// based on the aes implimentation in triple sec +// https://github.com/keybase/triplesec +// which is in turn based on the one from crypto-js +// https://code.google.com/p/crypto-js/ + +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) + +function asUInt32Array (buf) { + if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) + + var len = (buf.length / 4) | 0 + var out = new Array(len) + + for (var i = 0; i < len; i++) { + out[i] = buf.readUInt32BE(i * 4) + } + + return out +} + +function scrubVec (v) { + for (var i = 0; i < v.length; v++) { + v[i] = 0 + } +} + +function cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) { + var SUB_MIX0 = SUB_MIX[0] + var SUB_MIX1 = SUB_MIX[1] + var SUB_MIX2 = SUB_MIX[2] + var SUB_MIX3 = SUB_MIX[3] + + var s0 = M[0] ^ keySchedule[0] + var s1 = M[1] ^ keySchedule[1] + var s2 = M[2] ^ keySchedule[2] + var s3 = M[3] ^ keySchedule[3] + var t0, t1, t2, t3 + var ksRow = 4 + + for (var round = 1; round < nRounds; round++) { + t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++] + t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++] + t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++] + t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++] + s0 = t0 + s1 = t1 + s2 = t2 + s3 = t3 + } + + t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++] + t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++] + t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++] + t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++] + t0 = t0 >>> 0 + t1 = t1 >>> 0 + t2 = t2 >>> 0 + t3 = t3 >>> 0 + + return [t0, t1, t2, t3] +} + +// AES constants +var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36] +var G = (function () { + // Compute double table + var d = new Array(256) + for (var j = 0; j < 256; j++) { + if (j < 128) { + d[j] = j << 1 + } else { + d[j] = (j << 1) ^ 0x11b + } + } + + var SBOX = [] + var INV_SBOX = [] + var SUB_MIX = [[], [], [], []] + var INV_SUB_MIX = [[], [], [], []] + + // Walk GF(2^8) + var x = 0 + var xi = 0 + for (var i = 0; i < 256; ++i) { + // Compute sbox + var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4) + sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63 + SBOX[x] = sx + INV_SBOX[sx] = x + + // Compute multiplication + var x2 = d[x] + var x4 = d[x2] + var x8 = d[x4] + + // Compute sub bytes, mix columns tables + var t = (d[sx] * 0x101) ^ (sx * 0x1010100) + SUB_MIX[0][x] = (t << 24) | (t >>> 8) + SUB_MIX[1][x] = (t << 16) | (t >>> 16) + SUB_MIX[2][x] = (t << 8) | (t >>> 24) + SUB_MIX[3][x] = t + + // Compute inv sub bytes, inv mix columns tables + t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100) + INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8) + INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16) + INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24) + INV_SUB_MIX[3][sx] = t + + if (x === 0) { + x = xi = 1 + } else { + x = x2 ^ d[d[d[x8 ^ x2]]] + xi ^= d[d[xi]] + } + } + + return { + SBOX: SBOX, + INV_SBOX: INV_SBOX, + SUB_MIX: SUB_MIX, + INV_SUB_MIX: INV_SUB_MIX + } +})() + +function AES (key) { + this._key = asUInt32Array(key) + this._reset() +} + +AES.blockSize = 4 * 4 +AES.keySize = 256 / 8 +AES.prototype.blockSize = AES.blockSize +AES.prototype.keySize = AES.keySize +AES.prototype._reset = function () { + var keyWords = this._key + var keySize = keyWords.length + var nRounds = keySize + 6 + var ksRows = (nRounds + 1) * 4 + + var keySchedule = [] + for (var k = 0; k < keySize; k++) { + keySchedule[k] = keyWords[k] + } + + for (k = keySize; k < ksRows; k++) { + var t = keySchedule[k - 1] + + if (k % keySize === 0) { + t = (t << 8) | (t >>> 24) + t = + (G.SBOX[t >>> 24] << 24) | + (G.SBOX[(t >>> 16) & 0xff] << 16) | + (G.SBOX[(t >>> 8) & 0xff] << 8) | + (G.SBOX[t & 0xff]) + + t ^= RCON[(k / keySize) | 0] << 24 + } else if (keySize > 6 && k % keySize === 4) { + t = + (G.SBOX[t >>> 24] << 24) | + (G.SBOX[(t >>> 16) & 0xff] << 16) | + (G.SBOX[(t >>> 8) & 0xff] << 8) | + (G.SBOX[t & 0xff]) + } + + keySchedule[k] = keySchedule[k - keySize] ^ t + } + + var invKeySchedule = [] + for (var ik = 0; ik < ksRows; ik++) { + var ksR = ksRows - ik + var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)] + + if (ik < 4 || ksR <= 4) { + invKeySchedule[ik] = tt + } else { + invKeySchedule[ik] = + G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^ + G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^ + G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^ + G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]] + } + } + + this._nRounds = nRounds + this._keySchedule = keySchedule + this._invKeySchedule = invKeySchedule +} + +AES.prototype.encryptBlockRaw = function (M) { + M = asUInt32Array(M) + return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds) +} + +AES.prototype.encryptBlock = function (M) { + var out = this.encryptBlockRaw(M) + var buf = Buffer.allocUnsafe(16) + buf.writeUInt32BE(out[0], 0) + buf.writeUInt32BE(out[1], 4) + buf.writeUInt32BE(out[2], 8) + buf.writeUInt32BE(out[3], 12) + return buf +} + +AES.prototype.decryptBlock = function (M) { + M = asUInt32Array(M) + + // swap + var m1 = M[1] + M[1] = M[3] + M[3] = m1 + + var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds) + var buf = Buffer.allocUnsafe(16) + buf.writeUInt32BE(out[0], 0) + buf.writeUInt32BE(out[3], 4) + buf.writeUInt32BE(out[2], 8) + buf.writeUInt32BE(out[1], 12) + return buf +} + +AES.prototype.scrub = function () { + scrubVec(this._keySchedule) + scrubVec(this._invKeySchedule) + scrubVec(this._key) +} + +module.exports.AES = AES + + +/***/ }), + +/***/ "./node_modules/browserify-aes/authCipher.js": +/*!***************************************************!*\ + !*** ./node_modules/browserify-aes/authCipher.js ***! + \***************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var aes = __webpack_require__(/*! ./aes */ "./node_modules/browserify-aes/aes.js") +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var Transform = __webpack_require__(/*! cipher-base */ "./node_modules/cipher-base/index.js") +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js") +var GHASH = __webpack_require__(/*! ./ghash */ "./node_modules/browserify-aes/ghash.js") +var xor = __webpack_require__(/*! buffer-xor */ "./node_modules/buffer-xor/index.js") +var incr32 = __webpack_require__(/*! ./incr32 */ "./node_modules/browserify-aes/incr32.js") + +function xorTest (a, b) { + var out = 0 + if (a.length !== b.length) out++ + + var len = Math.min(a.length, b.length) + for (var i = 0; i < len; ++i) { + out += (a[i] ^ b[i]) + } + + return out +} + +function calcIv (self, iv, ck) { + if (iv.length === 12) { + self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])]) + return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])]) + } + var ghash = new GHASH(ck) + var len = iv.length + var toPad = len % 16 + ghash.update(iv) + if (toPad) { + toPad = 16 - toPad + ghash.update(Buffer.alloc(toPad, 0)) + } + ghash.update(Buffer.alloc(8, 0)) + var ivBits = len * 8 + var tail = Buffer.alloc(8) + tail.writeUIntBE(ivBits, 0, 8) + ghash.update(tail) + self._finID = ghash.state + var out = Buffer.from(self._finID) + incr32(out) + return out +} +function StreamCipher (mode, key, iv, decrypt) { + Transform.call(this) + + var h = Buffer.alloc(4, 0) + + this._cipher = new aes.AES(key) + var ck = this._cipher.encryptBlock(h) + this._ghash = new GHASH(ck) + iv = calcIv(this, iv, ck) + + this._prev = Buffer.from(iv) + this._cache = Buffer.allocUnsafe(0) + this._secCache = Buffer.allocUnsafe(0) + this._decrypt = decrypt + this._alen = 0 + this._len = 0 + this._mode = mode + + this._authTag = null + this._called = false +} + +inherits(StreamCipher, Transform) + +StreamCipher.prototype._update = function (chunk) { + if (!this._called && this._alen) { + var rump = 16 - (this._alen % 16) + if (rump < 16) { + rump = Buffer.alloc(rump, 0) + this._ghash.update(rump) + } + } + + this._called = true + var out = this._mode.encrypt(this, chunk) + if (this._decrypt) { + this._ghash.update(chunk) + } else { + this._ghash.update(out) + } + this._len += chunk.length + return out +} + +StreamCipher.prototype._final = function () { + if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data') + + var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID)) + if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data') + + this._authTag = tag + this._cipher.scrub() +} + +StreamCipher.prototype.getAuthTag = function getAuthTag () { + if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state') + + return this._authTag +} + +StreamCipher.prototype.setAuthTag = function setAuthTag (tag) { + if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state') + + this._authTag = tag +} + +StreamCipher.prototype.setAAD = function setAAD (buf) { + if (this._called) throw new Error('Attempting to set AAD in unsupported state') + + this._ghash.update(buf) + this._alen += buf.length +} + +module.exports = StreamCipher + + +/***/ }), + +/***/ "./node_modules/browserify-aes/browser.js": +/*!************************************************!*\ + !*** ./node_modules/browserify-aes/browser.js ***! + \************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +var ciphers = __webpack_require__(/*! ./encrypter */ "./node_modules/browserify-aes/encrypter.js") +var deciphers = __webpack_require__(/*! ./decrypter */ "./node_modules/browserify-aes/decrypter.js") +var modes = __webpack_require__(/*! ./modes/list.json */ "./node_modules/browserify-aes/modes/list.json") + +function getCiphers () { + return Object.keys(modes) +} + +exports.createCipher = exports.Cipher = ciphers.createCipher +exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv +exports.createDecipher = exports.Decipher = deciphers.createDecipher +exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv +exports.listCiphers = exports.getCiphers = getCiphers + + +/***/ }), + +/***/ "./node_modules/browserify-aes/decrypter.js": +/*!**************************************************!*\ + !*** ./node_modules/browserify-aes/decrypter.js ***! + \**************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +var AuthCipher = __webpack_require__(/*! ./authCipher */ "./node_modules/browserify-aes/authCipher.js") +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var MODES = __webpack_require__(/*! ./modes */ "./node_modules/browserify-aes/modes/index.js") +var StreamCipher = __webpack_require__(/*! ./streamCipher */ "./node_modules/browserify-aes/streamCipher.js") +var Transform = __webpack_require__(/*! cipher-base */ "./node_modules/cipher-base/index.js") +var aes = __webpack_require__(/*! ./aes */ "./node_modules/browserify-aes/aes.js") +var ebtk = __webpack_require__(/*! evp_bytestokey */ "./node_modules/evp_bytestokey/index.js") +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js") + +function Decipher (mode, key, iv) { + Transform.call(this) + + this._cache = new Splitter() + this._last = void 0 + this._cipher = new aes.AES(key) + this._prev = Buffer.from(iv) + this._mode = mode + this._autopadding = true +} + +inherits(Decipher, Transform) + +Decipher.prototype._update = function (data) { + this._cache.add(data) + var chunk + var thing + var out = [] + while ((chunk = this._cache.get(this._autopadding))) { + thing = this._mode.decrypt(this, chunk) + out.push(thing) + } + return Buffer.concat(out) +} + +Decipher.prototype._final = function () { + var chunk = this._cache.flush() + if (this._autopadding) { + return unpad(this._mode.decrypt(this, chunk)) + } else if (chunk) { + throw new Error('data not multiple of block length') + } +} + +Decipher.prototype.setAutoPadding = function (setTo) { + this._autopadding = !!setTo + return this +} + +function Splitter () { + this.cache = Buffer.allocUnsafe(0) +} + +Splitter.prototype.add = function (data) { + this.cache = Buffer.concat([this.cache, data]) +} + +Splitter.prototype.get = function (autoPadding) { + var out + if (autoPadding) { + if (this.cache.length > 16) { + out = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + return out + } + } else { + if (this.cache.length >= 16) { + out = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + return out + } + } + + return null +} + +Splitter.prototype.flush = function () { + if (this.cache.length) return this.cache +} + +function unpad (last) { + var padded = last[15] + if (padded < 1 || padded > 16) { + throw new Error('unable to decrypt data') + } + var i = -1 + while (++i < padded) { + if (last[(i + (16 - padded))] !== padded) { + throw new Error('unable to decrypt data') + } + } + if (padded === 16) return + + return last.slice(0, 16 - padded) +} + +function createDecipheriv (suite, password, iv) { + var config = MODES[suite.toLowerCase()] + if (!config) throw new TypeError('invalid suite type') + + if (typeof iv === 'string') iv = Buffer.from(iv) + if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length) + + if (typeof password === 'string') password = Buffer.from(password) + if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length) + + if (config.type === 'stream') { + return new StreamCipher(config.module, password, iv, true) + } else if (config.type === 'auth') { + return new AuthCipher(config.module, password, iv, true) + } + + return new Decipher(config.module, password, iv) +} + +function createDecipher (suite, password) { + var config = MODES[suite.toLowerCase()] + if (!config) throw new TypeError('invalid suite type') + + var keys = ebtk(password, false, config.key, config.iv) + return createDecipheriv(suite, keys.key, keys.iv) +} + +exports.createDecipher = createDecipher +exports.createDecipheriv = createDecipheriv + + +/***/ }), + +/***/ "./node_modules/browserify-aes/encrypter.js": +/*!**************************************************!*\ + !*** ./node_modules/browserify-aes/encrypter.js ***! + \**************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +var MODES = __webpack_require__(/*! ./modes */ "./node_modules/browserify-aes/modes/index.js") +var AuthCipher = __webpack_require__(/*! ./authCipher */ "./node_modules/browserify-aes/authCipher.js") +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var StreamCipher = __webpack_require__(/*! ./streamCipher */ "./node_modules/browserify-aes/streamCipher.js") +var Transform = __webpack_require__(/*! cipher-base */ "./node_modules/cipher-base/index.js") +var aes = __webpack_require__(/*! ./aes */ "./node_modules/browserify-aes/aes.js") +var ebtk = __webpack_require__(/*! evp_bytestokey */ "./node_modules/evp_bytestokey/index.js") +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js") + +function Cipher (mode, key, iv) { + Transform.call(this) + + this._cache = new Splitter() + this._cipher = new aes.AES(key) + this._prev = Buffer.from(iv) + this._mode = mode + this._autopadding = true +} + +inherits(Cipher, Transform) + +Cipher.prototype._update = function (data) { + this._cache.add(data) + var chunk + var thing + var out = [] + + while ((chunk = this._cache.get())) { + thing = this._mode.encrypt(this, chunk) + out.push(thing) + } + + return Buffer.concat(out) +} + +var PADDING = Buffer.alloc(16, 0x10) + +Cipher.prototype._final = function () { + var chunk = this._cache.flush() + if (this._autopadding) { + chunk = this._mode.encrypt(this, chunk) + this._cipher.scrub() + return chunk + } + + if (!chunk.equals(PADDING)) { + this._cipher.scrub() + throw new Error('data not multiple of block length') + } +} + +Cipher.prototype.setAutoPadding = function (setTo) { + this._autopadding = !!setTo + return this +} + +function Splitter () { + this.cache = Buffer.allocUnsafe(0) +} + +Splitter.prototype.add = function (data) { + this.cache = Buffer.concat([this.cache, data]) +} + +Splitter.prototype.get = function () { + if (this.cache.length > 15) { + var out = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + return out + } + return null +} + +Splitter.prototype.flush = function () { + var len = 16 - this.cache.length + var padBuff = Buffer.allocUnsafe(len) + + var i = -1 + while (++i < len) { + padBuff.writeUInt8(len, i) + } + + return Buffer.concat([this.cache, padBuff]) +} + +function createCipheriv (suite, password, iv) { + var config = MODES[suite.toLowerCase()] + if (!config) throw new TypeError('invalid suite type') + + if (typeof password === 'string') password = Buffer.from(password) + if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length) + + if (typeof iv === 'string') iv = Buffer.from(iv) + if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length) + + if (config.type === 'stream') { + return new StreamCipher(config.module, password, iv) + } else if (config.type === 'auth') { + return new AuthCipher(config.module, password, iv) + } + + return new Cipher(config.module, password, iv) +} + +function createCipher (suite, password) { + var config = MODES[suite.toLowerCase()] + if (!config) throw new TypeError('invalid suite type') + + var keys = ebtk(password, false, config.key, config.iv) + return createCipheriv(suite, keys.key, keys.iv) +} + +exports.createCipheriv = createCipheriv +exports.createCipher = createCipher + + +/***/ }), + +/***/ "./node_modules/browserify-aes/ghash.js": +/*!**********************************************!*\ + !*** ./node_modules/browserify-aes/ghash.js ***! + \**********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var ZEROES = Buffer.alloc(16, 0) + +function toArray (buf) { + return [ + buf.readUInt32BE(0), + buf.readUInt32BE(4), + buf.readUInt32BE(8), + buf.readUInt32BE(12) + ] +} + +function fromArray (out) { + var buf = Buffer.allocUnsafe(16) + buf.writeUInt32BE(out[0] >>> 0, 0) + buf.writeUInt32BE(out[1] >>> 0, 4) + buf.writeUInt32BE(out[2] >>> 0, 8) + buf.writeUInt32BE(out[3] >>> 0, 12) + return buf +} + +function GHASH (key) { + this.h = key + this.state = Buffer.alloc(16, 0) + this.cache = Buffer.allocUnsafe(0) +} + +// from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html +// by Juho Vähä-Herttua +GHASH.prototype.ghash = function (block) { + var i = -1 + while (++i < block.length) { + this.state[i] ^= block[i] + } + this._multiply() +} + +GHASH.prototype._multiply = function () { + var Vi = toArray(this.h) + var Zi = [0, 0, 0, 0] + var j, xi, lsbVi + var i = -1 + while (++i < 128) { + xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0 + if (xi) { + // Z_i+1 = Z_i ^ V_i + Zi[0] ^= Vi[0] + Zi[1] ^= Vi[1] + Zi[2] ^= Vi[2] + Zi[3] ^= Vi[3] + } + + // Store the value of LSB(V_i) + lsbVi = (Vi[3] & 1) !== 0 + + // V_i+1 = V_i >> 1 + for (j = 3; j > 0; j--) { + Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31) + } + Vi[0] = Vi[0] >>> 1 + + // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R + if (lsbVi) { + Vi[0] = Vi[0] ^ (0xe1 << 24) + } + } + this.state = fromArray(Zi) +} + +GHASH.prototype.update = function (buf) { + this.cache = Buffer.concat([this.cache, buf]) + var chunk + while (this.cache.length >= 16) { + chunk = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + this.ghash(chunk) + } +} + +GHASH.prototype.final = function (abl, bl) { + if (this.cache.length) { + this.ghash(Buffer.concat([this.cache, ZEROES], 16)) + } + + this.ghash(fromArray([0, abl, 0, bl])) + return this.state +} + +module.exports = GHASH + + +/***/ }), + +/***/ "./node_modules/browserify-aes/incr32.js": +/*!***********************************************!*\ + !*** ./node_modules/browserify-aes/incr32.js ***! + \***********************************************/ +/***/ (function(module) { + +function incr32 (iv) { + var len = iv.length + var item + while (len--) { + item = iv.readUInt8(len) + if (item === 255) { + iv.writeUInt8(0, len) + } else { + item++ + iv.writeUInt8(item, len) + break + } + } +} +module.exports = incr32 + + +/***/ }), + +/***/ "./node_modules/browserify-aes/modes/cbc.js": +/*!**************************************************!*\ + !*** ./node_modules/browserify-aes/modes/cbc.js ***! + \**************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +var xor = __webpack_require__(/*! buffer-xor */ "./node_modules/buffer-xor/index.js") + +exports.encrypt = function (self, block) { + var data = xor(block, self._prev) + + self._prev = self._cipher.encryptBlock(data) + return self._prev +} + +exports.decrypt = function (self, block) { + var pad = self._prev + + self._prev = block + var out = self._cipher.decryptBlock(block) + + return xor(out, pad) +} + + +/***/ }), + +/***/ "./node_modules/browserify-aes/modes/cfb.js": +/*!**************************************************!*\ + !*** ./node_modules/browserify-aes/modes/cfb.js ***! + \**************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var xor = __webpack_require__(/*! buffer-xor */ "./node_modules/buffer-xor/index.js") + +function encryptStart (self, data, decrypt) { + var len = data.length + var out = xor(data, self._cache) + self._cache = self._cache.slice(len) + self._prev = Buffer.concat([self._prev, decrypt ? data : out]) + return out +} + +exports.encrypt = function (self, data, decrypt) { + var out = Buffer.allocUnsafe(0) + var len + + while (data.length) { + if (self._cache.length === 0) { + self._cache = self._cipher.encryptBlock(self._prev) + self._prev = Buffer.allocUnsafe(0) + } + + if (self._cache.length <= data.length) { + len = self._cache.length + out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)]) + data = data.slice(len) + } else { + out = Buffer.concat([out, encryptStart(self, data, decrypt)]) + break + } + } + + return out +} + + +/***/ }), + +/***/ "./node_modules/browserify-aes/modes/cfb1.js": +/*!***************************************************!*\ + !*** ./node_modules/browserify-aes/modes/cfb1.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) + +function encryptByte (self, byteParam, decrypt) { + var pad + var i = -1 + var len = 8 + var out = 0 + var bit, value + while (++i < len) { + pad = self._cipher.encryptBlock(self._prev) + bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0 + value = pad[0] ^ bit + out += ((value & 0x80) >> (i % 8)) + self._prev = shiftIn(self._prev, decrypt ? bit : value) + } + return out +} + +function shiftIn (buffer, value) { + var len = buffer.length + var i = -1 + var out = Buffer.allocUnsafe(buffer.length) + buffer = Buffer.concat([buffer, Buffer.from([value])]) + + while (++i < len) { + out[i] = buffer[i] << 1 | buffer[i + 1] >> (7) + } + + return out +} + +exports.encrypt = function (self, chunk, decrypt) { + var len = chunk.length + var out = Buffer.allocUnsafe(len) + var i = -1 + + while (++i < len) { + out[i] = encryptByte(self, chunk[i], decrypt) + } + + return out +} + + +/***/ }), + +/***/ "./node_modules/browserify-aes/modes/cfb8.js": +/*!***************************************************!*\ + !*** ./node_modules/browserify-aes/modes/cfb8.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) + +function encryptByte (self, byteParam, decrypt) { + var pad = self._cipher.encryptBlock(self._prev) + var out = pad[0] ^ byteParam + + self._prev = Buffer.concat([ + self._prev.slice(1), + Buffer.from([decrypt ? byteParam : out]) + ]) + + return out +} + +exports.encrypt = function (self, chunk, decrypt) { + var len = chunk.length + var out = Buffer.allocUnsafe(len) + var i = -1 + + while (++i < len) { + out[i] = encryptByte(self, chunk[i], decrypt) + } + + return out +} + + +/***/ }), + +/***/ "./node_modules/browserify-aes/modes/ctr.js": +/*!**************************************************!*\ + !*** ./node_modules/browserify-aes/modes/ctr.js ***! + \**************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +var xor = __webpack_require__(/*! buffer-xor */ "./node_modules/buffer-xor/index.js") +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var incr32 = __webpack_require__(/*! ../incr32 */ "./node_modules/browserify-aes/incr32.js") + +function getBlock (self) { + var out = self._cipher.encryptBlockRaw(self._prev) + incr32(self._prev) + return out +} + +var blockSize = 16 +exports.encrypt = function (self, chunk) { + var chunkNum = Math.ceil(chunk.length / blockSize) + var start = self._cache.length + self._cache = Buffer.concat([ + self._cache, + Buffer.allocUnsafe(chunkNum * blockSize) + ]) + for (var i = 0; i < chunkNum; i++) { + var out = getBlock(self) + var offset = start + i * blockSize + self._cache.writeUInt32BE(out[0], offset + 0) + self._cache.writeUInt32BE(out[1], offset + 4) + self._cache.writeUInt32BE(out[2], offset + 8) + self._cache.writeUInt32BE(out[3], offset + 12) + } + var pad = self._cache.slice(0, chunk.length) + self._cache = self._cache.slice(chunk.length) + return xor(chunk, pad) +} + + +/***/ }), + +/***/ "./node_modules/browserify-aes/modes/ecb.js": +/*!**************************************************!*\ + !*** ./node_modules/browserify-aes/modes/ecb.js ***! + \**************************************************/ +/***/ (function(__unused_webpack_module, exports) { + +exports.encrypt = function (self, block) { + return self._cipher.encryptBlock(block) +} + +exports.decrypt = function (self, block) { + return self._cipher.decryptBlock(block) +} + + +/***/ }), + +/***/ "./node_modules/browserify-aes/modes/index.js": +/*!****************************************************!*\ + !*** ./node_modules/browserify-aes/modes/index.js ***! + \****************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var modeModules = { + ECB: __webpack_require__(/*! ./ecb */ "./node_modules/browserify-aes/modes/ecb.js"), + CBC: __webpack_require__(/*! ./cbc */ "./node_modules/browserify-aes/modes/cbc.js"), + CFB: __webpack_require__(/*! ./cfb */ "./node_modules/browserify-aes/modes/cfb.js"), + CFB8: __webpack_require__(/*! ./cfb8 */ "./node_modules/browserify-aes/modes/cfb8.js"), + CFB1: __webpack_require__(/*! ./cfb1 */ "./node_modules/browserify-aes/modes/cfb1.js"), + OFB: __webpack_require__(/*! ./ofb */ "./node_modules/browserify-aes/modes/ofb.js"), + CTR: __webpack_require__(/*! ./ctr */ "./node_modules/browserify-aes/modes/ctr.js"), + GCM: __webpack_require__(/*! ./ctr */ "./node_modules/browserify-aes/modes/ctr.js") +} + +var modes = __webpack_require__(/*! ./list.json */ "./node_modules/browserify-aes/modes/list.json") + +for (var key in modes) { + modes[key].module = modeModules[modes[key].mode] +} + +module.exports = modes + + +/***/ }), + +/***/ "./node_modules/browserify-aes/modes/ofb.js": +/*!**************************************************!*\ + !*** ./node_modules/browserify-aes/modes/ofb.js ***! + \**************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; +var xor = __webpack_require__(/*! buffer-xor */ "./node_modules/buffer-xor/index.js") + +function getBlock (self) { + self._prev = self._cipher.encryptBlock(self._prev) + return self._prev +} + +exports.encrypt = function (self, chunk) { + while (self._cache.length < chunk.length) { + self._cache = Buffer.concat([self._cache, getBlock(self)]) + } + + var pad = self._cache.slice(0, chunk.length) + self._cache = self._cache.slice(chunk.length) + return xor(chunk, pad) +} + + +/***/ }), + +/***/ "./node_modules/browserify-aes/streamCipher.js": +/*!*****************************************************!*\ + !*** ./node_modules/browserify-aes/streamCipher.js ***! + \*****************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var aes = __webpack_require__(/*! ./aes */ "./node_modules/browserify-aes/aes.js") +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var Transform = __webpack_require__(/*! cipher-base */ "./node_modules/cipher-base/index.js") +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js") + +function StreamCipher (mode, key, iv, decrypt) { + Transform.call(this) + + this._cipher = new aes.AES(key) + this._prev = Buffer.from(iv) + this._cache = Buffer.allocUnsafe(0) + this._secCache = Buffer.allocUnsafe(0) + this._decrypt = decrypt + this._mode = mode +} + +inherits(StreamCipher, Transform) + +StreamCipher.prototype._update = function (chunk) { + return this._mode.encrypt(this, chunk, this._decrypt) +} + +StreamCipher.prototype._final = function () { + this._cipher.scrub() +} + +module.exports = StreamCipher + + +/***/ }), + +/***/ "./node_modules/browserify-cipher/browser.js": +/*!***************************************************!*\ + !*** ./node_modules/browserify-cipher/browser.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +var DES = __webpack_require__(/*! browserify-des */ "./node_modules/browserify-des/index.js") +var aes = __webpack_require__(/*! browserify-aes/browser */ "./node_modules/browserify-aes/browser.js") +var aesModes = __webpack_require__(/*! browserify-aes/modes */ "./node_modules/browserify-aes/modes/index.js") +var desModes = __webpack_require__(/*! browserify-des/modes */ "./node_modules/browserify-des/modes.js") +var ebtk = __webpack_require__(/*! evp_bytestokey */ "./node_modules/evp_bytestokey/index.js") + +function createCipher (suite, password) { + suite = suite.toLowerCase() + + var keyLen, ivLen + if (aesModes[suite]) { + keyLen = aesModes[suite].key + ivLen = aesModes[suite].iv + } else if (desModes[suite]) { + keyLen = desModes[suite].key * 8 + ivLen = desModes[suite].iv + } else { + throw new TypeError('invalid suite type') + } + + var keys = ebtk(password, false, keyLen, ivLen) + return createCipheriv(suite, keys.key, keys.iv) +} + +function createDecipher (suite, password) { + suite = suite.toLowerCase() + + var keyLen, ivLen + if (aesModes[suite]) { + keyLen = aesModes[suite].key + ivLen = aesModes[suite].iv + } else if (desModes[suite]) { + keyLen = desModes[suite].key * 8 + ivLen = desModes[suite].iv + } else { + throw new TypeError('invalid suite type') + } + + var keys = ebtk(password, false, keyLen, ivLen) + return createDecipheriv(suite, keys.key, keys.iv) +} + +function createCipheriv (suite, key, iv) { + suite = suite.toLowerCase() + if (aesModes[suite]) return aes.createCipheriv(suite, key, iv) + if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite }) + + throw new TypeError('invalid suite type') +} + +function createDecipheriv (suite, key, iv) { + suite = suite.toLowerCase() + if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv) + if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true }) + + throw new TypeError('invalid suite type') +} + +function getCiphers () { + return Object.keys(desModes).concat(aes.getCiphers()) +} + +exports.createCipher = exports.Cipher = createCipher +exports.createCipheriv = exports.Cipheriv = createCipheriv +exports.createDecipher = exports.Decipher = createDecipher +exports.createDecipheriv = exports.Decipheriv = createDecipheriv +exports.listCiphers = exports.getCiphers = getCiphers + + +/***/ }), + +/***/ "./node_modules/browserify-des/index.js": +/*!**********************************************!*\ + !*** ./node_modules/browserify-des/index.js ***! + \**********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var CipherBase = __webpack_require__(/*! cipher-base */ "./node_modules/cipher-base/index.js") +var des = __webpack_require__(/*! des.js */ "./node_modules/des.js/lib/des.js") +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js") +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) + +var modes = { + 'des-ede3-cbc': des.CBC.instantiate(des.EDE), + 'des-ede3': des.EDE, + 'des-ede-cbc': des.CBC.instantiate(des.EDE), + 'des-ede': des.EDE, + 'des-cbc': des.CBC.instantiate(des.DES), + 'des-ecb': des.DES +} +modes.des = modes['des-cbc'] +modes.des3 = modes['des-ede3-cbc'] +module.exports = DES +inherits(DES, CipherBase) +function DES (opts) { + CipherBase.call(this) + var modeName = opts.mode.toLowerCase() + var mode = modes[modeName] + var type + if (opts.decrypt) { + type = 'decrypt' + } else { + type = 'encrypt' + } + var key = opts.key + if (!Buffer.isBuffer(key)) { + key = Buffer.from(key) + } + if (modeName === 'des-ede' || modeName === 'des-ede-cbc') { + key = Buffer.concat([key, key.slice(0, 8)]) + } + var iv = opts.iv + if (!Buffer.isBuffer(iv)) { + iv = Buffer.from(iv) + } + this._des = mode.create({ + key: key, + iv: iv, + type: type + }) +} +DES.prototype._update = function (data) { + return Buffer.from(this._des.update(data)) +} +DES.prototype._final = function () { + return Buffer.from(this._des.final()) +} + + +/***/ }), + +/***/ "./node_modules/browserify-des/modes.js": +/*!**********************************************!*\ + !*** ./node_modules/browserify-des/modes.js ***! + \**********************************************/ +/***/ (function(__unused_webpack_module, exports) { + +exports["des-ecb"] = { + key: 8, + iv: 0 +} +exports["des-cbc"] = exports.des = { + key: 8, + iv: 8 +} +exports["des-ede3-cbc"] = exports.des3 = { + key: 24, + iv: 8 +} +exports["des-ede3"] = { + key: 24, + iv: 0 +} +exports["des-ede-cbc"] = { + key: 16, + iv: 8 +} +exports["des-ede"] = { + key: 16, + iv: 0 +} + + +/***/ }), + +/***/ "./node_modules/browserify-rsa/index.js": +/*!**********************************************!*\ + !*** ./node_modules/browserify-rsa/index.js ***! + \**********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; +var BN = __webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js") +var randomBytes = __webpack_require__(/*! randombytes */ "./node_modules/randombytes/browser.js") + +function blind (priv) { + var r = getr(priv) + var blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed() + return { blinder: blinder, unblinder: r.invm(priv.modulus) } +} + +function getr (priv) { + var len = priv.modulus.byteLength() + var r + do { + r = new BN(randomBytes(len)) + } while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)) + return r +} + +function crt (msg, priv) { + var blinds = blind(priv) + var len = priv.modulus.byteLength() + var blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus) + var c1 = blinded.toRed(BN.mont(priv.prime1)) + var c2 = blinded.toRed(BN.mont(priv.prime2)) + var qinv = priv.coefficient + var p = priv.prime1 + var q = priv.prime2 + var m1 = c1.redPow(priv.exponent1).fromRed() + var m2 = c2.redPow(priv.exponent2).fromRed() + var h = m1.isub(m2).imul(qinv).umod(p).imul(q) + return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, 'be', len) +} +crt.getr = getr + +module.exports = crt + + +/***/ }), + +/***/ "./node_modules/browserify-sign/algos.js": +/*!***********************************************!*\ + !*** ./node_modules/browserify-sign/algos.js ***! + \***********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! ./browser/algorithms.json */ "./node_modules/browserify-sign/browser/algorithms.json") + + +/***/ }), + +/***/ "./node_modules/browserify-sign/browser/index.js": +/*!*******************************************************!*\ + !*** ./node_modules/browserify-sign/browser/index.js ***! + \*******************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var createHash = __webpack_require__(/*! create-hash */ "./node_modules/create-hash/browser.js") +var stream = __webpack_require__(/*! readable-stream */ "./node_modules/browserify-sign/node_modules/readable-stream/readable-browser.js") +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js") +var sign = __webpack_require__(/*! ./sign */ "./node_modules/browserify-sign/browser/sign.js") +var verify = __webpack_require__(/*! ./verify */ "./node_modules/browserify-sign/browser/verify.js") + +var algorithms = __webpack_require__(/*! ./algorithms.json */ "./node_modules/browserify-sign/browser/algorithms.json") +Object.keys(algorithms).forEach(function (key) { + algorithms[key].id = Buffer.from(algorithms[key].id, 'hex') + algorithms[key.toLowerCase()] = algorithms[key] +}) + +function Sign (algorithm) { + stream.Writable.call(this) + + var data = algorithms[algorithm] + if (!data) throw new Error('Unknown message digest') + + this._hashType = data.hash + this._hash = createHash(data.hash) + this._tag = data.id + this._signType = data.sign +} +inherits(Sign, stream.Writable) + +Sign.prototype._write = function _write (data, _, done) { + this._hash.update(data) + done() +} + +Sign.prototype.update = function update (data, enc) { + if (typeof data === 'string') data = Buffer.from(data, enc) + + this._hash.update(data) + return this +} + +Sign.prototype.sign = function signMethod (key, enc) { + this.end() + var hash = this._hash.digest() + var sig = sign(hash, key, this._hashType, this._signType, this._tag) + + return enc ? sig.toString(enc) : sig +} + +function Verify (algorithm) { + stream.Writable.call(this) + + var data = algorithms[algorithm] + if (!data) throw new Error('Unknown message digest') + + this._hash = createHash(data.hash) + this._tag = data.id + this._signType = data.sign +} +inherits(Verify, stream.Writable) + +Verify.prototype._write = function _write (data, _, done) { + this._hash.update(data) + done() +} + +Verify.prototype.update = function update (data, enc) { + if (typeof data === 'string') data = Buffer.from(data, enc) + + this._hash.update(data) + return this +} + +Verify.prototype.verify = function verifyMethod (key, sig, enc) { + if (typeof sig === 'string') sig = Buffer.from(sig, enc) + + this.end() + var hash = this._hash.digest() + return verify(sig, hash, key, this._signType, this._tag) +} + +function createSign (algorithm) { + return new Sign(algorithm) +} + +function createVerify (algorithm) { + return new Verify(algorithm) +} + +module.exports = { + Sign: createSign, + Verify: createVerify, + createSign: createSign, + createVerify: createVerify +} + + +/***/ }), + +/***/ "./node_modules/browserify-sign/browser/sign.js": +/*!******************************************************!*\ + !*** ./node_modules/browserify-sign/browser/sign.js ***! + \******************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var createHmac = __webpack_require__(/*! create-hmac */ "./node_modules/create-hmac/browser.js") +var crt = __webpack_require__(/*! browserify-rsa */ "./node_modules/browserify-rsa/index.js") +var EC = (__webpack_require__(/*! elliptic */ "./node_modules/elliptic/lib/elliptic.js").ec) +var BN = __webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js") +var parseKeys = __webpack_require__(/*! parse-asn1 */ "./node_modules/parse-asn1/index.js") +var curves = __webpack_require__(/*! ./curves.json */ "./node_modules/browserify-sign/browser/curves.json") + +function sign (hash, key, hashType, signType, tag) { + var priv = parseKeys(key) + if (priv.curve) { + // rsa keys can be interpreted as ecdsa ones in openssl + if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type') + return ecSign(hash, priv) + } else if (priv.type === 'dsa') { + if (signType !== 'dsa') throw new Error('wrong private key type') + return dsaSign(hash, priv, hashType) + } else { + if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type') + } + hash = Buffer.concat([tag, hash]) + var len = priv.modulus.byteLength() + var pad = [0, 1] + while (hash.length + pad.length + 1 < len) pad.push(0xff) + pad.push(0x00) + var i = -1 + while (++i < hash.length) pad.push(hash[i]) + + var out = crt(pad, priv) + return out +} + +function ecSign (hash, priv) { + var curveId = curves[priv.curve.join('.')] + if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.')) + + var curve = new EC(curveId) + var key = curve.keyFromPrivate(priv.privateKey) + var out = key.sign(hash) + + return Buffer.from(out.toDER()) +} + +function dsaSign (hash, priv, algo) { + var x = priv.params.priv_key + var p = priv.params.p + var q = priv.params.q + var g = priv.params.g + var r = new BN(0) + var k + var H = bits2int(hash, q).mod(q) + var s = false + var kv = getKey(x, q, hash, algo) + while (s === false) { + k = makeKey(q, kv, algo) + r = makeR(g, k, p, q) + s = k.invm(q).imul(H.add(x.mul(r))).mod(q) + if (s.cmpn(0) === 0) { + s = false + r = new BN(0) + } + } + return toDER(r, s) +} + +function toDER (r, s) { + r = r.toArray() + s = s.toArray() + + // Pad values + if (r[0] & 0x80) r = [0].concat(r) + if (s[0] & 0x80) s = [0].concat(s) + + var total = r.length + s.length + 4 + var res = [0x30, total, 0x02, r.length] + res = res.concat(r, [0x02, s.length], s) + return Buffer.from(res) +} + +function getKey (x, q, hash, algo) { + x = Buffer.from(x.toArray()) + if (x.length < q.byteLength()) { + var zeros = Buffer.alloc(q.byteLength() - x.length) + x = Buffer.concat([zeros, x]) + } + var hlen = hash.length + var hbits = bits2octets(hash, q) + var v = Buffer.alloc(hlen) + v.fill(1) + var k = Buffer.alloc(hlen) + k = createHmac(algo, k).update(v).update(Buffer.from([0])).update(x).update(hbits).digest() + v = createHmac(algo, k).update(v).digest() + k = createHmac(algo, k).update(v).update(Buffer.from([1])).update(x).update(hbits).digest() + v = createHmac(algo, k).update(v).digest() + return { k: k, v: v } +} + +function bits2int (obits, q) { + var bits = new BN(obits) + var shift = (obits.length << 3) - q.bitLength() + if (shift > 0) bits.ishrn(shift) + return bits +} + +function bits2octets (bits, q) { + bits = bits2int(bits, q) + bits = bits.mod(q) + var out = Buffer.from(bits.toArray()) + if (out.length < q.byteLength()) { + var zeros = Buffer.alloc(q.byteLength() - out.length) + out = Buffer.concat([zeros, out]) + } + return out +} + +function makeKey (q, kv, algo) { + var t + var k + + do { + t = Buffer.alloc(0) + + while (t.length * 8 < q.bitLength()) { + kv.v = createHmac(algo, kv.k).update(kv.v).digest() + t = Buffer.concat([t, kv.v]) + } + + k = bits2int(t, q) + kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer.from([0])).digest() + kv.v = createHmac(algo, kv.k).update(kv.v).digest() + } while (k.cmp(q) !== -1) + + return k +} + +function makeR (g, k, p, q) { + return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q) +} + +module.exports = sign +module.exports.getKey = getKey +module.exports.makeKey = makeKey + + +/***/ }), + +/***/ "./node_modules/browserify-sign/browser/verify.js": +/*!********************************************************!*\ + !*** ./node_modules/browserify-sign/browser/verify.js ***! + \********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var BN = __webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js") +var EC = (__webpack_require__(/*! elliptic */ "./node_modules/elliptic/lib/elliptic.js").ec) +var parseKeys = __webpack_require__(/*! parse-asn1 */ "./node_modules/parse-asn1/index.js") +var curves = __webpack_require__(/*! ./curves.json */ "./node_modules/browserify-sign/browser/curves.json") + +function verify (sig, hash, key, signType, tag) { + var pub = parseKeys(key) + if (pub.type === 'ec') { + // rsa keys can be interpreted as ecdsa ones in openssl + if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type') + return ecVerify(sig, hash, pub) + } else if (pub.type === 'dsa') { + if (signType !== 'dsa') throw new Error('wrong public key type') + return dsaVerify(sig, hash, pub) + } else { + if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type') + } + hash = Buffer.concat([tag, hash]) + var len = pub.modulus.byteLength() + var pad = [1] + var padNum = 0 + while (hash.length + pad.length + 2 < len) { + pad.push(0xff) + padNum++ + } + pad.push(0x00) + var i = -1 + while (++i < hash.length) { + pad.push(hash[i]) + } + pad = Buffer.from(pad) + var red = BN.mont(pub.modulus) + sig = new BN(sig).toRed(red) + + sig = sig.redPow(new BN(pub.publicExponent)) + sig = Buffer.from(sig.fromRed().toArray()) + var out = padNum < 8 ? 1 : 0 + len = Math.min(sig.length, pad.length) + if (sig.length !== pad.length) out = 1 + + i = -1 + while (++i < len) out |= sig[i] ^ pad[i] + return out === 0 +} + +function ecVerify (sig, hash, pub) { + var curveId = curves[pub.data.algorithm.curve.join('.')] + if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.')) + + var curve = new EC(curveId) + var pubkey = pub.data.subjectPrivateKey.data + + return curve.verify(hash, sig, pubkey) +} + +function dsaVerify (sig, hash, pub) { + var p = pub.data.p + var q = pub.data.q + var g = pub.data.g + var y = pub.data.pub_key + var unpacked = parseKeys.signature.decode(sig, 'der') + var s = unpacked.s + var r = unpacked.r + checkValue(s, q) + checkValue(r, q) + var montp = BN.mont(p) + var w = s.invm(q) + var v = g.toRed(montp) + .redPow(new BN(hash).mul(w).mod(q)) + .fromRed() + .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed()) + .mod(p) + .mod(q) + return v.cmp(r) === 0 +} + +function checkValue (b, q) { + if (b.cmpn(0) <= 0) throw new Error('invalid sig') + if (b.cmp(q) >= q) throw new Error('invalid sig') +} + +module.exports = verify + + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/errors-browser.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/errors-browser.js ***! + \*************************************************************************************/ +/***/ (function(module) { + +"use strict"; + + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } + + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inheritsLoose(NodeError, _Base); + + function NodeError(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + + return NodeError; + }(Base); + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js + + +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith + + +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + var determiner; + + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + var msg; + + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } + + msg += ". Received type ".concat(typeof actual); + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented'; +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg; +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); +module.exports.codes = codes; + + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_duplex.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_duplex.js ***! + \*****************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + + + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +}; +/**/ + +module.exports = Duplex; +var Readable = __webpack_require__(/*! ./_stream_readable */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_readable.js"); +var Writable = __webpack_require__(/*! ./_stream_writable */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_writable.js"); +__webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js")(Duplex, Readable); +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + +// the no-half-open enforcer +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + ({"env":{"NODE_ENV":"production"}}).nextTick(onEndNT, this); +} +function onEndNT(self) { + self.end(); +} +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_passthrough.js": +/*!**********************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_passthrough.js ***! + \**********************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + + + +module.exports = PassThrough; +var Transform = __webpack_require__(/*! ./_stream_transform */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_transform.js"); +__webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js")(PassThrough, Transform); +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); +} +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_readable.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_readable.js ***! + \*******************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +module.exports = Readable; + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = (__webpack_require__(/*! events */ "./node_modules/events/events.js").EventEmitter); +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = __webpack_require__(/*! ./internal/streams/stream */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/stream-browser.js"); +/**/ + +var Buffer = (__webpack_require__(/*! buffer */ "./node_modules/buffer/index.js").Buffer); +var OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ +var debugUtil = __webpack_require__(/*! util */ "?593c"); +var debug; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/**/ + +var BufferList = __webpack_require__(/*! ./internal/streams/buffer_list */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/buffer_list.js"); +var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/destroy.js"); +var _require = __webpack_require__(/*! ./internal/streams/state */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/state.js"), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = (__webpack_require__(/*! ../errors */ "./node_modules/browserify-sign/node_modules/readable-stream/errors-browser.js").codes), + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + +// Lazy loaded to improve the startup performance. +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; +__webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js")(Readable, Stream); +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_duplex.js"); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'end' (and potentially 'finish') + this.autoDestroy = !!options.autoDestroy; + + // has it been destroyed + this.destroyed = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = (__webpack_require__(/*! string_decoder/ */ "./node_modules/string_decoder/lib/string_decoder.js").StringDecoder); + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} +function Readable(options) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_duplex.js"); + if (!(this instanceof Readable)) return new Readable(options); + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); + + // legacy + this.readable = true; + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + Stream.call(this); +} +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); + } + } + + // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } + return er; +} +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = (__webpack_require__(/*! string_decoder/ */ "./node_modules/string_decoder/lib/string_decoder.js").StringDecoder); + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; + // If setEncoding(null), decoder.encoding equals utf8 + this._readableState.encoding = this._readableState.decoder.encoding; + + // Iterate over current buffer to convert already stored Buffers: + var p = this._readableState.buffer.head; + var content = ''; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + this._readableState.buffer.clear(); + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; + +// Don't raise the hwm > 1GB +var MAX_HWM = 0x40000000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; + } + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + if (ret !== null) this.emit('data', ret); + return ret; +}; +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); + } + } +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(emitReadable_, stream); + } +} +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } + + // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(maybeReadMore_, stream, state); + } +} +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== ({"env":{"NODE_ENV":"production"}}).stdout && dest !== ({"env":{"NODE_ENV":"production"}}).stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) ({"env":{"NODE_ENV":"production"}}).nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + if (ret === false) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + return dest; +}; +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; + + // Try start flowing on next tick if stream isn't explicitly paused + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + ({"env":{"NODE_ENV":"production"}}).nextTick(nReadingNextTick, this); + } + } + } + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + ({"env":{"NODE_ENV":"production"}}).nextTick(updateReadableListening, this); + } + return res; +}; +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + ({"env":{"NODE_ENV":"production"}}).nextTick(updateReadableListening, this); + } + return res; +}; +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; + + // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + // we flow only if there is no one listening + // for readable, but we still have to call + // resume() + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; + return this; +}; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(resume_, stream, state); + } +} +function resume_(stream, state) { + debug('resume', state.reading); + if (!state.reading) { + stream.read(0); + } + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + this._readableState.paused = true; + return this; +}; +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null); +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + _this.push(null); + }); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + return this; +}; +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = __webpack_require__(/*! ./internal/streams/async_iterator */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/async_iterator.js"); + } + return createReadableStreamAsyncIterator(this); + }; +} +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); + +// exposed for testing purposes only. +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; +} +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); + if (!state.endEmitted) { + state.ended = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(endReadableNT, state, stream); + } +} +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); + + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } + } +} +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = __webpack_require__(/*! ./internal/streams/from */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/from-browser.js"); + } + return from(Readable, iterable, opts); + }; +} +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_transform.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_transform.js ***! + \********************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +module.exports = Transform; +var _require$codes = (__webpack_require__(/*! ../errors */ "./node_modules/browserify-sign/node_modules/readable-stream/errors-browser.js").codes), + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; +var Duplex = __webpack_require__(/*! ./_stream_duplex */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_duplex.js"); +__webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js")(Transform, Duplex); +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); + } + ts.writechunk = null; + ts.writecb = null; + if (data != null) + // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} +function prefinish() { + var _this = this; + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); +}; +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) + // single equals check for both `null` and `undefined` + stream.push(data); + + // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); +} + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_writable.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_writable.js ***! + \*******************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + + + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var internalUtil = { + deprecate: __webpack_require__(/*! util-deprecate */ "./node_modules/util-deprecate/browser.js") +}; +/**/ + +/**/ +var Stream = __webpack_require__(/*! ./internal/streams/stream */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/stream-browser.js"); +/**/ + +var Buffer = (__webpack_require__(/*! buffer */ "./node_modules/buffer/index.js").Buffer); +var OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/destroy.js"); +var _require = __webpack_require__(/*! ./internal/streams/state */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/state.js"), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = (__webpack_require__(/*! ../errors */ "./node_modules/browserify-sign/node_modules/readable-stream/errors-browser.js").codes), + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; +var errorOrDestroy = destroyImpl.errorOrDestroy; +__webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js")(Writable, Stream); +function nop() {} +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_duplex.js"); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'finish' (and potentially 'end') + this.autoDestroy = !!options.autoDestroy; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; + }; +} +function Writable(options) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_duplex.js"); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + + // legacy. + this.writable = true; + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; + } + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + // TODO: defer error events consistently everywhere, not just the cb + errorOrDestroy(stream, er); + ({"env":{"NODE_ENV":"production"}}).nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } + if (er) { + errorOrDestroy(stream, er); + ({"env":{"NODE_ENV":"production"}}).nextTick(cb, er); + return false; + } + return true; +} +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; +Writable.prototype.cork = function () { + this._writableState.corked++; +}; +Writable.prototype.uncork = function () { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + return ret; +} +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + ({"env":{"NODE_ENV":"production"}}).nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + ({"env":{"NODE_ENV":"production"}}).nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + ({"env":{"NODE_ENV":"production"}}).nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + if (entry === null) state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; +} +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; +Writable.prototype._writev = null; +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); + return this; +}; +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + return need; +} +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) ({"env":{"NODE_ENV":"production"}}).nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/async_iterator.js": +/*!**********************************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/async_iterator.js ***! + \**********************************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var _Object$setPrototypeO; +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var finished = __webpack_require__(/*! ./end-of-stream */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/end-of-stream.js"); +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + if (resolve !== null) { + var data = iter[kStream].read(); + // we defer if data is null + // we can be expecting either 'end' or + // 'error' + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } + } +} +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + ({"env":{"NODE_ENV":"production"}}).nextTick(readAndResolve, iter); +} +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); + } + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + ({"env":{"NODE_ENV":"production"}}).nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } + + // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + var lastPromise = this[kLastPromise]; + var promise; + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + promise = new Promise(this[kHandlePromise]); + } + this[kLastPromise] = promise; + return promise; + } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; + // reject if we are waiting for data in the Promise + // returned by next() and store the error + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } + iterator[kError] = err; + return; + } + var resolve = iterator[kLastResolve]; + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; +module.exports = createReadableStreamAsyncIterator; + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/buffer_list.js": +/*!*******************************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/buffer_list.js ***! + \*******************************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _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 _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var _require = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js"), + Buffer = _require.Buffer; +var _require2 = __webpack_require__(/*! util */ "?cad2"), + inspect = _require2.inspect; +var custom = inspect && inspect.custom || 'inspect'; +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); +} +module.exports = /*#__PURE__*/function () { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; + } + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) ret += s + p.data; + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + } + + // Consumes a specified amount of bytes or characters from the buffered data. + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; + } + + // Consumes a specified amount of characters from the buffered data. + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Consumes a specified amount of bytes from the buffered data. + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Make sure the linked list only shows the minimal necessary information. + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread(_objectSpread({}, options), {}, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); + return BufferList; +}(); + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/destroy.js": +/*!***************************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/destroy.js ***! + \***************************************************************************************************/ +/***/ (function(module) { + +"use strict"; + + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + ({"env":{"NODE_ENV":"production"}}).nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(emitErrorNT, this, err); + } + } + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + ({"env":{"NODE_ENV":"production"}}).nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(emitErrorAndCloseNT, _this, err); + } else { + ({"env":{"NODE_ENV":"production"}}).nextTick(emitCloseNT, _this); + } + } else if (cb) { + ({"env":{"NODE_ENV":"production"}}).nextTick(emitCloseNT, _this); + cb(err); + } else { + ({"env":{"NODE_ENV":"production"}}).nextTick(emitCloseNT, _this); + } + }); + return this; +} +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} +function emitErrorNT(self, err) { + self.emit('error', err); +} +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/end-of-stream.js": +/*!*********************************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/end-of-stream.js ***! + \*********************************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). + + + +var ERR_STREAM_PREMATURE_CLOSE = (__webpack_require__(/*! ../../../errors */ "./node_modules/browserify-sign/node_modules/readable-stream/errors-browser.js").codes.ERR_STREAM_PREMATURE_CLOSE); +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + callback.apply(this, args); + }; +} +function noop() {} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + var onerror = function onerror(err) { + callback.call(stream, err); + }; + var onclose = function onclose() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} +module.exports = eos; + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/from-browser.js": +/*!********************************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/from-browser.js ***! + \********************************************************************************************************/ +/***/ (function(module) { + +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; + + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/pipeline.js": +/*!****************************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/pipeline.js ***! + \****************************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). + + + +var eos; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} +var _require$codes = (__webpack_require__(/*! ../../../errors */ "./node_modules/browserify-sign/node_modules/readable-stream/errors-browser.js").codes), + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = __webpack_require__(/*! ./end-of-stream */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/end-of-stream.js"); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; + + // request.destroy just do .end - .abort is what we want + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} +function call(fn) { + fn(); +} +function pipe(from, to) { + return from.pipe(to); +} +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} +module.exports = pipeline; + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/state.js": +/*!*************************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/state.js ***! + \*************************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var ERR_INVALID_OPT_VALUE = (__webpack_require__(/*! ../../../errors */ "./node_modules/browserify-sign/node_modules/readable-stream/errors-browser.js").codes.ERR_INVALID_OPT_VALUE); +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } + return Math.floor(hwm); + } + + // Default value + return state.objectMode ? 16 : 16 * 1024; +} +module.exports = { + getHighWaterMark: getHighWaterMark +}; + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/stream-browser.js": +/*!**********************************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/stream-browser.js ***! + \**********************************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! events */ "./node_modules/events/events.js").EventEmitter; + + +/***/ }), + +/***/ "./node_modules/browserify-sign/node_modules/readable-stream/readable-browser.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/browserify-sign/node_modules/readable-stream/readable-browser.js ***! + \***************************************************************************************/ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_readable.js"); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_writable.js"); +exports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_duplex.js"); +exports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_transform.js"); +exports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_passthrough.js"); +exports.finished = __webpack_require__(/*! ./lib/internal/streams/end-of-stream.js */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/end-of-stream.js"); +exports.pipeline = __webpack_require__(/*! ./lib/internal/streams/pipeline.js */ "./node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/pipeline.js"); + + +/***/ }), + +/***/ "./node_modules/browserify-zlib/lib/binding.js": +/*!*****************************************************!*\ + !*** ./node_modules/browserify-zlib/lib/binding.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; + +/* eslint camelcase: "off" */ + +var assert = __webpack_require__(/*! assert */ "./node_modules/assert/build/assert.js"); + +var Zstream = __webpack_require__(/*! pako/lib/zlib/zstream */ "./node_modules/pako/lib/zlib/zstream.js"); +var zlib_deflate = __webpack_require__(/*! pako/lib/zlib/deflate.js */ "./node_modules/pako/lib/zlib/deflate.js"); +var zlib_inflate = __webpack_require__(/*! pako/lib/zlib/inflate.js */ "./node_modules/pako/lib/zlib/inflate.js"); +var constants = __webpack_require__(/*! pako/lib/zlib/constants */ "./node_modules/pako/lib/zlib/constants.js"); + +for (var key in constants) { + exports[key] = constants[key]; +} + +// zlib modes +exports.NONE = 0; +exports.DEFLATE = 1; +exports.INFLATE = 2; +exports.GZIP = 3; +exports.GUNZIP = 4; +exports.DEFLATERAW = 5; +exports.INFLATERAW = 6; +exports.UNZIP = 7; + +var GZIP_HEADER_ID1 = 0x1f; +var GZIP_HEADER_ID2 = 0x8b; + +/** + * Emulate Node's zlib C++ layer for use by the JS layer in index.js + */ +function Zlib(mode) { + if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) { + throw new TypeError('Bad argument'); + } + + this.dictionary = null; + this.err = 0; + this.flush = 0; + this.init_done = false; + this.level = 0; + this.memLevel = 0; + this.mode = mode; + this.strategy = 0; + this.windowBits = 0; + this.write_in_progress = false; + this.pending_close = false; + this.gzip_id_bytes_read = 0; +} + +Zlib.prototype.close = function () { + if (this.write_in_progress) { + this.pending_close = true; + return; + } + + this.pending_close = false; + + assert(this.init_done, 'close before init'); + assert(this.mode <= exports.UNZIP); + + if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { + zlib_deflate.deflateEnd(this.strm); + } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) { + zlib_inflate.inflateEnd(this.strm); + } + + this.mode = exports.NONE; + + this.dictionary = null; +}; + +Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) { + return this._write(true, flush, input, in_off, in_len, out, out_off, out_len); +}; + +Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) { + return this._write(false, flush, input, in_off, in_len, out, out_off, out_len); +}; + +Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) { + assert.equal(arguments.length, 8); + + assert(this.init_done, 'write before init'); + assert(this.mode !== exports.NONE, 'already finalized'); + assert.equal(false, this.write_in_progress, 'write already in progress'); + assert.equal(false, this.pending_close, 'close is pending'); + + this.write_in_progress = true; + + assert.equal(false, flush === undefined, 'must provide flush value'); + + this.write_in_progress = true; + + if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) { + throw new Error('Invalid flush value'); + } + + if (input == null) { + input = Buffer.alloc(0); + in_len = 0; + in_off = 0; + } + + this.strm.avail_in = in_len; + this.strm.input = input; + this.strm.next_in = in_off; + this.strm.avail_out = out_len; + this.strm.output = out; + this.strm.next_out = out_off; + this.flush = flush; + + if (!async) { + // sync version + this._process(); + + if (this._checkError()) { + return this._afterSync(); + } + return; + } + + // async version + var self = this; + ({"env":{"NODE_ENV":"production"}}).nextTick(function () { + self._process(); + self._after(); + }); + + return this; +}; + +Zlib.prototype._afterSync = function () { + var avail_out = this.strm.avail_out; + var avail_in = this.strm.avail_in; + + this.write_in_progress = false; + + return [avail_in, avail_out]; +}; + +Zlib.prototype._process = function () { + var next_expected_header_byte = null; + + // If the avail_out is left at 0, then it means that it ran out + // of room. If there was avail_out left over, then it means + // that all of the input was consumed. + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflate(this.strm, this.flush); + break; + case exports.UNZIP: + if (this.strm.avail_in > 0) { + next_expected_header_byte = this.strm.next_in; + } + + switch (this.gzip_id_bytes_read) { + case 0: + if (next_expected_header_byte === null) { + break; + } + + if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) { + this.gzip_id_bytes_read = 1; + next_expected_header_byte++; + + if (this.strm.avail_in === 1) { + // The only available byte was already read. + break; + } + } else { + this.mode = exports.INFLATE; + break; + } + + // fallthrough + case 1: + if (next_expected_header_byte === null) { + break; + } + + if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) { + this.gzip_id_bytes_read = 2; + this.mode = exports.GUNZIP; + } else { + // There is no actual difference between INFLATE and INFLATERAW + // (after initialization). + this.mode = exports.INFLATE; + } + + break; + default: + throw new Error('invalid number of gzip magic number bytes read'); + } + + // fallthrough + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + this.err = zlib_inflate.inflate(this.strm, this.flush + + // If data was encoded with dictionary + );if (this.err === exports.Z_NEED_DICT && this.dictionary) { + // Load it + this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary); + if (this.err === exports.Z_OK) { + // And try to decode again + this.err = zlib_inflate.inflate(this.strm, this.flush); + } else if (this.err === exports.Z_DATA_ERROR) { + // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR. + // Make it possible for After() to tell a bad dictionary from bad + // input. + this.err = exports.Z_NEED_DICT; + } + } + while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) { + // Bytes remain in input buffer. Perhaps this is another compressed + // member in the same archive, or just trailing garbage. + // Trailing zero bytes are okay, though, since they are frequently + // used for padding. + + this.reset(); + this.err = zlib_inflate.inflate(this.strm, this.flush); + } + break; + default: + throw new Error('Unknown mode ' + this.mode); + } +}; + +Zlib.prototype._checkError = function () { + // Acceptable error states depend on the type of zlib stream. + switch (this.err) { + case exports.Z_OK: + case exports.Z_BUF_ERROR: + if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) { + this._error('unexpected end of file'); + return false; + } + break; + case exports.Z_STREAM_END: + // normal statuses, not fatal + break; + case exports.Z_NEED_DICT: + if (this.dictionary == null) { + this._error('Missing dictionary'); + } else { + this._error('Bad dictionary'); + } + return false; + default: + // something else. + this._error('Zlib error'); + return false; + } + + return true; +}; + +Zlib.prototype._after = function () { + if (!this._checkError()) { + return; + } + + var avail_out = this.strm.avail_out; + var avail_in = this.strm.avail_in; + + this.write_in_progress = false; + + // call the write() cb + this.callback(avail_in, avail_out); + + if (this.pending_close) { + this.close(); + } +}; + +Zlib.prototype._error = function (message) { + if (this.strm.msg) { + message = this.strm.msg; + } + this.onerror(message, this.err + + // no hope of rescue. + );this.write_in_progress = false; + if (this.pending_close) { + this.close(); + } +}; + +Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) { + assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])'); + + assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits'); + assert(level >= -1 && level <= 9, 'invalid compression level'); + + assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel'); + + assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy'); + + this._init(level, windowBits, memLevel, strategy, dictionary); + this._setDictionary(); +}; + +Zlib.prototype.params = function () { + throw new Error('deflateParams Not supported'); +}; + +Zlib.prototype.reset = function () { + this._reset(); + this._setDictionary(); +}; + +Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) { + this.level = level; + this.windowBits = windowBits; + this.memLevel = memLevel; + this.strategy = strategy; + + this.flush = exports.Z_NO_FLUSH; + + this.err = exports.Z_OK; + + if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) { + this.windowBits += 16; + } + + if (this.mode === exports.UNZIP) { + this.windowBits += 32; + } + + if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) { + this.windowBits = -1 * this.windowBits; + } + + this.strm = new Zstream(); + + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy); + break; + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + case exports.UNZIP: + this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits); + break; + default: + throw new Error('Unknown mode ' + this.mode); + } + + if (this.err !== exports.Z_OK) { + this._error('Init error'); + } + + this.dictionary = dictionary; + + this.write_in_progress = false; + this.init_done = true; +}; + +Zlib.prototype._setDictionary = function () { + if (this.dictionary == null) { + return; + } + + this.err = exports.Z_OK; + + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary); + break; + default: + break; + } + + if (this.err !== exports.Z_OK) { + this._error('Failed to set dictionary'); + } +}; + +Zlib.prototype._reset = function () { + this.err = exports.Z_OK; + + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + case exports.GZIP: + this.err = zlib_deflate.deflateReset(this.strm); + break; + case exports.INFLATE: + case exports.INFLATERAW: + case exports.GUNZIP: + this.err = zlib_inflate.inflateReset(this.strm); + break; + default: + break; + } + + if (this.err !== exports.Z_OK) { + this._error('Failed to reset stream'); + } +}; + +exports.Zlib = Zlib; + +/***/ }), + +/***/ "./node_modules/browserify-zlib/lib/index.js": +/*!***************************************************!*\ + !*** ./node_modules/browserify-zlib/lib/index.js ***! + \***************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +var Buffer = (__webpack_require__(/*! buffer */ "./node_modules/buffer/index.js").Buffer); +var Transform = (__webpack_require__(/*! stream */ "./node_modules/stream-browserify/index.js").Transform); +var binding = __webpack_require__(/*! ./binding */ "./node_modules/browserify-zlib/lib/binding.js"); +var util = __webpack_require__(/*! util */ "./node_modules/util/util.js"); +var assert = (__webpack_require__(/*! assert */ "./node_modules/assert/build/assert.js").ok); +var kMaxLength = (__webpack_require__(/*! buffer */ "./node_modules/buffer/index.js").kMaxLength); +var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes'; + +// zlib doesn't provide these, so kludge them in following the same +// const naming scheme zlib uses. +binding.Z_MIN_WINDOWBITS = 8; +binding.Z_MAX_WINDOWBITS = 15; +binding.Z_DEFAULT_WINDOWBITS = 15; + +// fewer than 64 bytes per chunk is stupid. +// technically it could work with as few as 8, but even 64 bytes +// is absurdly low. Usually a MB or more is best. +binding.Z_MIN_CHUNK = 64; +binding.Z_MAX_CHUNK = Infinity; +binding.Z_DEFAULT_CHUNK = 16 * 1024; + +binding.Z_MIN_MEMLEVEL = 1; +binding.Z_MAX_MEMLEVEL = 9; +binding.Z_DEFAULT_MEMLEVEL = 8; + +binding.Z_MIN_LEVEL = -1; +binding.Z_MAX_LEVEL = 9; +binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; + +// expose all the zlib constants +var bkeys = Object.keys(binding); +for (var bk = 0; bk < bkeys.length; bk++) { + var bkey = bkeys[bk]; + if (bkey.match(/^Z/)) { + Object.defineProperty(exports, bkey, { + enumerable: true, value: binding[bkey], writable: false + }); + } +} + +// translation table for return codes. +var codes = { + Z_OK: binding.Z_OK, + Z_STREAM_END: binding.Z_STREAM_END, + Z_NEED_DICT: binding.Z_NEED_DICT, + Z_ERRNO: binding.Z_ERRNO, + Z_STREAM_ERROR: binding.Z_STREAM_ERROR, + Z_DATA_ERROR: binding.Z_DATA_ERROR, + Z_MEM_ERROR: binding.Z_MEM_ERROR, + Z_BUF_ERROR: binding.Z_BUF_ERROR, + Z_VERSION_ERROR: binding.Z_VERSION_ERROR +}; + +var ckeys = Object.keys(codes); +for (var ck = 0; ck < ckeys.length; ck++) { + var ckey = ckeys[ck]; + codes[codes[ckey]] = ckey; +} + +Object.defineProperty(exports, "codes", ({ + enumerable: true, value: Object.freeze(codes), writable: false +})); + +exports.Deflate = Deflate; +exports.Inflate = Inflate; +exports.Gzip = Gzip; +exports.Gunzip = Gunzip; +exports.DeflateRaw = DeflateRaw; +exports.InflateRaw = InflateRaw; +exports.Unzip = Unzip; + +exports.createDeflate = function (o) { + return new Deflate(o); +}; + +exports.createInflate = function (o) { + return new Inflate(o); +}; + +exports.createDeflateRaw = function (o) { + return new DeflateRaw(o); +}; + +exports.createInflateRaw = function (o) { + return new InflateRaw(o); +}; + +exports.createGzip = function (o) { + return new Gzip(o); +}; + +exports.createGunzip = function (o) { + return new Gunzip(o); +}; + +exports.createUnzip = function (o) { + return new Unzip(o); +}; + +// Convenience methods. +// compress/decompress a string or buffer in one step. +exports.deflate = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Deflate(opts), buffer, callback); +}; + +exports.deflateSync = function (buffer, opts) { + return zlibBufferSync(new Deflate(opts), buffer); +}; + +exports.gzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Gzip(opts), buffer, callback); +}; + +exports.gzipSync = function (buffer, opts) { + return zlibBufferSync(new Gzip(opts), buffer); +}; + +exports.deflateRaw = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new DeflateRaw(opts), buffer, callback); +}; + +exports.deflateRawSync = function (buffer, opts) { + return zlibBufferSync(new DeflateRaw(opts), buffer); +}; + +exports.unzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Unzip(opts), buffer, callback); +}; + +exports.unzipSync = function (buffer, opts) { + return zlibBufferSync(new Unzip(opts), buffer); +}; + +exports.inflate = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Inflate(opts), buffer, callback); +}; + +exports.inflateSync = function (buffer, opts) { + return zlibBufferSync(new Inflate(opts), buffer); +}; + +exports.gunzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Gunzip(opts), buffer, callback); +}; + +exports.gunzipSync = function (buffer, opts) { + return zlibBufferSync(new Gunzip(opts), buffer); +}; + +exports.inflateRaw = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new InflateRaw(opts), buffer, callback); +}; + +exports.inflateRawSync = function (buffer, opts) { + return zlibBufferSync(new InflateRaw(opts), buffer); +}; + +function zlibBuffer(engine, buffer, callback) { + var buffers = []; + var nread = 0; + + engine.on('error', onError); + engine.on('end', onEnd); + + engine.end(buffer); + flow(); + + function flow() { + var chunk; + while (null !== (chunk = engine.read())) { + buffers.push(chunk); + nread += chunk.length; + } + engine.once('readable', flow); + } + + function onError(err) { + engine.removeListener('end', onEnd); + engine.removeListener('readable', flow); + callback(err); + } + + function onEnd() { + var buf; + var err = null; + + if (nread >= kMaxLength) { + err = new RangeError(kRangeErrorMessage); + } else { + buf = Buffer.concat(buffers, nread); + } + + buffers = []; + engine.close(); + callback(err, buf); + } +} + +function zlibBufferSync(engine, buffer) { + if (typeof buffer === 'string') buffer = Buffer.from(buffer); + + if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer'); + + var flushFlag = engine._finishFlushFlag; + + return engine._processChunk(buffer, flushFlag); +} + +// generic zlib +// minimal 2-byte header +function Deflate(opts) { + if (!(this instanceof Deflate)) return new Deflate(opts); + Zlib.call(this, opts, binding.DEFLATE); +} + +function Inflate(opts) { + if (!(this instanceof Inflate)) return new Inflate(opts); + Zlib.call(this, opts, binding.INFLATE); +} + +// gzip - bigger header, same deflate compression +function Gzip(opts) { + if (!(this instanceof Gzip)) return new Gzip(opts); + Zlib.call(this, opts, binding.GZIP); +} + +function Gunzip(opts) { + if (!(this instanceof Gunzip)) return new Gunzip(opts); + Zlib.call(this, opts, binding.GUNZIP); +} + +// raw - no header +function DeflateRaw(opts) { + if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); + Zlib.call(this, opts, binding.DEFLATERAW); +} + +function InflateRaw(opts) { + if (!(this instanceof InflateRaw)) return new InflateRaw(opts); + Zlib.call(this, opts, binding.INFLATERAW); +} + +// auto-detect header. +function Unzip(opts) { + if (!(this instanceof Unzip)) return new Unzip(opts); + Zlib.call(this, opts, binding.UNZIP); +} + +function isValidFlushFlag(flag) { + return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK; +} + +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. + +function Zlib(opts, mode) { + var _this = this; + + this._opts = opts = opts || {}; + this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; + + Transform.call(this, opts); + + if (opts.flush && !isValidFlushFlag(opts.flush)) { + throw new Error('Invalid flush flag: ' + opts.flush); + } + if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) { + throw new Error('Invalid flush flag: ' + opts.finishFlush); + } + + this._flushFlag = opts.flush || binding.Z_NO_FLUSH; + this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH; + + if (opts.chunkSize) { + if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) { + throw new Error('Invalid chunk size: ' + opts.chunkSize); + } + } + + if (opts.windowBits) { + if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) { + throw new Error('Invalid windowBits: ' + opts.windowBits); + } + } + + if (opts.level) { + if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) { + throw new Error('Invalid compression level: ' + opts.level); + } + } + + if (opts.memLevel) { + if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) { + throw new Error('Invalid memLevel: ' + opts.memLevel); + } + } + + if (opts.strategy) { + if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) { + throw new Error('Invalid strategy: ' + opts.strategy); + } + } + + if (opts.dictionary) { + if (!Buffer.isBuffer(opts.dictionary)) { + throw new Error('Invalid dictionary: it should be a Buffer instance'); + } + } + + this._handle = new binding.Zlib(mode); + + var self = this; + this._hadError = false; + this._handle.onerror = function (message, errno) { + // there is no way to cleanly recover. + // continuing only obscures problems. + _close(self); + self._hadError = true; + + var error = new Error(message); + error.errno = errno; + error.code = exports.codes[errno]; + self.emit('error', error); + }; + + var level = exports.Z_DEFAULT_COMPRESSION; + if (typeof opts.level === 'number') level = opts.level; + + var strategy = exports.Z_DEFAULT_STRATEGY; + if (typeof opts.strategy === 'number') strategy = opts.strategy; + + this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary); + + this._buffer = Buffer.allocUnsafe(this._chunkSize); + this._offset = 0; + this._level = level; + this._strategy = strategy; + + this.once('end', this.close); + + Object.defineProperty(this, '_closed', { + get: function () { + return !_this._handle; + }, + configurable: true, + enumerable: true + }); +} + +util.inherits(Zlib, Transform); + +Zlib.prototype.params = function (level, strategy, callback) { + if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) { + throw new RangeError('Invalid compression level: ' + level); + } + if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) { + throw new TypeError('Invalid strategy: ' + strategy); + } + + if (this._level !== level || this._strategy !== strategy) { + var self = this; + this.flush(binding.Z_SYNC_FLUSH, function () { + assert(self._handle, 'zlib binding closed'); + self._handle.params(level, strategy); + if (!self._hadError) { + self._level = level; + self._strategy = strategy; + if (callback) callback(); + } + }); + } else { + ({"env":{"NODE_ENV":"production"}}).nextTick(callback); + } +}; + +Zlib.prototype.reset = function () { + assert(this._handle, 'zlib binding closed'); + return this._handle.reset(); +}; + +// This is the _flush function called by the transform class, +// internally, when the last chunk has been written. +Zlib.prototype._flush = function (callback) { + this._transform(Buffer.alloc(0), '', callback); +}; + +Zlib.prototype.flush = function (kind, callback) { + var _this2 = this; + + var ws = this._writableState; + + if (typeof kind === 'function' || kind === undefined && !callback) { + callback = kind; + kind = binding.Z_FULL_FLUSH; + } + + if (ws.ended) { + if (callback) ({"env":{"NODE_ENV":"production"}}).nextTick(callback); + } else if (ws.ending) { + if (callback) this.once('end', callback); + } else if (ws.needDrain) { + if (callback) { + this.once('drain', function () { + return _this2.flush(kind, callback); + }); + } + } else { + this._flushFlag = kind; + this.write(Buffer.alloc(0), '', callback); + } +}; + +Zlib.prototype.close = function (callback) { + _close(this, callback); + ({"env":{"NODE_ENV":"production"}}).nextTick(emitCloseNT, this); +}; + +function _close(engine, callback) { + if (callback) ({"env":{"NODE_ENV":"production"}}).nextTick(callback); + + // Caller may invoke .close after a zlib error (which will null _handle). + if (!engine._handle) return; + + engine._handle.close(); + engine._handle = null; +} + +function emitCloseNT(self) { + self.emit('close'); +} + +Zlib.prototype._transform = function (chunk, encoding, cb) { + var flushFlag; + var ws = this._writableState; + var ending = ws.ending || ws.ended; + var last = ending && (!chunk || ws.length === chunk.length); + + if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input')); + + if (!this._handle) return cb(new Error('zlib binding closed')); + + // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag + // (or whatever flag was provided using opts.finishFlush). + // If it's explicitly flushing at some other time, then we use + // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression + // goodness. + if (last) flushFlag = this._finishFlushFlag;else { + flushFlag = this._flushFlag; + // once we've flushed the last of the queue, stop flushing and + // go back to the normal behavior. + if (chunk.length >= ws.length) { + this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; + } + } + + this._processChunk(chunk, flushFlag, cb); +}; + +Zlib.prototype._processChunk = function (chunk, flushFlag, cb) { + var availInBefore = chunk && chunk.length; + var availOutBefore = this._chunkSize - this._offset; + var inOff = 0; + + var self = this; + + var async = typeof cb === 'function'; + + if (!async) { + var buffers = []; + var nread = 0; + + var error; + this.on('error', function (er) { + error = er; + }); + + assert(this._handle, 'zlib binding closed'); + do { + var res = this._handle.writeSync(flushFlag, chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + } while (!this._hadError && callback(res[0], res[1])); + + if (this._hadError) { + throw error; + } + + if (nread >= kMaxLength) { + _close(this); + throw new RangeError(kRangeErrorMessage); + } + + var buf = Buffer.concat(buffers, nread); + _close(this); + + return buf; + } + + assert(this._handle, 'zlib binding closed'); + var req = this._handle.write(flushFlag, chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + + req.buffer = chunk; + req.callback = callback; + + function callback(availInAfter, availOutAfter) { + // When the callback is used in an async write, the callback's + // context is the `req` object that was created. The req object + // is === this._handle, and that's why it's important to null + // out the values after they are done being used. `this._handle` + // can stay in memory longer than the callback and buffer are needed. + if (this) { + this.buffer = null; + this.callback = null; + } + + if (self._hadError) return; + + var have = availOutBefore - availOutAfter; + assert(have >= 0, 'have should not go down'); + + if (have > 0) { + var out = self._buffer.slice(self._offset, self._offset + have); + self._offset += have; + // serve some output to the consumer. + if (async) { + self.push(out); + } else { + buffers.push(out); + nread += out.length; + } + } + + // exhausted the output buffer, or used all the input create a new one. + if (availOutAfter === 0 || self._offset >= self._chunkSize) { + availOutBefore = self._chunkSize; + self._offset = 0; + self._buffer = Buffer.allocUnsafe(self._chunkSize); + } + + if (availOutAfter === 0) { + // Not actually done. Need to reprocess. + // Also, update the availInBefore to the availInAfter value, + // so that if we have to hit it a third (fourth, etc.) time, + // it'll have the correct byte counts. + inOff += availInBefore - availInAfter; + availInBefore = availInAfter; + + if (!async) return true; + + var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize); + newReq.callback = callback; // this same function + newReq.buffer = chunk; + return; + } + + if (!async) return false; + + // finished with the chunk. + cb(); + } +}; + +util.inherits(Deflate, Zlib); +util.inherits(Inflate, Zlib); +util.inherits(Gzip, Zlib); +util.inherits(Gunzip, Zlib); +util.inherits(DeflateRaw, Zlib); +util.inherits(InflateRaw, Zlib); +util.inherits(Unzip, Zlib); + +/***/ }), + +/***/ "./node_modules/buffer-xor/index.js": +/*!******************************************!*\ + !*** ./node_modules/buffer-xor/index.js ***! + \******************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; +module.exports = function xor (a, b) { + var length = Math.min(a.length, b.length) + var buffer = new Buffer(length) + + for (var i = 0; i < length; ++i) { + buffer[i] = a[i] ^ b[i] + } + + return buffer +} + + +/***/ }), + +/***/ "./node_modules/buffer/index.js": +/*!**************************************!*\ + !*** ./node_modules/buffer/index.js ***! + \**************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ + + + +const base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js") +const ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js") +const customInspectSymbol = + (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation + ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation + : null + +exports.Buffer = Buffer +exports.SlowBuffer = SlowBuffer +exports.INSPECT_MAX_BYTES = 50 + +const K_MAX_LENGTH = 0x7fffffff +exports.kMaxLength = K_MAX_LENGTH + +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Print warning and recommend using `buffer` v4.x which has an Object + * implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * We report that the browser does not support typed arrays if the are not subclassable + * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` + * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support + * for __proto__ and has a buggy typed array implementation. + */ +Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() + +if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && + typeof console.error === 'function') { + console.error( + 'This browser lacks typed array (Uint8Array) support which is required by ' + + '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' + ) +} + +function typedArraySupport () { + // Can typed array instances can be augmented? + try { + const arr = new Uint8Array(1) + const proto = { foo: function () { return 42 } } + Object.setPrototypeOf(proto, Uint8Array.prototype) + Object.setPrototypeOf(arr, proto) + return arr.foo() === 42 + } catch (e) { + return false + } +} + +Object.defineProperty(Buffer.prototype, 'parent', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.buffer + } +}) + +Object.defineProperty(Buffer.prototype, 'offset', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.byteOffset + } +}) + +function createBuffer (length) { + if (length > K_MAX_LENGTH) { + throw new RangeError('The value "' + length + '" is invalid for option "size"') + } + // Return an augmented `Uint8Array` instance + const buf = new Uint8Array(length) + Object.setPrototypeOf(buf, Buffer.prototype) + return buf +} + +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + +function Buffer (arg, encodingOrOffset, length) { + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new TypeError( + 'The "string" argument must be of type string. Received type number' + ) + } + return allocUnsafe(arg) + } + return from(arg, encodingOrOffset, length) +} + +Buffer.poolSize = 8192 // not used by this implementation + +function from (value, encodingOrOffset, length) { + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) + } + + if (ArrayBuffer.isView(value)) { + return fromArrayView(value) + } + + if (value == null) { + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) + } + + if (isInstance(value, ArrayBuffer) || + (value && isInstance(value.buffer, ArrayBuffer))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof SharedArrayBuffer !== 'undefined' && + (isInstance(value, SharedArrayBuffer) || + (value && isInstance(value.buffer, SharedArrayBuffer)))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof value === 'number') { + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ) + } + + const valueOf = value.valueOf && value.valueOf() + if (valueOf != null && valueOf !== value) { + return Buffer.from(valueOf, encodingOrOffset, length) + } + + const b = fromObject(value) + if (b) return b + + if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && + typeof value[Symbol.toPrimitive] === 'function') { + return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length) + } + + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) +} + +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ +Buffer.from = function (value, encodingOrOffset, length) { + return from(value, encodingOrOffset, length) +} + +// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: +// https://github.com/feross/buffer/pull/148 +Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) +Object.setPrototypeOf(Buffer, Uint8Array) + +function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be of type number') + } else if (size < 0) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } +} + +function alloc (size, fill, encoding) { + assertSize(size) + if (size <= 0) { + return createBuffer(size) + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpreted as a start offset. + return typeof encoding === 'string' + ? createBuffer(size).fill(fill, encoding) + : createBuffer(size).fill(fill) + } + return createBuffer(size) +} + +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(size, fill, encoding) +} + +function allocUnsafe (size) { + assertSize(size) + return createBuffer(size < 0 ? 0 : checked(size) | 0) +} + +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ +Buffer.allocUnsafe = function (size) { + return allocUnsafe(size) +} +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(size) +} + +function fromString (string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + + const length = byteLength(string, encoding) | 0 + let buf = createBuffer(length) + + const actual = buf.write(string, encoding) + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + buf = buf.slice(0, actual) + } + + return buf +} + +function fromArrayLike (array) { + const length = array.length < 0 ? 0 : checked(array.length) | 0 + const buf = createBuffer(length) + for (let i = 0; i < length; i += 1) { + buf[i] = array[i] & 255 + } + return buf +} + +function fromArrayView (arrayView) { + if (isInstance(arrayView, Uint8Array)) { + const copy = new Uint8Array(arrayView) + return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength) + } + return fromArrayLike(arrayView) +} + +function fromArrayBuffer (array, byteOffset, length) { + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('"offset" is outside of buffer bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('"length" is outside of buffer bounds') + } + + let buf + if (byteOffset === undefined && length === undefined) { + buf = new Uint8Array(array) + } else if (length === undefined) { + buf = new Uint8Array(array, byteOffset) + } else { + buf = new Uint8Array(array, byteOffset, length) + } + + // Return an augmented `Uint8Array` instance + Object.setPrototypeOf(buf, Buffer.prototype) + + return buf +} + +function fromObject (obj) { + if (Buffer.isBuffer(obj)) { + const len = checked(obj.length) | 0 + const buf = createBuffer(len) + + if (buf.length === 0) { + return buf + } + + obj.copy(buf, 0, 0, len) + return buf + } + + if (obj.length !== undefined) { + if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { + return createBuffer(0) + } + return fromArrayLike(obj) + } + + if (obj.type === 'Buffer' && Array.isArray(obj.data)) { + return fromArrayLike(obj.data) + } +} + +function checked (length) { + // Note: cannot use `length < K_MAX_LENGTH` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= K_MAX_LENGTH) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') + } + return length | 0 +} + +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} + +Buffer.isBuffer = function isBuffer (b) { + return b != null && b._isBuffer === true && + b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +} + +Buffer.compare = function compare (a, b) { + if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) + if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ) + } + + if (a === b) return 0 + + let x = a.length + let y = b.length + + for (let i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +Buffer.isEncoding = function isEncoding (encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true + default: + return false + } +} + +Buffer.concat = function concat (list, length) { + if (!Array.isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + + if (list.length === 0) { + return Buffer.alloc(0) + } + + let i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length + } + } + + const buffer = Buffer.allocUnsafe(length) + let pos = 0 + for (i = 0; i < list.length; ++i) { + let buf = list[i] + if (isInstance(buf, Uint8Array)) { + if (pos + buf.length > buffer.length) { + if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) + buf.copy(buffer, pos) + } else { + Uint8Array.prototype.set.call( + buffer, + buf, + pos + ) + } + } else if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } else { + buf.copy(buffer, pos) + } + pos += buf.length + } + return buffer +} + +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + + 'Received type ' + typeof string + ) + } + + const len = string.length + const mustMatch = (arguments.length > 2 && arguments[2] === true) + if (!mustMatch && len === 0) return 0 + + // Use a for loop to avoid recursion + let loweredCase = false + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len + case 'utf8': + case 'utf-8': + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 + case 'hex': + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) { + return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 + } + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} +Buffer.byteLength = byteLength + +function slowToString (encoding, start, end) { + let loweredCase = false + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0 + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return '' + } + + if (end === undefined || end > this.length) { + end = this.length + } + + if (end <= 0) { + return '' + } + + // Force coercion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 + + if (end <= start) { + return '' + } + + if (!encoding) encoding = 'utf8' + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) + + case 'ascii': + return asciiSlice(this, start, end) + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) + + case 'base64': + return base64Slice(this, start, end) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } + } +} + +// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) +// to detect a Buffer instance. It's not possible to use `instanceof Buffer` +// reliably in a browserify context because there could be multiple different +// copies of the 'buffer' package in use. This method works even for Buffer +// instances that were created from another copy of the `buffer` package. +// See: https://github.com/feross/buffer/issues/154 +Buffer.prototype._isBuffer = true + +function swap (b, n, m) { + const i = b[n] + b[n] = b[m] + b[m] = i +} + +Buffer.prototype.swap16 = function swap16 () { + const len = this.length + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits') + } + for (let i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this +} + +Buffer.prototype.swap32 = function swap32 () { + const len = this.length + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits') + } + for (let i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this +} + +Buffer.prototype.swap64 = function swap64 () { + const len = this.length + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits') + } + for (let i = 0; i < len; i += 8) { + swap(this, i, i + 7) + swap(this, i + 1, i + 6) + swap(this, i + 2, i + 5) + swap(this, i + 3, i + 4) + } + return this +} + +Buffer.prototype.toString = function toString () { + const length = this.length + if (length === 0) return '' + if (arguments.length === 0) return utf8Slice(this, 0, length) + return slowToString.apply(this, arguments) +} + +Buffer.prototype.toLocaleString = Buffer.prototype.toString + +Buffer.prototype.equals = function equals (b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') + if (this === b) return true + return Buffer.compare(this, b) === 0 +} + +Buffer.prototype.inspect = function inspect () { + let str = '' + const max = exports.INSPECT_MAX_BYTES + str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() + if (this.length > max) str += ' ... ' + return '' +} +if (customInspectSymbol) { + Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect +} + +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (isInstance(target, Uint8Array)) { + target = Buffer.from(target, target.offset, target.byteLength) + } + if (!Buffer.isBuffer(target)) { + throw new TypeError( + 'The "target" argument must be one of type Buffer or Uint8Array. ' + + 'Received type ' + (typeof target) + ) + } + + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } + + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 + } + + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 + + if (this === target) return 0 + + let x = thisEnd - thisStart + let y = end - start + const len = Math.min(x, y) + + const thisCopy = this.slice(thisStart, thisEnd) + const targetCopy = target.slice(start, end) + + for (let i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf +function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1 + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 + } + byteOffset = +byteOffset // Coerce to Number. + if (numberIsNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : (buffer.length - 1) + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset + if (byteOffset >= buffer.length) { + if (dir) return -1 + else byteOffset = buffer.length - 1 + } else if (byteOffset < 0) { + if (dir) byteOffset = 0 + else return -1 + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding) + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1 + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir) + } else if (typeof val === 'number') { + val = val & 0xFF // Search for a byte value [0-255] + if (typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + } + } + return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) + } + + throw new TypeError('val must be string, number or Buffer') +} + +function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + let indexSize = 1 + let arrLength = arr.length + let valLength = val.length + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase() + if (encoding === 'ucs2' || encoding === 'ucs-2' || + encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1 + } + indexSize = 2 + arrLength /= 2 + valLength /= 2 + byteOffset /= 2 + } + } + + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } + + let i + if (dir) { + let foundIndex = -1 + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize + } else { + if (foundIndex !== -1) i -= i - foundIndex + foundIndex = -1 + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength + for (i = byteOffset; i >= 0; i--) { + let found = true + for (let j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false + break + } + } + if (found) return i + } + } + + return -1 +} + +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} + +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} + +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} + +function hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + const remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + const strLen = string.length + + if (length > strLen / 2) { + length = strLen / 2 + } + let i + for (i = 0; i < length; ++i) { + const parsed = parseInt(string.substr(i * 2, 2), 16) + if (numberIsNaN(parsed)) return i + buf[offset + i] = parsed + } + return i +} + +function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +} + +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) +} + +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) +} + +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +} + +Buffer.prototype.write = function write (string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8' + length = this.length + offset = 0 + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset + length = this.length + offset = 0 + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset >>> 0 + if (isFinite(length)) { + length = length >>> 0 + if (encoding === undefined) encoding = 'utf8' + } else { + encoding = length + length = undefined + } + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ) + } + + const remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining + + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } + + if (!encoding) encoding = 'utf8' + + let loweredCase = false + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) + + case 'ascii': + case 'latin1': + case 'binary': + return asciiWrite(this, string, offset, length) + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} + +Buffer.prototype.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end) + const res = [] + + let i = start + while (i < end) { + const firstByte = buf[i] + let codePoint = null + let bytesPerSequence = (firstByte > 0xEF) + ? 4 + : (firstByte > 0xDF) + ? 3 + : (firstByte > 0xBF) + ? 2 + : 1 + + if (i + bytesPerSequence <= end) { + let secondByte, thirdByte, fourthByte, tempCodePoint + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte + } + break + case 2: + secondByte = buf[i + 1] + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint + } + } + break + case 3: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint + } + } + break + case 4: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + fourthByte = buf[i + 3] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD + bytesPerSequence = 1 + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000 + res.push(codePoint >>> 10 & 0x3FF | 0xD800) + codePoint = 0xDC00 | codePoint & 0x3FF + } + + res.push(codePoint) + i += bytesPerSequence + } + + return decodeCodePointsArray(res) +} + +// Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety +const MAX_ARGUMENTS_LENGTH = 0x1000 + +function decodeCodePointsArray (codePoints) { + const len = codePoints.length + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + let res = '' + let i = 0 + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ) + } + return res +} + +function asciiSlice (buf, start, end) { + let ret = '' + end = Math.min(buf.length, end) + + for (let i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F) + } + return ret +} + +function latin1Slice (buf, start, end) { + let ret = '' + end = Math.min(buf.length, end) + + for (let i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret +} + +function hexSlice (buf, start, end) { + const len = buf.length + + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len + + let out = '' + for (let i = start; i < end; ++i) { + out += hexSliceLookupTable[buf[i]] + } + return out +} + +function utf16leSlice (buf, start, end) { + const bytes = buf.slice(start, end) + let res = '' + // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) + for (let i = 0; i < bytes.length - 1; i += 2) { + res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) + } + return res +} + +Buffer.prototype.slice = function slice (start, end) { + const len = this.length + start = ~~start + end = end === undefined ? len : ~~end + + if (start < 0) { + start += len + if (start < 0) start = 0 + } else if (start > len) { + start = len + } + + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len + } + + if (end < start) end = start + + const newBuf = this.subarray(start, end) + // Return an augmented `Uint8Array` instance + Object.setPrototypeOf(newBuf, Buffer.prototype) + + return newBuf +} + +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ +function checkOffset (offset, ext, length) { + if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') +} + +Buffer.prototype.readUintLE = +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + let val = this[offset] + let mul = 1 + let i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + + return val +} + +Buffer.prototype.readUintBE = +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) + } + + let val = this[offset + --byteLength] + let mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul + } + + return val +} + +Buffer.prototype.readUint8 = +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] +} + +Buffer.prototype.readUint16LE = +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) +} + +Buffer.prototype.readUint16BE = +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} + +Buffer.prototype.readUint32LE = +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) +} + +Buffer.prototype.readUint32BE = +Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) +} + +Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const lo = first + + this[++offset] * 2 ** 8 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 24 + + const hi = this[++offset] + + this[++offset] * 2 ** 8 + + this[++offset] * 2 ** 16 + + last * 2 ** 24 + + return BigInt(lo) + (BigInt(hi) << BigInt(32)) +}) + +Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const hi = first * 2 ** 24 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + this[++offset] + + const lo = this[++offset] * 2 ** 24 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + last + + return (BigInt(hi) << BigInt(32)) + BigInt(lo) +}) + +Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + let val = this[offset] + let mul = 1 + let i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + let i = byteLength + let mul = 1 + let val = this[offset + --i] + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + if (!(this[offset] & 0x80)) return (this[offset]) + return ((0xff - this[offset] + 1) * -1) +} + +Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + const val = this[offset] | (this[offset + 1] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + const val = this[offset + 1] | (this[offset] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} + +Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) +} + +Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const val = this[offset + 4] + + this[offset + 5] * 2 ** 8 + + this[offset + 6] * 2 ** 16 + + (last << 24) // Overflow + + return (BigInt(val) << BigInt(32)) + + BigInt(first + + this[++offset] * 2 ** 8 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 24) +}) + +Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const val = (first << 24) + // Overflow + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + this[++offset] + + return (BigInt(val) << BigInt(32)) + + BigInt(this[++offset] * 2 ** 24 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + last) +}) + +Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, true, 23, 4) +} + +Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, false, 23, 4) +} + +Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, true, 52, 8) +} + +Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, false, 52, 8) +} + +function checkInt (buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') + if (offset + ext > buf.length) throw new RangeError('Index out of range') +} + +Buffer.prototype.writeUintLE = +Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + const maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + let mul = 1 + let i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUintBE = +Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + const maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + let i = byteLength - 1 + let mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUint8 = +Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeUint16LE = +Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} + +Buffer.prototype.writeUint16BE = +Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} + +Buffer.prototype.writeUint32LE = +Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset + 3] = (value >>> 24) + this[offset + 2] = (value >>> 16) + this[offset + 1] = (value >>> 8) + this[offset] = (value & 0xff) + return offset + 4 +} + +Buffer.prototype.writeUint32BE = +Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} + +function wrtBigUInt64LE (buf, value, offset, min, max) { + checkIntBI(value, min, max, buf, offset, 7) + + let lo = Number(value & BigInt(0xffffffff)) + buf[offset++] = lo + lo = lo >> 8 + buf[offset++] = lo + lo = lo >> 8 + buf[offset++] = lo + lo = lo >> 8 + buf[offset++] = lo + let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) + buf[offset++] = hi + hi = hi >> 8 + buf[offset++] = hi + hi = hi >> 8 + buf[offset++] = hi + hi = hi >> 8 + buf[offset++] = hi + return offset +} + +function wrtBigUInt64BE (buf, value, offset, min, max) { + checkIntBI(value, min, max, buf, offset, 7) + + let lo = Number(value & BigInt(0xffffffff)) + buf[offset + 7] = lo + lo = lo >> 8 + buf[offset + 6] = lo + lo = lo >> 8 + buf[offset + 5] = lo + lo = lo >> 8 + buf[offset + 4] = lo + let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) + buf[offset + 3] = hi + hi = hi >> 8 + buf[offset + 2] = hi + hi = hi >> 8 + buf[offset + 1] = hi + hi = hi >> 8 + buf[offset] = hi + return offset + 8 +} + +Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) { + return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) +}) + +Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) { + return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) +}) + +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + const limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + let i = 0 + let mul = 1 + let sub = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + const limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + let i = byteLength - 1 + let mul = 1 + let sub = 0 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) + if (value < 0) value = 0xff + value + 1 + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} + +Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} + +Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + this[offset + 2] = (value >>> 16) + this[offset + 3] = (value >>> 24) + return offset + 4 +} + +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (value < 0) value = 0xffffffff + value + 1 + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} + +Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) { + return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) +}) + +Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) { + return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) +}) + +function checkIEEE754 (buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range') + if (offset < 0) throw new RangeError('Index out of range') +} + +function writeFloat (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 +} + +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) +} + +function writeDouble (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) + } + ieee754.write(buf, value, offset, littleEndian, 52, 8) + return offset + 8 +} + +Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (targetStart >= target.length) targetStart = target.length + if (!targetStart) targetStart = 0 + if (end > 0 && end < start) end = start + + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') + } + if (start < 0 || start >= this.length) throw new RangeError('Index out of range') + if (end < 0) throw new RangeError('sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start + } + + const len = end - start + + if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { + // Use built-in when available, missing from IE11 + this.copyWithin(targetStart, start, end) + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, end), + targetStart + ) + } + + return len +} + +// Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) +Buffer.prototype.fill = function fill (val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start + start = 0 + end = this.length + } else if (typeof end === 'string') { + encoding = end + end = this.length + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + if (val.length === 1) { + const code = val.charCodeAt(0) + if ((encoding === 'utf8' && code < 128) || + encoding === 'latin1') { + // Fast path: If `val` fits into a single byte, use that numeric value. + val = code + } + } + } else if (typeof val === 'number') { + val = val & 255 + } else if (typeof val === 'boolean') { + val = Number(val) + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index') + } + + if (end <= start) { + return this + } + + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 + + if (!val) val = 0 + + let i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + const bytes = Buffer.isBuffer(val) + ? val + : Buffer.from(val, encoding) + const len = bytes.length + if (len === 0) { + throw new TypeError('The value "' + val + + '" is invalid for argument "value"') + } + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } + } + + return this +} + +// CUSTOM ERRORS +// ============= + +// Simplified versions from Node, changed for Buffer-only usage +const errors = {} +function E (sym, getMessage, Base) { + errors[sym] = class NodeError extends Base { + constructor () { + super() + + Object.defineProperty(this, 'message', { + value: getMessage.apply(this, arguments), + writable: true, + configurable: true + }) + + // Add the error code to the name to include it in the stack trace. + this.name = `${this.name} [${sym}]` + // Access the stack to generate the error message including the error code + // from the name. + this.stack // eslint-disable-line no-unused-expressions + // Reset the name to the actual name. + delete this.name + } + + get code () { + return sym + } + + set code (value) { + Object.defineProperty(this, 'code', { + configurable: true, + enumerable: true, + value, + writable: true + }) + } + + toString () { + return `${this.name} [${sym}]: ${this.message}` + } + } +} + +E('ERR_BUFFER_OUT_OF_BOUNDS', + function (name) { + if (name) { + return `${name} is outside of buffer bounds` + } + + return 'Attempt to access memory outside buffer bounds' + }, RangeError) +E('ERR_INVALID_ARG_TYPE', + function (name, actual) { + return `The "${name}" argument must be of type number. Received type ${typeof actual}` + }, TypeError) +E('ERR_OUT_OF_RANGE', + function (str, range, input) { + let msg = `The value of "${str}" is out of range.` + let received = input + if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { + received = addNumericalSeparator(String(input)) + } else if (typeof input === 'bigint') { + received = String(input) + if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) { + received = addNumericalSeparator(received) + } + received += 'n' + } + msg += ` It must be ${range}. Received ${received}` + return msg + }, RangeError) + +function addNumericalSeparator (val) { + let res = '' + let i = val.length + const start = val[0] === '-' ? 1 : 0 + for (; i >= start + 4; i -= 3) { + res = `_${val.slice(i - 3, i)}${res}` + } + return `${val.slice(0, i)}${res}` +} + +// CHECK FUNCTIONS +// =============== + +function checkBounds (buf, offset, byteLength) { + validateNumber(offset, 'offset') + if (buf[offset] === undefined || buf[offset + byteLength] === undefined) { + boundsError(offset, buf.length - (byteLength + 1)) + } +} + +function checkIntBI (value, min, max, buf, offset, byteLength) { + if (value > max || value < min) { + const n = typeof min === 'bigint' ? 'n' : '' + let range + if (byteLength > 3) { + if (min === 0 || min === BigInt(0)) { + range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}` + } else { + range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + + `${(byteLength + 1) * 8 - 1}${n}` + } + } else { + range = `>= ${min}${n} and <= ${max}${n}` + } + throw new errors.ERR_OUT_OF_RANGE('value', range, value) + } + checkBounds(buf, offset, byteLength) +} + +function validateNumber (value, name) { + if (typeof value !== 'number') { + throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value) + } +} + +function boundsError (value, length, type) { + if (Math.floor(value) !== value) { + validateNumber(value, type) + throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value) + } + + if (length < 0) { + throw new errors.ERR_BUFFER_OUT_OF_BOUNDS() + } + + throw new errors.ERR_OUT_OF_RANGE(type || 'offset', + `>= ${type ? 1 : 0} and <= ${length}`, + value) +} + +// HELPER FUNCTIONS +// ================ + +const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g + +function base64clean (str) { + // Node takes equal signs as end of the Base64 encoding + str = str.split('=')[0] + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = str.trim().replace(INVALID_BASE64_RE, '') + // Node converts strings with length < 2 to '' + if (str.length < 2) return '' + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '=' + } + return str +} + +function utf8ToBytes (string, units) { + units = units || Infinity + let codePoint + const length = string.length + let leadSurrogate = null + const bytes = [] + + for (let i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i) + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } + + // valid lead + leadSurrogate = codePoint + + continue + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + leadSurrogate = codePoint + continue + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + } + + leadSurrogate = null + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break + bytes.push(codePoint) + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break + bytes.push( + codePoint >> 0x6 | 0xC0, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break + bytes.push( + codePoint >> 0xC | 0xE0, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break + bytes.push( + codePoint >> 0x12 | 0xF0, + codePoint >> 0xC & 0x3F | 0x80, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else { + throw new Error('Invalid code point') + } + } + + return bytes +} + +function asciiToBytes (str) { + const byteArray = [] + for (let i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray +} + +function utf16leToBytes (str, units) { + let c, hi, lo + const byteArray = [] + for (let i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break + + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) + } + + return byteArray +} + +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) +} + +function blitBuffer (src, dst, offset, length) { + let i + for (i = 0; i < length; ++i) { + if ((i + offset >= dst.length) || (i >= src.length)) break + dst[i + offset] = src[i] + } + return i +} + +// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass +// the `instanceof` check but they should be treated as of that type. +// See: https://github.com/feross/buffer/issues/166 +function isInstance (obj, type) { + return obj instanceof type || + (obj != null && obj.constructor != null && obj.constructor.name != null && + obj.constructor.name === type.name) +} +function numberIsNaN (obj) { + // For IE11 support + return obj !== obj // eslint-disable-line no-self-compare +} + +// Create lookup table for `toString('hex')` +// See: https://github.com/feross/buffer/issues/219 +const hexSliceLookupTable = (function () { + const alphabet = '0123456789abcdef' + const table = new Array(256) + for (let i = 0; i < 16; ++i) { + const i16 = i * 16 + for (let j = 0; j < 16; ++j) { + table[i16 + j] = alphabet[i] + alphabet[j] + } + } + return table +})() + +// Return not function with Error if BigInt not supported +function defineBigIntMethod (fn) { + return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn +} + +function BufferBigIntNotDefined () { + throw new Error('BigInt not supported') +} + + +/***/ }), + +/***/ "./node_modules/builtin-status-codes/browser.js": +/*!******************************************************!*\ + !*** ./node_modules/builtin-status-codes/browser.js ***! + \******************************************************/ +/***/ (function(module) { + +module.exports = { + "100": "Continue", + "101": "Switching Protocols", + "102": "Processing", + "200": "OK", + "201": "Created", + "202": "Accepted", + "203": "Non-Authoritative Information", + "204": "No Content", + "205": "Reset Content", + "206": "Partial Content", + "207": "Multi-Status", + "208": "Already Reported", + "226": "IM Used", + "300": "Multiple Choices", + "301": "Moved Permanently", + "302": "Found", + "303": "See Other", + "304": "Not Modified", + "305": "Use Proxy", + "307": "Temporary Redirect", + "308": "Permanent Redirect", + "400": "Bad Request", + "401": "Unauthorized", + "402": "Payment Required", + "403": "Forbidden", + "404": "Not Found", + "405": "Method Not Allowed", + "406": "Not Acceptable", + "407": "Proxy Authentication Required", + "408": "Request Timeout", + "409": "Conflict", + "410": "Gone", + "411": "Length Required", + "412": "Precondition Failed", + "413": "Payload Too Large", + "414": "URI Too Long", + "415": "Unsupported Media Type", + "416": "Range Not Satisfiable", + "417": "Expectation Failed", + "418": "I'm a teapot", + "421": "Misdirected Request", + "422": "Unprocessable Entity", + "423": "Locked", + "424": "Failed Dependency", + "425": "Unordered Collection", + "426": "Upgrade Required", + "428": "Precondition Required", + "429": "Too Many Requests", + "431": "Request Header Fields Too Large", + "451": "Unavailable For Legal Reasons", + "500": "Internal Server Error", + "501": "Not Implemented", + "502": "Bad Gateway", + "503": "Service Unavailable", + "504": "Gateway Timeout", + "505": "HTTP Version Not Supported", + "506": "Variant Also Negotiates", + "507": "Insufficient Storage", + "508": "Loop Detected", + "509": "Bandwidth Limit Exceeded", + "510": "Not Extended", + "511": "Network Authentication Required" +} + + +/***/ }), + +/***/ "./node_modules/call-bind/callBound.js": +/*!*********************************************!*\ + !*** ./node_modules/call-bind/callBound.js ***! + \*********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js"); + +var callBind = __webpack_require__(/*! ./ */ "./node_modules/call-bind/index.js"); + +var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); + +module.exports = function callBoundIntrinsic(name, allowMissing) { + var intrinsic = GetIntrinsic(name, !!allowMissing); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBind(intrinsic); + } + return intrinsic; +}; + + +/***/ }), + +/***/ "./node_modules/call-bind/index.js": +/*!*****************************************!*\ + !*** ./node_modules/call-bind/index.js ***! + \*****************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js"); +var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js"); + +var $apply = GetIntrinsic('%Function.prototype.apply%'); +var $call = GetIntrinsic('%Function.prototype.call%'); +var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); + +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); +var $max = GetIntrinsic('%Math.max%'); + +if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + } catch (e) { + // IE 8 has a broken defineProperty + $defineProperty = null; + } +} + +module.exports = function callBind(originalFunction) { + var func = $reflectApply(bind, $call, arguments); + if ($gOPD && $defineProperty) { + var desc = $gOPD(func, 'length'); + if (desc.configurable) { + // original length, plus the receiver, minus any additional arguments (after the receiver) + $defineProperty( + func, + 'length', + { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) } + ); + } + } + return func; +}; + +var applyBind = function applyBind() { + return $reflectApply(bind, $apply, arguments); +}; + +if ($defineProperty) { + $defineProperty(module.exports, 'apply', { value: applyBind }); +} else { + module.exports.apply = applyBind; +} + + +/***/ }), + +/***/ "./node_modules/cipher-base/index.js": +/*!*******************************************!*\ + !*** ./node_modules/cipher-base/index.js ***! + \*******************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var Transform = (__webpack_require__(/*! stream */ "./node_modules/stream-browserify/index.js").Transform) +var StringDecoder = (__webpack_require__(/*! string_decoder */ "./node_modules/string_decoder/lib/string_decoder.js").StringDecoder) +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js") + +function CipherBase (hashMode) { + Transform.call(this) + this.hashMode = typeof hashMode === 'string' + if (this.hashMode) { + this[hashMode] = this._finalOrDigest + } else { + this.final = this._finalOrDigest + } + if (this._final) { + this.__final = this._final + this._final = null + } + this._decoder = null + this._encoding = null +} +inherits(CipherBase, Transform) + +CipherBase.prototype.update = function (data, inputEnc, outputEnc) { + if (typeof data === 'string') { + data = Buffer.from(data, inputEnc) + } + + var outData = this._update(data) + if (this.hashMode) return this + + if (outputEnc) { + outData = this._toString(outData, outputEnc) + } + + return outData +} + +CipherBase.prototype.setAutoPadding = function () {} +CipherBase.prototype.getAuthTag = function () { + throw new Error('trying to get auth tag in unsupported state') +} + +CipherBase.prototype.setAuthTag = function () { + throw new Error('trying to set auth tag in unsupported state') +} + +CipherBase.prototype.setAAD = function () { + throw new Error('trying to set aad in unsupported state') +} + +CipherBase.prototype._transform = function (data, _, next) { + var err + try { + if (this.hashMode) { + this._update(data) + } else { + this.push(this._update(data)) + } + } catch (e) { + err = e + } finally { + next(err) + } +} +CipherBase.prototype._flush = function (done) { + var err + try { + this.push(this.__final()) + } catch (e) { + err = e + } + + done(err) +} +CipherBase.prototype._finalOrDigest = function (outputEnc) { + var outData = this.__final() || Buffer.alloc(0) + if (outputEnc) { + outData = this._toString(outData, outputEnc, true) + } + return outData +} + +CipherBase.prototype._toString = function (value, enc, fin) { + if (!this._decoder) { + this._decoder = new StringDecoder(enc) + this._encoding = enc + } + + if (this._encoding !== enc) throw new Error('can\'t switch encodings') + + var out = this._decoder.write(value) + if (fin) { + out += this._decoder.end() + } + + return out +} + +module.exports = CipherBase + + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/auth/v1beta1/auth.js": +/*!***************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/auth/v1beta1/auth.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Params = exports.ModuleAccount = exports.BaseAccount = exports.protobufPackage = void 0; +/* eslint-disable */ +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "cosmos.auth.v1beta1"; +function createBaseBaseAccount() { + return { + address: "", + pubKey: undefined, + accountNumber: helpers_1.Long.UZERO, + sequence: helpers_1.Long.UZERO, + }; +} +exports.BaseAccount = { + encode(message, writer = _m0.Writer.create()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + any_1.Any.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); + } + if (!message.accountNumber.isZero()) { + writer.uint32(24).uint64(message.accountNumber); + } + if (!message.sequence.isZero()) { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.pubKey = any_1.Any.decode(reader, reader.uint32()); + break; + case 3: + message.accountNumber = reader.uint64(); + break; + case 4: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + address: (0, helpers_1.isSet)(object.address) ? String(object.address) : "", + pubKey: (0, helpers_1.isSet)(object.pubKey) ? any_1.Any.fromJSON(object.pubKey) : undefined, + accountNumber: (0, helpers_1.isSet)(object.accountNumber) ? helpers_1.Long.fromValue(object.accountNumber) : helpers_1.Long.UZERO, + sequence: (0, helpers_1.isSet)(object.sequence) ? helpers_1.Long.fromValue(object.sequence) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && (obj.address = message.address); + message.pubKey !== undefined && (obj.pubKey = message.pubKey ? any_1.Any.toJSON(message.pubKey) : undefined); + message.accountNumber !== undefined && + (obj.accountNumber = (message.accountNumber || helpers_1.Long.UZERO).toString()); + message.sequence !== undefined && (obj.sequence = (message.sequence || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseBaseAccount(); + message.address = object.address ?? ""; + message.pubKey = + object.pubKey !== undefined && object.pubKey !== null ? any_1.Any.fromPartial(object.pubKey) : undefined; + message.accountNumber = + object.accountNumber !== undefined && object.accountNumber !== null + ? helpers_1.Long.fromValue(object.accountNumber) + : helpers_1.Long.UZERO; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? helpers_1.Long.fromValue(object.sequence) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseModuleAccount() { + return { + baseAccount: undefined, + name: "", + permissions: [], + }; +} +exports.ModuleAccount = { + encode(message, writer = _m0.Writer.create()) { + if (message.baseAccount !== undefined) { + exports.BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + for (const v of message.permissions) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseAccount = exports.BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.permissions.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + baseAccount: (0, helpers_1.isSet)(object.baseAccount) ? exports.BaseAccount.fromJSON(object.baseAccount) : undefined, + name: (0, helpers_1.isSet)(object.name) ? String(object.name) : "", + permissions: Array.isArray(object?.permissions) ? object.permissions.map((e) => String(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.baseAccount !== undefined && + (obj.baseAccount = message.baseAccount ? exports.BaseAccount.toJSON(message.baseAccount) : undefined); + message.name !== undefined && (obj.name = message.name); + if (message.permissions) { + obj.permissions = message.permissions.map((e) => e); + } + else { + obj.permissions = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseModuleAccount(); + message.baseAccount = + object.baseAccount !== undefined && object.baseAccount !== null + ? exports.BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.name = object.name ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; +function createBaseParams() { + return { + maxMemoCharacters: helpers_1.Long.UZERO, + txSigLimit: helpers_1.Long.UZERO, + txSizeCostPerByte: helpers_1.Long.UZERO, + sigVerifyCostEd25519: helpers_1.Long.UZERO, + sigVerifyCostSecp256k1: helpers_1.Long.UZERO, + }; +} +exports.Params = { + encode(message, writer = _m0.Writer.create()) { + if (!message.maxMemoCharacters.isZero()) { + writer.uint32(8).uint64(message.maxMemoCharacters); + } + if (!message.txSigLimit.isZero()) { + writer.uint32(16).uint64(message.txSigLimit); + } + if (!message.txSizeCostPerByte.isZero()) { + writer.uint32(24).uint64(message.txSizeCostPerByte); + } + if (!message.sigVerifyCostEd25519.isZero()) { + writer.uint32(32).uint64(message.sigVerifyCostEd25519); + } + if (!message.sigVerifyCostSecp256k1.isZero()) { + writer.uint32(40).uint64(message.sigVerifyCostSecp256k1); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxMemoCharacters = reader.uint64(); + break; + case 2: + message.txSigLimit = reader.uint64(); + break; + case 3: + message.txSizeCostPerByte = reader.uint64(); + break; + case 4: + message.sigVerifyCostEd25519 = reader.uint64(); + break; + case 5: + message.sigVerifyCostSecp256k1 = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + maxMemoCharacters: (0, helpers_1.isSet)(object.maxMemoCharacters) + ? helpers_1.Long.fromValue(object.maxMemoCharacters) + : helpers_1.Long.UZERO, + txSigLimit: (0, helpers_1.isSet)(object.txSigLimit) ? helpers_1.Long.fromValue(object.txSigLimit) : helpers_1.Long.UZERO, + txSizeCostPerByte: (0, helpers_1.isSet)(object.txSizeCostPerByte) + ? helpers_1.Long.fromValue(object.txSizeCostPerByte) + : helpers_1.Long.UZERO, + sigVerifyCostEd25519: (0, helpers_1.isSet)(object.sigVerifyCostEd25519) + ? helpers_1.Long.fromValue(object.sigVerifyCostEd25519) + : helpers_1.Long.UZERO, + sigVerifyCostSecp256k1: (0, helpers_1.isSet)(object.sigVerifyCostSecp256k1) + ? helpers_1.Long.fromValue(object.sigVerifyCostSecp256k1) + : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.maxMemoCharacters !== undefined && + (obj.maxMemoCharacters = (message.maxMemoCharacters || helpers_1.Long.UZERO).toString()); + message.txSigLimit !== undefined && (obj.txSigLimit = (message.txSigLimit || helpers_1.Long.UZERO).toString()); + message.txSizeCostPerByte !== undefined && + (obj.txSizeCostPerByte = (message.txSizeCostPerByte || helpers_1.Long.UZERO).toString()); + message.sigVerifyCostEd25519 !== undefined && + (obj.sigVerifyCostEd25519 = (message.sigVerifyCostEd25519 || helpers_1.Long.UZERO).toString()); + message.sigVerifyCostSecp256k1 !== undefined && + (obj.sigVerifyCostSecp256k1 = (message.sigVerifyCostSecp256k1 || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseParams(); + message.maxMemoCharacters = + object.maxMemoCharacters !== undefined && object.maxMemoCharacters !== null + ? helpers_1.Long.fromValue(object.maxMemoCharacters) + : helpers_1.Long.UZERO; + message.txSigLimit = + object.txSigLimit !== undefined && object.txSigLimit !== null + ? helpers_1.Long.fromValue(object.txSigLimit) + : helpers_1.Long.UZERO; + message.txSizeCostPerByte = + object.txSizeCostPerByte !== undefined && object.txSizeCostPerByte !== null + ? helpers_1.Long.fromValue(object.txSizeCostPerByte) + : helpers_1.Long.UZERO; + message.sigVerifyCostEd25519 = + object.sigVerifyCostEd25519 !== undefined && object.sigVerifyCostEd25519 !== null + ? helpers_1.Long.fromValue(object.sigVerifyCostEd25519) + : helpers_1.Long.UZERO; + message.sigVerifyCostSecp256k1 = + object.sigVerifyCostSecp256k1 !== undefined && object.sigVerifyCostSecp256k1 !== null + ? helpers_1.Long.fromValue(object.sigVerifyCostSecp256k1) + : helpers_1.Long.UZERO; + return message; + }, +}; +//# sourceMappingURL=auth.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/auth/v1beta1/query.js": +/*!****************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/auth/v1beta1/query.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QueryModuleAccountByNameResponse = exports.QueryModuleAccountByNameRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.QueryAccountResponse = exports.QueryAccountRequest = exports.QueryAccountsResponse = exports.QueryAccountsRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const pagination_1 = __webpack_require__(/*! ../../base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const auth_1 = __webpack_require__(/*! ./auth */ "./node_modules/cosmjs-types/cosmos/auth/v1beta1/auth.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.auth.v1beta1"; +function createBaseQueryAccountsRequest() { + return { + pagination: undefined, + }; +} +exports.QueryAccountsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAccountsRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryAccountsResponse() { + return { + accounts: [], + pagination: undefined, + }; +} +exports.QueryAccountsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.accounts) { + any_1.Any.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.accounts.push(any_1.Any.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + accounts: Array.isArray(object?.accounts) ? object.accounts.map((e) => any_1.Any.fromJSON(e)) : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.accounts) { + obj.accounts = message.accounts.map((e) => (e ? any_1.Any.toJSON(e) : undefined)); + } + else { + obj.accounts = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAccountsResponse(); + message.accounts = object.accounts?.map((e) => any_1.Any.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryAccountRequest() { + return { + address: "", + }; +} +exports.QueryAccountRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + address: (0, helpers_1.isSet)(object.address) ? String(object.address) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; +function createBaseQueryAccountResponse() { + return { + account: undefined, + }; +} +exports.QueryAccountResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.account !== undefined) { + any_1.Any.encode(message.account, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = any_1.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + account: (0, helpers_1.isSet)(object.account) ? any_1.Any.fromJSON(object.account) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.account !== undefined && + (obj.account = message.account ? any_1.Any.toJSON(message.account) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAccountResponse(); + message.account = + object.account !== undefined && object.account !== null ? any_1.Any.fromPartial(object.account) : undefined; + return message; + }, +}; +function createBaseQueryParamsRequest() { + return {}; +} +exports.QueryParamsRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { + params: undefined, + }; +} +exports.QueryParamsResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.params !== undefined) { + auth_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = auth_1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + params: (0, helpers_1.isSet)(object.params) ? auth_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.params !== undefined && (obj.params = message.params ? auth_1.Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null ? auth_1.Params.fromPartial(object.params) : undefined; + return message; + }, +}; +function createBaseQueryModuleAccountByNameRequest() { + return { + name: "", + }; +} +exports.QueryModuleAccountByNameRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + name: (0, helpers_1.isSet)(object.name) ? String(object.name) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryModuleAccountByNameRequest(); + message.name = object.name ?? ""; + return message; + }, +}; +function createBaseQueryModuleAccountByNameResponse() { + return { + account: undefined, + }; +} +exports.QueryModuleAccountByNameResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.account !== undefined) { + any_1.Any.encode(message.account, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = any_1.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + account: (0, helpers_1.isSet)(object.account) ? any_1.Any.fromJSON(object.account) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.account !== undefined && + (obj.account = message.account ? any_1.Any.toJSON(message.account) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryModuleAccountByNameResponse(); + message.account = + object.account !== undefined && object.account !== null ? any_1.Any.fromPartial(object.account) : undefined; + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Accounts = this.Accounts.bind(this); + this.Account = this.Account.bind(this); + this.Params = this.Params.bind(this); + this.ModuleAccountByName = this.ModuleAccountByName.bind(this); + } + Accounts(request = { + pagination: undefined, + }) { + const data = exports.QueryAccountsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Accounts", data); + return promise.then((data) => exports.QueryAccountsResponse.decode(new _m0.Reader(data))); + } + Account(request) { + const data = exports.QueryAccountRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Account", data); + return promise.then((data) => exports.QueryAccountResponse.decode(new _m0.Reader(data))); + } + Params(request = {}) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new _m0.Reader(data))); + } + ModuleAccountByName(request) { + const data = exports.QueryModuleAccountByNameRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "ModuleAccountByName", data); + return promise.then((data) => exports.QueryModuleAccountByNameResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/authz/v1beta1/authz.js": +/*!*****************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/authz/v1beta1/authz.js ***! + \*****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.GrantAuthorization = exports.Grant = exports.GenericAuthorization = exports.protobufPackage = void 0; +/* eslint-disable */ +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const timestamp_1 = __webpack_require__(/*! ../../../google/protobuf/timestamp */ "./node_modules/cosmjs-types/google/protobuf/timestamp.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.authz.v1beta1"; +function createBaseGenericAuthorization() { + return { + msg: "", + }; +} +exports.GenericAuthorization = { + encode(message, writer = _m0.Writer.create()) { + if (message.msg !== "") { + writer.uint32(10).string(message.msg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenericAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msg = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + msg: (0, helpers_1.isSet)(object.msg) ? String(object.msg) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.msg !== undefined && (obj.msg = message.msg); + return obj; + }, + fromPartial(object) { + const message = createBaseGenericAuthorization(); + message.msg = object.msg ?? ""; + return message; + }, +}; +function createBaseGrant() { + return { + authorization: undefined, + expiration: undefined, + }; +} +exports.Grant = { + encode(message, writer = _m0.Writer.create()) { + if (message.authorization !== undefined) { + any_1.Any.encode(message.authorization, writer.uint32(10).fork()).ldelim(); + } + if (message.expiration !== undefined) { + timestamp_1.Timestamp.encode(message.expiration, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authorization = any_1.Any.decode(reader, reader.uint32()); + break; + case 2: + message.expiration = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + authorization: (0, helpers_1.isSet)(object.authorization) ? any_1.Any.fromJSON(object.authorization) : undefined, + expiration: (0, helpers_1.isSet)(object.expiration) ? (0, helpers_1.fromJsonTimestamp)(object.expiration) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.authorization !== undefined && + (obj.authorization = message.authorization ? any_1.Any.toJSON(message.authorization) : undefined); + message.expiration !== undefined && (obj.expiration = (0, helpers_1.fromTimestamp)(message.expiration).toISOString()); + return obj; + }, + fromPartial(object) { + const message = createBaseGrant(); + message.authorization = + object.authorization !== undefined && object.authorization !== null + ? any_1.Any.fromPartial(object.authorization) + : undefined; + message.expiration = + object.expiration !== undefined && object.expiration !== null + ? timestamp_1.Timestamp.fromPartial(object.expiration) + : undefined; + return message; + }, +}; +function createBaseGrantAuthorization() { + return { + granter: "", + grantee: "", + authorization: undefined, + expiration: undefined, + }; +} +exports.GrantAuthorization = { + encode(message, writer = _m0.Writer.create()) { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.authorization !== undefined) { + any_1.Any.encode(message.authorization, writer.uint32(26).fork()).ldelim(); + } + if (message.expiration !== undefined) { + timestamp_1.Timestamp.encode(message.expiration, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.authorization = any_1.Any.decode(reader, reader.uint32()); + break; + case 4: + message.expiration = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + granter: (0, helpers_1.isSet)(object.granter) ? String(object.granter) : "", + grantee: (0, helpers_1.isSet)(object.grantee) ? String(object.grantee) : "", + authorization: (0, helpers_1.isSet)(object.authorization) ? any_1.Any.fromJSON(object.authorization) : undefined, + expiration: (0, helpers_1.isSet)(object.expiration) ? (0, helpers_1.fromJsonTimestamp)(object.expiration) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.authorization !== undefined && + (obj.authorization = message.authorization ? any_1.Any.toJSON(message.authorization) : undefined); + message.expiration !== undefined && (obj.expiration = (0, helpers_1.fromTimestamp)(message.expiration).toISOString()); + return obj; + }, + fromPartial(object) { + const message = createBaseGrantAuthorization(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.authorization = + object.authorization !== undefined && object.authorization !== null + ? any_1.Any.fromPartial(object.authorization) + : undefined; + message.expiration = + object.expiration !== undefined && object.expiration !== null + ? timestamp_1.Timestamp.fromPartial(object.expiration) + : undefined; + return message; + }, +}; +//# sourceMappingURL=authz.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/authz/v1beta1/query.js": +/*!*****************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/authz/v1beta1/query.js ***! + \*****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QueryGranteeGrantsResponse = exports.QueryGranteeGrantsRequest = exports.QueryGranterGrantsResponse = exports.QueryGranterGrantsRequest = exports.QueryGrantsResponse = exports.QueryGrantsRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const pagination_1 = __webpack_require__(/*! ../../base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const authz_1 = __webpack_require__(/*! ./authz */ "./node_modules/cosmjs-types/cosmos/authz/v1beta1/authz.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.authz.v1beta1"; +function createBaseQueryGrantsRequest() { + return { + granter: "", + grantee: "", + msgTypeUrl: "", + pagination: undefined, + }; +} +exports.QueryGrantsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGrantsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.msgTypeUrl = reader.string(); + break; + case 4: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + granter: (0, helpers_1.isSet)(object.granter) ? String(object.granter) : "", + grantee: (0, helpers_1.isSet)(object.grantee) ? String(object.grantee) : "", + msgTypeUrl: (0, helpers_1.isSet)(object.msgTypeUrl) ? String(object.msgTypeUrl) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.msgTypeUrl !== undefined && (obj.msgTypeUrl = message.msgTypeUrl); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryGrantsRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryGrantsResponse() { + return { + grants: [], + pagination: undefined, + }; +} +exports.QueryGrantsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.grants) { + authz_1.Grant.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGrantsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(authz_1.Grant.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + grants: Array.isArray(object?.grants) ? object.grants.map((e) => authz_1.Grant.fromJSON(e)) : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => (e ? authz_1.Grant.toJSON(e) : undefined)); + } + else { + obj.grants = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryGrantsResponse(); + message.grants = object.grants?.map((e) => authz_1.Grant.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryGranterGrantsRequest() { + return { + granter: "", + pagination: undefined, + }; +} +exports.QueryGranterGrantsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranterGrantsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + granter: (0, helpers_1.isSet)(object.granter) ? String(object.granter) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryGranterGrantsRequest(); + message.granter = object.granter ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryGranterGrantsResponse() { + return { + grants: [], + pagination: undefined, + }; +} +exports.QueryGranterGrantsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.grants) { + authz_1.GrantAuthorization.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranterGrantsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(authz_1.GrantAuthorization.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + grants: Array.isArray(object?.grants) + ? object.grants.map((e) => authz_1.GrantAuthorization.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => (e ? authz_1.GrantAuthorization.toJSON(e) : undefined)); + } + else { + obj.grants = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryGranterGrantsResponse(); + message.grants = object.grants?.map((e) => authz_1.GrantAuthorization.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryGranteeGrantsRequest() { + return { + grantee: "", + pagination: undefined, + }; +} +exports.QueryGranteeGrantsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranteeGrantsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grantee = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + grantee: (0, helpers_1.isSet)(object.grantee) ? String(object.grantee) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.grantee !== undefined && (obj.grantee = message.grantee); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryGranteeGrantsRequest(); + message.grantee = object.grantee ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryGranteeGrantsResponse() { + return { + grants: [], + pagination: undefined, + }; +} +exports.QueryGranteeGrantsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.grants) { + authz_1.GrantAuthorization.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranteeGrantsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(authz_1.GrantAuthorization.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + grants: Array.isArray(object?.grants) + ? object.grants.map((e) => authz_1.GrantAuthorization.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => (e ? authz_1.GrantAuthorization.toJSON(e) : undefined)); + } + else { + obj.grants = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryGranteeGrantsResponse(); + message.grants = object.grants?.map((e) => authz_1.GrantAuthorization.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Grants = this.Grants.bind(this); + this.GranterGrants = this.GranterGrants.bind(this); + this.GranteeGrants = this.GranteeGrants.bind(this); + } + Grants(request) { + const data = exports.QueryGrantsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.authz.v1beta1.Query", "Grants", data); + return promise.then((data) => exports.QueryGrantsResponse.decode(new _m0.Reader(data))); + } + GranterGrants(request) { + const data = exports.QueryGranterGrantsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.authz.v1beta1.Query", "GranterGrants", data); + return promise.then((data) => exports.QueryGranterGrantsResponse.decode(new _m0.Reader(data))); + } + GranteeGrants(request) { + const data = exports.QueryGranteeGrantsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.authz.v1beta1.Query", "GranteeGrants", data); + return promise.then((data) => exports.QueryGranteeGrantsResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/authz/v1beta1/tx.js": +/*!**************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/authz/v1beta1/tx.js ***! + \**************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MsgClientImpl = exports.MsgRevokeResponse = exports.MsgRevoke = exports.MsgGrantResponse = exports.MsgExec = exports.MsgExecResponse = exports.MsgGrant = exports.protobufPackage = void 0; +/* eslint-disable */ +const authz_1 = __webpack_require__(/*! ./authz */ "./node_modules/cosmjs-types/cosmos/authz/v1beta1/authz.js"); +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.authz.v1beta1"; +function createBaseMsgGrant() { + return { + granter: "", + grantee: "", + grant: undefined, + }; +} +exports.MsgGrant = { + encode(message, writer = _m0.Writer.create()) { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.grant !== undefined) { + authz_1.Grant.encode(message.grant, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.grant = authz_1.Grant.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + granter: (0, helpers_1.isSet)(object.granter) ? String(object.granter) : "", + grantee: (0, helpers_1.isSet)(object.grantee) ? String(object.grantee) : "", + grant: (0, helpers_1.isSet)(object.grant) ? authz_1.Grant.fromJSON(object.grant) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.grant !== undefined && (obj.grant = message.grant ? authz_1.Grant.toJSON(message.grant) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgGrant(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.grant = + object.grant !== undefined && object.grant !== null ? authz_1.Grant.fromPartial(object.grant) : undefined; + return message; + }, +}; +function createBaseMsgExecResponse() { + return { + results: [], + }; +} +exports.MsgExecResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.results) { + writer.uint32(10).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.results.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + results: Array.isArray(object?.results) ? object.results.map((e) => (0, helpers_1.bytesFromBase64)(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.results) { + obj.results = message.results.map((e) => (0, helpers_1.base64FromBytes)(e !== undefined ? e : new Uint8Array())); + } + else { + obj.results = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map((e) => e) || []; + return message; + }, +}; +function createBaseMsgExec() { + return { + grantee: "", + msgs: [], + }; +} +exports.MsgExec = { + encode(message, writer = _m0.Writer.create()) { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + any_1.Any.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grantee = reader.string(); + break; + case 2: + message.msgs.push(any_1.Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + grantee: (0, helpers_1.isSet)(object.grantee) ? String(object.grantee) : "", + msgs: Array.isArray(object?.msgs) ? object.msgs.map((e) => any_1.Any.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.grantee !== undefined && (obj.grantee = message.grantee); + if (message.msgs) { + obj.msgs = message.msgs.map((e) => (e ? any_1.Any.toJSON(e) : undefined)); + } + else { + obj.msgs = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseMsgExec(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map((e) => any_1.Any.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgGrantResponse() { + return {}; +} +exports.MsgGrantResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgGrantResponse(); + return message; + }, +}; +function createBaseMsgRevoke() { + return { + granter: "", + grantee: "", + msgTypeUrl: "", + }; +} +exports.MsgRevoke = { + encode(message, writer = _m0.Writer.create()) { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevoke(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.msgTypeUrl = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + granter: (0, helpers_1.isSet)(object.granter) ? String(object.granter) : "", + grantee: (0, helpers_1.isSet)(object.grantee) ? String(object.grantee) : "", + msgTypeUrl: (0, helpers_1.isSet)(object.msgTypeUrl) ? String(object.msgTypeUrl) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.msgTypeUrl !== undefined && (obj.msgTypeUrl = message.msgTypeUrl); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgRevoke(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, +}; +function createBaseMsgRevokeResponse() { + return {}; +} +exports.MsgRevokeResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgRevokeResponse(); + return message; + }, +}; +class MsgClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Grant = this.Grant.bind(this); + this.Exec = this.Exec.bind(this); + this.Revoke = this.Revoke.bind(this); + } + Grant(request) { + const data = exports.MsgGrant.encode(request).finish(); + const promise = this.rpc.request("cosmos.authz.v1beta1.Msg", "Grant", data); + return promise.then((data) => exports.MsgGrantResponse.decode(new _m0.Reader(data))); + } + Exec(request) { + const data = exports.MsgExec.encode(request).finish(); + const promise = this.rpc.request("cosmos.authz.v1beta1.Msg", "Exec", data); + return promise.then((data) => exports.MsgExecResponse.decode(new _m0.Reader(data))); + } + Revoke(request) { + const data = exports.MsgRevoke.encode(request).finish(); + const promise = this.rpc.request("cosmos.authz.v1beta1.Msg", "Revoke", data); + return promise.then((data) => exports.MsgRevokeResponse.decode(new _m0.Reader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +//# sourceMappingURL=tx.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/bank/v1beta1/bank.js": +/*!***************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/bank/v1beta1/bank.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Metadata = exports.DenomUnit = exports.Supply = exports.Output = exports.Input = exports.SendEnabled = exports.Params = exports.protobufPackage = void 0; +/* eslint-disable */ +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.bank.v1beta1"; +function createBaseParams() { + return { + sendEnabled: [], + defaultSendEnabled: false, + }; +} +exports.Params = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.sendEnabled) { + exports.SendEnabled.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.defaultSendEnabled === true) { + writer.uint32(16).bool(message.defaultSendEnabled); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sendEnabled.push(exports.SendEnabled.decode(reader, reader.uint32())); + break; + case 2: + message.defaultSendEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + sendEnabled: Array.isArray(object?.sendEnabled) + ? object.sendEnabled.map((e) => exports.SendEnabled.fromJSON(e)) + : [], + defaultSendEnabled: (0, helpers_1.isSet)(object.defaultSendEnabled) ? Boolean(object.defaultSendEnabled) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sendEnabled) { + obj.sendEnabled = message.sendEnabled.map((e) => (e ? exports.SendEnabled.toJSON(e) : undefined)); + } + else { + obj.sendEnabled = []; + } + message.defaultSendEnabled !== undefined && (obj.defaultSendEnabled = message.defaultSendEnabled); + return obj; + }, + fromPartial(object) { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled?.map((e) => exports.SendEnabled.fromPartial(e)) || []; + message.defaultSendEnabled = object.defaultSendEnabled ?? false; + return message; + }, +}; +function createBaseSendEnabled() { + return { + denom: "", + enabled: false, + }; +} +exports.SendEnabled = { + encode(message, writer = _m0.Writer.create()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled === true) { + writer.uint32(16).bool(message.enabled); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.enabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + denom: (0, helpers_1.isSet)(object.denom) ? String(object.denom) : "", + enabled: (0, helpers_1.isSet)(object.enabled) ? Boolean(object.enabled) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.enabled !== undefined && (obj.enabled = message.enabled); + return obj; + }, + fromPartial(object) { + const message = createBaseSendEnabled(); + message.denom = object.denom ?? ""; + message.enabled = object.enabled ?? false; + return message; + }, +}; +function createBaseInput() { + return { + address: "", + coins: [], + }; +} +exports.Input = { + encode(message, writer = _m0.Writer.create()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + coin_1.Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.coins.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + address: (0, helpers_1.isSet)(object.address) ? String(object.address) : "", + coins: Array.isArray(object?.coins) ? object.coins.map((e) => coin_1.Coin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && (obj.address = message.address); + if (message.coins) { + obj.coins = message.coins.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.coins = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseInput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseOutput() { + return { + address: "", + coins: [], + }; +} +exports.Output = { + encode(message, writer = _m0.Writer.create()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + coin_1.Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOutput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.coins.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + address: (0, helpers_1.isSet)(object.address) ? String(object.address) : "", + coins: Array.isArray(object?.coins) ? object.coins.map((e) => coin_1.Coin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && (obj.address = message.address); + if (message.coins) { + obj.coins = message.coins.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.coins = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseOutput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseSupply() { + return { + total: [], + }; +} +exports.Supply = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.total) { + coin_1.Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSupply(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.total.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + total: Array.isArray(object?.total) ? object.total.map((e) => coin_1.Coin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.total) { + obj.total = message.total.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.total = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseSupply(); + message.total = object.total?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseDenomUnit() { + return { + denom: "", + exponent: 0, + aliases: [], + }; +} +exports.DenomUnit = { + encode(message, writer = _m0.Writer.create()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.exponent !== 0) { + writer.uint32(16).uint32(message.exponent); + } + for (const v of message.aliases) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomUnit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.exponent = reader.uint32(); + break; + case 3: + message.aliases.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + denom: (0, helpers_1.isSet)(object.denom) ? String(object.denom) : "", + exponent: (0, helpers_1.isSet)(object.exponent) ? Number(object.exponent) : 0, + aliases: Array.isArray(object?.aliases) ? object.aliases.map((e) => String(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.exponent !== undefined && (obj.exponent = Math.round(message.exponent)); + if (message.aliases) { + obj.aliases = message.aliases.map((e) => e); + } + else { + obj.aliases = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseDenomUnit(); + message.denom = object.denom ?? ""; + message.exponent = object.exponent ?? 0; + message.aliases = object.aliases?.map((e) => e) || []; + return message; + }, +}; +function createBaseMetadata() { + return { + description: "", + denomUnits: [], + base: "", + display: "", + name: "", + symbol: "", + }; +} +exports.Metadata = { + encode(message, writer = _m0.Writer.create()) { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + for (const v of message.denomUnits) { + exports.DenomUnit.encode(v, writer.uint32(18).fork()).ldelim(); + } + if (message.base !== "") { + writer.uint32(26).string(message.base); + } + if (message.display !== "") { + writer.uint32(34).string(message.display); + } + if (message.name !== "") { + writer.uint32(42).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(50).string(message.symbol); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.description = reader.string(); + break; + case 2: + message.denomUnits.push(exports.DenomUnit.decode(reader, reader.uint32())); + break; + case 3: + message.base = reader.string(); + break; + case 4: + message.display = reader.string(); + break; + case 5: + message.name = reader.string(); + break; + case 6: + message.symbol = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + description: (0, helpers_1.isSet)(object.description) ? String(object.description) : "", + denomUnits: Array.isArray(object?.denomUnits) + ? object.denomUnits.map((e) => exports.DenomUnit.fromJSON(e)) + : [], + base: (0, helpers_1.isSet)(object.base) ? String(object.base) : "", + display: (0, helpers_1.isSet)(object.display) ? String(object.display) : "", + name: (0, helpers_1.isSet)(object.name) ? String(object.name) : "", + symbol: (0, helpers_1.isSet)(object.symbol) ? String(object.symbol) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.description !== undefined && (obj.description = message.description); + if (message.denomUnits) { + obj.denomUnits = message.denomUnits.map((e) => (e ? exports.DenomUnit.toJSON(e) : undefined)); + } + else { + obj.denomUnits = []; + } + message.base !== undefined && (obj.base = message.base); + message.display !== undefined && (obj.display = message.display); + message.name !== undefined && (obj.name = message.name); + message.symbol !== undefined && (obj.symbol = message.symbol); + return obj; + }, + fromPartial(object) { + const message = createBaseMetadata(); + message.description = object.description ?? ""; + message.denomUnits = object.denomUnits?.map((e) => exports.DenomUnit.fromPartial(e)) || []; + message.base = object.base ?? ""; + message.display = object.display ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + return message; + }, +}; +//# sourceMappingURL=bank.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/bank/v1beta1/query.js": +/*!****************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/bank/v1beta1/query.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QueryDenomMetadataResponse = exports.QueryDenomMetadataRequest = exports.QueryDenomsMetadataResponse = exports.QueryDenomsMetadataRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.QuerySupplyOfResponse = exports.QuerySupplyOfRequest = exports.QueryTotalSupplyResponse = exports.QueryTotalSupplyRequest = exports.QuerySpendableBalancesResponse = exports.QuerySpendableBalancesRequest = exports.QueryAllBalancesResponse = exports.QueryAllBalancesRequest = exports.QueryBalanceResponse = exports.QueryBalanceRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const pagination_1 = __webpack_require__(/*! ../../base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const bank_1 = __webpack_require__(/*! ./bank */ "./node_modules/cosmjs-types/cosmos/bank/v1beta1/bank.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.bank.v1beta1"; +function createBaseQueryBalanceRequest() { + return { + address: "", + denom: "", + }; +} +exports.QueryBalanceRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + address: (0, helpers_1.isSet)(object.address) ? String(object.address) : "", + denom: (0, helpers_1.isSet)(object.denom) ? String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && (obj.address = message.address); + message.denom !== undefined && (obj.denom = message.denom); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryBalanceRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryBalanceResponse() { + return { + balance: undefined, + }; +} +exports.QueryBalanceResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.balance !== undefined) { + coin_1.Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balance = coin_1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + balance: (0, helpers_1.isSet)(object.balance) ? coin_1.Coin.fromJSON(object.balance) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.balance !== undefined && + (obj.balance = message.balance ? coin_1.Coin.toJSON(message.balance) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryBalanceResponse(); + message.balance = + object.balance !== undefined && object.balance !== null ? coin_1.Coin.fromPartial(object.balance) : undefined; + return message; + }, +}; +function createBaseQueryAllBalancesRequest() { + return { + address: "", + pagination: undefined, + }; +} +exports.QueryAllBalancesRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + address: (0, helpers_1.isSet)(object.address) ? String(object.address) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAllBalancesRequest(); + message.address = object.address ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryAllBalancesResponse() { + return { + balances: [], + pagination: undefined, + }; +} +exports.QueryAllBalancesResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.balances) { + coin_1.Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balances.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + balances: Array.isArray(object?.balances) ? object.balances.map((e) => coin_1.Coin.fromJSON(e)) : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.balances) { + obj.balances = message.balances.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.balances = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAllBalancesResponse(); + message.balances = object.balances?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQuerySpendableBalancesRequest() { + return { + address: "", + pagination: undefined, + }; +} +exports.QuerySpendableBalancesRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + address: (0, helpers_1.isSet)(object.address) ? String(object.address) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQuerySpendableBalancesRequest(); + message.address = object.address ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQuerySpendableBalancesResponse() { + return { + balances: [], + pagination: undefined, + }; +} +exports.QuerySpendableBalancesResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.balances) { + coin_1.Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balances.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + balances: Array.isArray(object?.balances) ? object.balances.map((e) => coin_1.Coin.fromJSON(e)) : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.balances) { + obj.balances = message.balances.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.balances = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQuerySpendableBalancesResponse(); + message.balances = object.balances?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryTotalSupplyRequest() { + return { + pagination: undefined, + }; +} +exports.QueryTotalSupplyRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryTotalSupplyRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryTotalSupplyResponse() { + return { + supply: [], + pagination: undefined, + }; +} +exports.QueryTotalSupplyResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.supply) { + coin_1.Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.supply.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + supply: Array.isArray(object?.supply) ? object.supply.map((e) => coin_1.Coin.fromJSON(e)) : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.supply) { + obj.supply = message.supply.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.supply = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryTotalSupplyResponse(); + message.supply = object.supply?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQuerySupplyOfRequest() { + return { + denom: "", + }; +} +exports.QuerySupplyOfRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + denom: (0, helpers_1.isSet)(object.denom) ? String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.denom !== undefined && (obj.denom = message.denom); + return obj; + }, + fromPartial(object) { + const message = createBaseQuerySupplyOfRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQuerySupplyOfResponse() { + return { + amount: undefined, + }; +} +exports.QuerySupplyOfResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.amount !== undefined) { + coin_1.Coin.encode(message.amount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount = coin_1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + amount: (0, helpers_1.isSet)(object.amount) ? coin_1.Coin.fromJSON(object.amount) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.amount !== undefined && (obj.amount = message.amount ? coin_1.Coin.toJSON(message.amount) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQuerySupplyOfResponse(); + message.amount = + object.amount !== undefined && object.amount !== null ? coin_1.Coin.fromPartial(object.amount) : undefined; + return message; + }, +}; +function createBaseQueryParamsRequest() { + return {}; +} +exports.QueryParamsRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { + params: undefined, + }; +} +exports.QueryParamsResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.params !== undefined) { + bank_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = bank_1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + params: (0, helpers_1.isSet)(object.params) ? bank_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.params !== undefined && (obj.params = message.params ? bank_1.Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null ? bank_1.Params.fromPartial(object.params) : undefined; + return message; + }, +}; +function createBaseQueryDenomsMetadataRequest() { + return { + pagination: undefined, + }; +} +exports.QueryDenomsMetadataRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDenomsMetadataRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryDenomsMetadataResponse() { + return { + metadatas: [], + pagination: undefined, + }; +} +exports.QueryDenomsMetadataResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.metadatas) { + bank_1.Metadata.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metadatas.push(bank_1.Metadata.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + metadatas: Array.isArray(object?.metadatas) + ? object.metadatas.map((e) => bank_1.Metadata.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.metadatas) { + obj.metadatas = message.metadatas.map((e) => (e ? bank_1.Metadata.toJSON(e) : undefined)); + } + else { + obj.metadatas = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDenomsMetadataResponse(); + message.metadatas = object.metadatas?.map((e) => bank_1.Metadata.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryDenomMetadataRequest() { + return { + denom: "", + }; +} +exports.QueryDenomMetadataRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + denom: (0, helpers_1.isSet)(object.denom) ? String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.denom !== undefined && (obj.denom = message.denom); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDenomMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryDenomMetadataResponse() { + return { + metadata: undefined, + }; +} +exports.QueryDenomMetadataResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.metadata !== undefined) { + bank_1.Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metadata = bank_1.Metadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + metadata: (0, helpers_1.isSet)(object.metadata) ? bank_1.Metadata.fromJSON(object.metadata) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.metadata !== undefined && + (obj.metadata = message.metadata ? bank_1.Metadata.toJSON(message.metadata) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDenomMetadataResponse(); + message.metadata = + object.metadata !== undefined && object.metadata !== null + ? bank_1.Metadata.fromPartial(object.metadata) + : undefined; + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Balance = this.Balance.bind(this); + this.AllBalances = this.AllBalances.bind(this); + this.SpendableBalances = this.SpendableBalances.bind(this); + this.TotalSupply = this.TotalSupply.bind(this); + this.SupplyOf = this.SupplyOf.bind(this); + this.Params = this.Params.bind(this); + this.DenomMetadata = this.DenomMetadata.bind(this); + this.DenomsMetadata = this.DenomsMetadata.bind(this); + } + Balance(request) { + const data = exports.QueryBalanceRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "Balance", data); + return promise.then((data) => exports.QueryBalanceResponse.decode(new _m0.Reader(data))); + } + AllBalances(request) { + const data = exports.QueryAllBalancesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "AllBalances", data); + return promise.then((data) => exports.QueryAllBalancesResponse.decode(new _m0.Reader(data))); + } + SpendableBalances(request) { + const data = exports.QuerySpendableBalancesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "SpendableBalances", data); + return promise.then((data) => exports.QuerySpendableBalancesResponse.decode(new _m0.Reader(data))); + } + TotalSupply(request = { + pagination: undefined, + }) { + const data = exports.QueryTotalSupplyRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "TotalSupply", data); + return promise.then((data) => exports.QueryTotalSupplyResponse.decode(new _m0.Reader(data))); + } + SupplyOf(request) { + const data = exports.QuerySupplyOfRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "SupplyOf", data); + return promise.then((data) => exports.QuerySupplyOfResponse.decode(new _m0.Reader(data))); + } + Params(request = {}) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new _m0.Reader(data))); + } + DenomMetadata(request) { + const data = exports.QueryDenomMetadataRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomMetadata", data); + return promise.then((data) => exports.QueryDenomMetadataResponse.decode(new _m0.Reader(data))); + } + DenomsMetadata(request = { + pagination: undefined, + }) { + const data = exports.QueryDenomsMetadataRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomsMetadata", data); + return promise.then((data) => exports.QueryDenomsMetadataResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/bank/v1beta1/tx.js": +/*!*************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/bank/v1beta1/tx.js ***! + \*************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MsgClientImpl = exports.MsgMultiSendResponse = exports.MsgMultiSend = exports.MsgSendResponse = exports.MsgSend = exports.protobufPackage = void 0; +/* eslint-disable */ +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const bank_1 = __webpack_require__(/*! ./bank */ "./node_modules/cosmjs-types/cosmos/bank/v1beta1/bank.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.bank.v1beta1"; +function createBaseMsgSend() { + return { + fromAddress: "", + toAddress: "", + amount: [], + }; +} +exports.MsgSend = { + encode(message, writer = _m0.Writer.create()) { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + coin_1.Coin.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fromAddress = reader.string(); + break; + case 2: + message.toAddress = reader.string(); + break; + case 3: + message.amount.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + fromAddress: (0, helpers_1.isSet)(object.fromAddress) ? String(object.fromAddress) : "", + toAddress: (0, helpers_1.isSet)(object.toAddress) ? String(object.toAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e) => coin_1.Coin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); + message.toAddress !== undefined && (obj.toAddress = message.toAddress); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.amount = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseMsgSend(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgSendResponse() { + return {}; +} +exports.MsgSendResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgSendResponse(); + return message; + }, +}; +function createBaseMsgMultiSend() { + return { + inputs: [], + outputs: [], + }; +} +exports.MsgMultiSend = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.inputs) { + bank_1.Input.encode(v, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.outputs) { + bank_1.Output.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inputs.push(bank_1.Input.decode(reader, reader.uint32())); + break; + case 2: + message.outputs.push(bank_1.Output.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + inputs: Array.isArray(object?.inputs) ? object.inputs.map((e) => bank_1.Input.fromJSON(e)) : [], + outputs: Array.isArray(object?.outputs) ? object.outputs.map((e) => bank_1.Output.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputs) { + obj.inputs = message.inputs.map((e) => (e ? bank_1.Input.toJSON(e) : undefined)); + } + else { + obj.inputs = []; + } + if (message.outputs) { + obj.outputs = message.outputs.map((e) => (e ? bank_1.Output.toJSON(e) : undefined)); + } + else { + obj.outputs = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseMsgMultiSend(); + message.inputs = object.inputs?.map((e) => bank_1.Input.fromPartial(e)) || []; + message.outputs = object.outputs?.map((e) => bank_1.Output.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgMultiSendResponse() { + return {}; +} +exports.MsgMultiSendResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgMultiSendResponse(); + return message; + }, +}; +class MsgClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Send = this.Send.bind(this); + this.MultiSend = this.MultiSend.bind(this); + } + Send(request) { + const data = exports.MsgSend.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "Send", data); + return promise.then((data) => exports.MsgSendResponse.decode(new _m0.Reader(data))); + } + MultiSend(request) { + const data = exports.MsgMultiSend.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "MultiSend", data); + return promise.then((data) => exports.MsgMultiSendResponse.decode(new _m0.Reader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +//# sourceMappingURL=tx.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/base/abci/v1beta1/abci.js": +/*!********************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/base/abci/v1beta1/abci.js ***! + \********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SearchTxsResult = exports.TxMsgData = exports.MsgData = exports.SimulationResponse = exports.Result = exports.GasInfo = exports.Attribute = exports.StringEvent = exports.ABCIMessageLog = exports.TxResponse = exports.protobufPackage = void 0; +/* eslint-disable */ +const any_1 = __webpack_require__(/*! ../../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const types_1 = __webpack_require__(/*! ../../../../tendermint/abci/types */ "./node_modules/cosmjs-types/tendermint/abci/types.js"); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "cosmos.base.abci.v1beta1"; +function createBaseTxResponse() { + return { + height: helpers_1.Long.ZERO, + txhash: "", + codespace: "", + code: 0, + data: "", + rawLog: "", + logs: [], + info: "", + gasWanted: helpers_1.Long.ZERO, + gasUsed: helpers_1.Long.ZERO, + tx: undefined, + timestamp: "", + events: [], + }; +} +exports.TxResponse = { + encode(message, writer = _m0.Writer.create()) { + if (!message.height.isZero()) { + writer.uint32(8).int64(message.height); + } + if (message.txhash !== "") { + writer.uint32(18).string(message.txhash); + } + if (message.codespace !== "") { + writer.uint32(26).string(message.codespace); + } + if (message.code !== 0) { + writer.uint32(32).uint32(message.code); + } + if (message.data !== "") { + writer.uint32(42).string(message.data); + } + if (message.rawLog !== "") { + writer.uint32(50).string(message.rawLog); + } + for (const v of message.logs) { + exports.ABCIMessageLog.encode(v, writer.uint32(58).fork()).ldelim(); + } + if (message.info !== "") { + writer.uint32(66).string(message.info); + } + if (!message.gasWanted.isZero()) { + writer.uint32(72).int64(message.gasWanted); + } + if (!message.gasUsed.isZero()) { + writer.uint32(80).int64(message.gasUsed); + } + if (message.tx !== undefined) { + any_1.Any.encode(message.tx, writer.uint32(90).fork()).ldelim(); + } + if (message.timestamp !== "") { + writer.uint32(98).string(message.timestamp); + } + for (const v of message.events) { + types_1.Event.encode(v, writer.uint32(106).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.txhash = reader.string(); + break; + case 3: + message.codespace = reader.string(); + break; + case 4: + message.code = reader.uint32(); + break; + case 5: + message.data = reader.string(); + break; + case 6: + message.rawLog = reader.string(); + break; + case 7: + message.logs.push(exports.ABCIMessageLog.decode(reader, reader.uint32())); + break; + case 8: + message.info = reader.string(); + break; + case 9: + message.gasWanted = reader.int64(); + break; + case 10: + message.gasUsed = reader.int64(); + break; + case 11: + message.tx = any_1.Any.decode(reader, reader.uint32()); + break; + case 12: + message.timestamp = reader.string(); + break; + case 13: + message.events.push(types_1.Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + txhash: (0, helpers_1.isSet)(object.txhash) ? String(object.txhash) : "", + codespace: (0, helpers_1.isSet)(object.codespace) ? String(object.codespace) : "", + code: (0, helpers_1.isSet)(object.code) ? Number(object.code) : 0, + data: (0, helpers_1.isSet)(object.data) ? String(object.data) : "", + rawLog: (0, helpers_1.isSet)(object.rawLog) ? String(object.rawLog) : "", + logs: Array.isArray(object?.logs) ? object.logs.map((e) => exports.ABCIMessageLog.fromJSON(e)) : [], + info: (0, helpers_1.isSet)(object.info) ? String(object.info) : "", + gasWanted: (0, helpers_1.isSet)(object.gasWanted) ? helpers_1.Long.fromValue(object.gasWanted) : helpers_1.Long.ZERO, + gasUsed: (0, helpers_1.isSet)(object.gasUsed) ? helpers_1.Long.fromValue(object.gasUsed) : helpers_1.Long.ZERO, + tx: (0, helpers_1.isSet)(object.tx) ? any_1.Any.fromJSON(object.tx) : undefined, + timestamp: (0, helpers_1.isSet)(object.timestamp) ? String(object.timestamp) : "", + events: Array.isArray(object?.events) ? object.events.map((e) => types_1.Event.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + message.txhash !== undefined && (obj.txhash = message.txhash); + message.codespace !== undefined && (obj.codespace = message.codespace); + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && (obj.data = message.data); + message.rawLog !== undefined && (obj.rawLog = message.rawLog); + if (message.logs) { + obj.logs = message.logs.map((e) => (e ? exports.ABCIMessageLog.toJSON(e) : undefined)); + } + else { + obj.logs = []; + } + message.info !== undefined && (obj.info = message.info); + message.gasWanted !== undefined && (obj.gasWanted = (message.gasWanted || helpers_1.Long.ZERO).toString()); + message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || helpers_1.Long.ZERO).toString()); + message.tx !== undefined && (obj.tx = message.tx ? any_1.Any.toJSON(message.tx) : undefined); + message.timestamp !== undefined && (obj.timestamp = message.timestamp); + if (message.events) { + obj.events = message.events.map((e) => (e ? types_1.Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseTxResponse(); + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + message.txhash = object.txhash ?? ""; + message.codespace = object.codespace ?? ""; + message.code = object.code ?? 0; + message.data = object.data ?? ""; + message.rawLog = object.rawLog ?? ""; + message.logs = object.logs?.map((e) => exports.ABCIMessageLog.fromPartial(e)) || []; + message.info = object.info ?? ""; + message.gasWanted = + object.gasWanted !== undefined && object.gasWanted !== null + ? helpers_1.Long.fromValue(object.gasWanted) + : helpers_1.Long.ZERO; + message.gasUsed = + object.gasUsed !== undefined && object.gasUsed !== null ? helpers_1.Long.fromValue(object.gasUsed) : helpers_1.Long.ZERO; + message.tx = object.tx !== undefined && object.tx !== null ? any_1.Any.fromPartial(object.tx) : undefined; + message.timestamp = object.timestamp ?? ""; + message.events = object.events?.map((e) => types_1.Event.fromPartial(e)) || []; + return message; + }, +}; +function createBaseABCIMessageLog() { + return { + msgIndex: 0, + log: "", + events: [], + }; +} +exports.ABCIMessageLog = { + encode(message, writer = _m0.Writer.create()) { + if (message.msgIndex !== 0) { + writer.uint32(8).uint32(message.msgIndex); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + exports.StringEvent.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIMessageLog(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msgIndex = reader.uint32(); + break; + case 2: + message.log = reader.string(); + break; + case 3: + message.events.push(exports.StringEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + msgIndex: (0, helpers_1.isSet)(object.msgIndex) ? Number(object.msgIndex) : 0, + log: (0, helpers_1.isSet)(object.log) ? String(object.log) : "", + events: Array.isArray(object?.events) ? object.events.map((e) => exports.StringEvent.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.msgIndex !== undefined && (obj.msgIndex = Math.round(message.msgIndex)); + message.log !== undefined && (obj.log = message.log); + if (message.events) { + obj.events = message.events.map((e) => (e ? exports.StringEvent.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseABCIMessageLog(); + message.msgIndex = object.msgIndex ?? 0; + message.log = object.log ?? ""; + message.events = object.events?.map((e) => exports.StringEvent.fromPartial(e)) || []; + return message; + }, +}; +function createBaseStringEvent() { + return { + type: "", + attributes: [], + }; +} +exports.StringEvent = { + encode(message, writer = _m0.Writer.create()) { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + exports.Attribute.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.attributes.push(exports.Attribute.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + type: (0, helpers_1.isSet)(object.type) ? String(object.type) : "", + attributes: Array.isArray(object?.attributes) + ? object.attributes.map((e) => exports.Attribute.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && (obj.type = message.type); + if (message.attributes) { + obj.attributes = message.attributes.map((e) => (e ? exports.Attribute.toJSON(e) : undefined)); + } + else { + obj.attributes = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseStringEvent(); + message.type = object.type ?? ""; + message.attributes = object.attributes?.map((e) => exports.Attribute.fromPartial(e)) || []; + return message; + }, +}; +function createBaseAttribute() { + return { + key: "", + value: "", + }; +} +exports.Attribute = { + encode(message, writer = _m0.Writer.create()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? String(object.key) : "", + value: (0, helpers_1.isSet)(object.value) ? String(object.value) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + fromPartial(object) { + const message = createBaseAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; +function createBaseGasInfo() { + return { + gasWanted: helpers_1.Long.UZERO, + gasUsed: helpers_1.Long.UZERO, + }; +} +exports.GasInfo = { + encode(message, writer = _m0.Writer.create()) { + if (!message.gasWanted.isZero()) { + writer.uint32(8).uint64(message.gasWanted); + } + if (!message.gasUsed.isZero()) { + writer.uint32(16).uint64(message.gasUsed); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGasInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gasWanted = reader.uint64(); + break; + case 2: + message.gasUsed = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + gasWanted: (0, helpers_1.isSet)(object.gasWanted) ? helpers_1.Long.fromValue(object.gasWanted) : helpers_1.Long.UZERO, + gasUsed: (0, helpers_1.isSet)(object.gasUsed) ? helpers_1.Long.fromValue(object.gasUsed) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.gasWanted !== undefined && (obj.gasWanted = (message.gasWanted || helpers_1.Long.UZERO).toString()); + message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseGasInfo(); + message.gasWanted = + object.gasWanted !== undefined && object.gasWanted !== null + ? helpers_1.Long.fromValue(object.gasWanted) + : helpers_1.Long.UZERO; + message.gasUsed = + object.gasUsed !== undefined && object.gasUsed !== null ? helpers_1.Long.fromValue(object.gasUsed) : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseResult() { + return { + data: new Uint8Array(), + log: "", + events: [], + }; +} +exports.Result = { + encode(message, writer = _m0.Writer.create()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + types_1.Event.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + case 2: + message.log = reader.string(); + break; + case 3: + message.events.push(types_1.Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + data: (0, helpers_1.isSet)(object.data) ? (0, helpers_1.bytesFromBase64)(object.data) : new Uint8Array(), + log: (0, helpers_1.isSet)(object.log) ? String(object.log) : "", + events: Array.isArray(object?.events) ? object.events.map((e) => types_1.Event.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.data !== undefined && + (obj.data = (0, helpers_1.base64FromBytes)(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + if (message.events) { + obj.events = message.events.map((e) => (e ? types_1.Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseResult(); + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.events = object.events?.map((e) => types_1.Event.fromPartial(e)) || []; + return message; + }, +}; +function createBaseSimulationResponse() { + return { + gasInfo: undefined, + result: undefined, + }; +} +exports.SimulationResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.gasInfo !== undefined) { + exports.GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).ldelim(); + } + if (message.result !== undefined) { + exports.Result.encode(message.result, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gasInfo = exports.GasInfo.decode(reader, reader.uint32()); + break; + case 2: + message.result = exports.Result.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + gasInfo: (0, helpers_1.isSet)(object.gasInfo) ? exports.GasInfo.fromJSON(object.gasInfo) : undefined, + result: (0, helpers_1.isSet)(object.result) ? exports.Result.fromJSON(object.result) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.gasInfo !== undefined && + (obj.gasInfo = message.gasInfo ? exports.GasInfo.toJSON(message.gasInfo) : undefined); + message.result !== undefined && (obj.result = message.result ? exports.Result.toJSON(message.result) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseSimulationResponse(); + message.gasInfo = + object.gasInfo !== undefined && object.gasInfo !== null + ? exports.GasInfo.fromPartial(object.gasInfo) + : undefined; + message.result = + object.result !== undefined && object.result !== null ? exports.Result.fromPartial(object.result) : undefined; + return message; + }, +}; +function createBaseMsgData() { + return { + msgType: "", + data: new Uint8Array(), + }; +} +exports.MsgData = { + encode(message, writer = _m0.Writer.create()) { + if (message.msgType !== "") { + writer.uint32(10).string(message.msgType); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msgType = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + msgType: (0, helpers_1.isSet)(object.msgType) ? String(object.msgType) : "", + data: (0, helpers_1.isSet)(object.data) ? (0, helpers_1.bytesFromBase64)(object.data) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.msgType !== undefined && (obj.msgType = message.msgType); + message.data !== undefined && + (obj.data = (0, helpers_1.base64FromBytes)(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgData(); + message.msgType = object.msgType ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; +function createBaseTxMsgData() { + return { + data: [], + }; +} +exports.TxMsgData = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.data) { + exports.MsgData.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data.push(exports.MsgData.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + data: Array.isArray(object?.data) ? object.data.map((e) => exports.MsgData.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.data) { + obj.data = message.data.map((e) => (e ? exports.MsgData.toJSON(e) : undefined)); + } + else { + obj.data = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseTxMsgData(); + message.data = object.data?.map((e) => exports.MsgData.fromPartial(e)) || []; + return message; + }, +}; +function createBaseSearchTxsResult() { + return { + totalCount: helpers_1.Long.UZERO, + count: helpers_1.Long.UZERO, + pageNumber: helpers_1.Long.UZERO, + pageTotal: helpers_1.Long.UZERO, + limit: helpers_1.Long.UZERO, + txs: [], + }; +} +exports.SearchTxsResult = { + encode(message, writer = _m0.Writer.create()) { + if (!message.totalCount.isZero()) { + writer.uint32(8).uint64(message.totalCount); + } + if (!message.count.isZero()) { + writer.uint32(16).uint64(message.count); + } + if (!message.pageNumber.isZero()) { + writer.uint32(24).uint64(message.pageNumber); + } + if (!message.pageTotal.isZero()) { + writer.uint32(32).uint64(message.pageTotal); + } + if (!message.limit.isZero()) { + writer.uint32(40).uint64(message.limit); + } + for (const v of message.txs) { + exports.TxResponse.encode(v, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchTxsResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.totalCount = reader.uint64(); + break; + case 2: + message.count = reader.uint64(); + break; + case 3: + message.pageNumber = reader.uint64(); + break; + case 4: + message.pageTotal = reader.uint64(); + break; + case 5: + message.limit = reader.uint64(); + break; + case 6: + message.txs.push(exports.TxResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + totalCount: (0, helpers_1.isSet)(object.totalCount) ? helpers_1.Long.fromValue(object.totalCount) : helpers_1.Long.UZERO, + count: (0, helpers_1.isSet)(object.count) ? helpers_1.Long.fromValue(object.count) : helpers_1.Long.UZERO, + pageNumber: (0, helpers_1.isSet)(object.pageNumber) ? helpers_1.Long.fromValue(object.pageNumber) : helpers_1.Long.UZERO, + pageTotal: (0, helpers_1.isSet)(object.pageTotal) ? helpers_1.Long.fromValue(object.pageTotal) : helpers_1.Long.UZERO, + limit: (0, helpers_1.isSet)(object.limit) ? helpers_1.Long.fromValue(object.limit) : helpers_1.Long.UZERO, + txs: Array.isArray(object?.txs) ? object.txs.map((e) => exports.TxResponse.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.totalCount !== undefined && (obj.totalCount = (message.totalCount || helpers_1.Long.UZERO).toString()); + message.count !== undefined && (obj.count = (message.count || helpers_1.Long.UZERO).toString()); + message.pageNumber !== undefined && (obj.pageNumber = (message.pageNumber || helpers_1.Long.UZERO).toString()); + message.pageTotal !== undefined && (obj.pageTotal = (message.pageTotal || helpers_1.Long.UZERO).toString()); + message.limit !== undefined && (obj.limit = (message.limit || helpers_1.Long.UZERO).toString()); + if (message.txs) { + obj.txs = message.txs.map((e) => (e ? exports.TxResponse.toJSON(e) : undefined)); + } + else { + obj.txs = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseSearchTxsResult(); + message.totalCount = + object.totalCount !== undefined && object.totalCount !== null + ? helpers_1.Long.fromValue(object.totalCount) + : helpers_1.Long.UZERO; + message.count = + object.count !== undefined && object.count !== null ? helpers_1.Long.fromValue(object.count) : helpers_1.Long.UZERO; + message.pageNumber = + object.pageNumber !== undefined && object.pageNumber !== null + ? helpers_1.Long.fromValue(object.pageNumber) + : helpers_1.Long.UZERO; + message.pageTotal = + object.pageTotal !== undefined && object.pageTotal !== null + ? helpers_1.Long.fromValue(object.pageTotal) + : helpers_1.Long.UZERO; + message.limit = + object.limit !== undefined && object.limit !== null ? helpers_1.Long.fromValue(object.limit) : helpers_1.Long.UZERO; + message.txs = object.txs?.map((e) => exports.TxResponse.fromPartial(e)) || []; + return message; + }, +}; +//# sourceMappingURL=abci.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js": +/*!***************************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js ***! + \***************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PageResponse = exports.PageRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "cosmos.base.query.v1beta1"; +function createBasePageRequest() { + return { + key: new Uint8Array(), + offset: helpers_1.Long.UZERO, + limit: helpers_1.Long.UZERO, + countTotal: false, + reverse: false, + }; +} +exports.PageRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (!message.offset.isZero()) { + writer.uint32(16).uint64(message.offset); + } + if (!message.limit.isZero()) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal === true) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse === true) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.offset = reader.uint64(); + break; + case 3: + message.limit = reader.uint64(); + break; + case 4: + message.countTotal = reader.bool(); + break; + case 5: + message.reverse = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + offset: (0, helpers_1.isSet)(object.offset) ? helpers_1.Long.fromValue(object.offset) : helpers_1.Long.UZERO, + limit: (0, helpers_1.isSet)(object.limit) ? helpers_1.Long.fromValue(object.limit) : helpers_1.Long.UZERO, + countTotal: (0, helpers_1.isSet)(object.countTotal) ? Boolean(object.countTotal) : false, + reverse: (0, helpers_1.isSet)(object.reverse) ? Boolean(object.reverse) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + message.offset !== undefined && (obj.offset = (message.offset || helpers_1.Long.UZERO).toString()); + message.limit !== undefined && (obj.limit = (message.limit || helpers_1.Long.UZERO).toString()); + message.countTotal !== undefined && (obj.countTotal = message.countTotal); + message.reverse !== undefined && (obj.reverse = message.reverse); + return obj; + }, + fromPartial(object) { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(); + message.offset = + object.offset !== undefined && object.offset !== null ? helpers_1.Long.fromValue(object.offset) : helpers_1.Long.UZERO; + message.limit = + object.limit !== undefined && object.limit !== null ? helpers_1.Long.fromValue(object.limit) : helpers_1.Long.UZERO; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; +function createBasePageResponse() { + return { + nextKey: new Uint8Array(), + total: helpers_1.Long.UZERO, + }; +} +exports.PageResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (!message.total.isZero()) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nextKey = reader.bytes(); + break; + case 2: + message.total = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + nextKey: (0, helpers_1.isSet)(object.nextKey) ? (0, helpers_1.bytesFromBase64)(object.nextKey) : new Uint8Array(), + total: (0, helpers_1.isSet)(object.total) ? helpers_1.Long.fromValue(object.total) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.nextKey !== undefined && + (obj.nextKey = (0, helpers_1.base64FromBytes)(message.nextKey !== undefined ? message.nextKey : new Uint8Array())); + message.total !== undefined && (obj.total = (message.total || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(); + message.total = + object.total !== undefined && object.total !== null ? helpers_1.Long.fromValue(object.total) : helpers_1.Long.UZERO; + return message; + }, +}; +//# sourceMappingURL=pagination.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js": +/*!***************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DecProto = exports.IntProto = exports.DecCoin = exports.Coin = exports.protobufPackage = void 0; +/* eslint-disable */ +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.base.v1beta1"; +function createBaseCoin() { + return { + denom: "", + amount: "", + }; +} +exports.Coin = { + encode(message, writer = _m0.Writer.create()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.amount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + denom: (0, helpers_1.isSet)(object.denom) ? String(object.denom) : "", + amount: (0, helpers_1.isSet)(object.amount) ? String(object.amount) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + fromPartial(object) { + const message = createBaseCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; +function createBaseDecCoin() { + return { + denom: "", + amount: "", + }; +} +exports.DecCoin = { + encode(message, writer = _m0.Writer.create()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.amount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + denom: (0, helpers_1.isSet)(object.denom) ? String(object.denom) : "", + amount: (0, helpers_1.isSet)(object.amount) ? String(object.amount) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + fromPartial(object) { + const message = createBaseDecCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; +function createBaseIntProto() { + return { + int: "", + }; +} +exports.IntProto = { + encode(message, writer = _m0.Writer.create()) { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.int = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + int: (0, helpers_1.isSet)(object.int) ? String(object.int) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.int !== undefined && (obj.int = message.int); + return obj; + }, + fromPartial(object) { + const message = createBaseIntProto(); + message.int = object.int ?? ""; + return message; + }, +}; +function createBaseDecProto() { + return { + dec: "", + }; +} +exports.DecProto = { + encode(message, writer = _m0.Writer.create()) { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dec = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + dec: (0, helpers_1.isSet)(object.dec) ? String(object.dec) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.dec !== undefined && (obj.dec = message.dec); + return obj; + }, + fromPartial(object) { + const message = createBaseDecProto(); + message.dec = object.dec ?? ""; + return message; + }, +}; +//# sourceMappingURL=coin.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/crypto/ed25519/keys.js": +/*!*****************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/crypto/ed25519/keys.js ***! + \*****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PrivKey = exports.PubKey = exports.protobufPackage = void 0; +/* eslint-disable */ +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.crypto.ed25519"; +function createBasePubKey() { + return { + key: new Uint8Array(), + }; +} +exports.PubKey = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; +function createBasePrivKey() { + return { + key: new Uint8Array(), + }; +} +exports.PrivKey = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; +//# sourceMappingURL=keys.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/crypto/multisig/keys.js": +/*!******************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/crypto/multisig/keys.js ***! + \******************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LegacyAminoPubKey = exports.protobufPackage = void 0; +/* eslint-disable */ +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.crypto.multisig"; +function createBaseLegacyAminoPubKey() { + return { + threshold: 0, + publicKeys: [], + }; +} +exports.LegacyAminoPubKey = { + encode(message, writer = _m0.Writer.create()) { + if (message.threshold !== 0) { + writer.uint32(8).uint32(message.threshold); + } + for (const v of message.publicKeys) { + any_1.Any.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLegacyAminoPubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.threshold = reader.uint32(); + break; + case 2: + message.publicKeys.push(any_1.Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + threshold: (0, helpers_1.isSet)(object.threshold) ? Number(object.threshold) : 0, + publicKeys: Array.isArray(object?.publicKeys) ? object.publicKeys.map((e) => any_1.Any.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.threshold !== undefined && (obj.threshold = Math.round(message.threshold)); + if (message.publicKeys) { + obj.publicKeys = message.publicKeys.map((e) => (e ? any_1.Any.toJSON(e) : undefined)); + } + else { + obj.publicKeys = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseLegacyAminoPubKey(); + message.threshold = object.threshold ?? 0; + message.publicKeys = object.publicKeys?.map((e) => any_1.Any.fromPartial(e)) || []; + return message; + }, +}; +//# sourceMappingURL=keys.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/crypto/multisig/v1beta1/multisig.js": +/*!******************************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/crypto/multisig/v1beta1/multisig.js ***! + \******************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CompactBitArray = exports.MultiSignature = exports.protobufPackage = void 0; +/* eslint-disable */ +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.crypto.multisig.v1beta1"; +function createBaseMultiSignature() { + return { + signatures: [], + }; +} +exports.MultiSignature = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.signatures) { + writer.uint32(10).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiSignature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e) => (0, helpers_1.bytesFromBase64)(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.signatures) { + obj.signatures = message.signatures.map((e) => (0, helpers_1.base64FromBytes)(e !== undefined ? e : new Uint8Array())); + } + else { + obj.signatures = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; +function createBaseCompactBitArray() { + return { + extraBitsStored: 0, + elems: new Uint8Array(), + }; +} +exports.CompactBitArray = { + encode(message, writer = _m0.Writer.create()) { + if (message.extraBitsStored !== 0) { + writer.uint32(8).uint32(message.extraBitsStored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompactBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.extraBitsStored = reader.uint32(); + break; + case 2: + message.elems = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + extraBitsStored: (0, helpers_1.isSet)(object.extraBitsStored) ? Number(object.extraBitsStored) : 0, + elems: (0, helpers_1.isSet)(object.elems) ? (0, helpers_1.bytesFromBase64)(object.elems) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.extraBitsStored !== undefined && (obj.extraBitsStored = Math.round(message.extraBitsStored)); + message.elems !== undefined && + (obj.elems = (0, helpers_1.base64FromBytes)(message.elems !== undefined ? message.elems : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseCompactBitArray(); + message.extraBitsStored = object.extraBitsStored ?? 0; + message.elems = object.elems ?? new Uint8Array(); + return message; + }, +}; +//# sourceMappingURL=multisig.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/crypto/secp256k1/keys.js": +/*!*******************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/crypto/secp256k1/keys.js ***! + \*******************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PrivKey = exports.PubKey = exports.protobufPackage = void 0; +/* eslint-disable */ +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.crypto.secp256k1"; +function createBasePubKey() { + return { + key: new Uint8Array(), + }; +} +exports.PubKey = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; +function createBasePrivKey() { + return { + key: new Uint8Array(), + }; +} +exports.PrivKey = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, +}; +//# sourceMappingURL=keys.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/distribution/v1beta1/distribution.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/distribution/v1beta1/distribution.js ***! + \*******************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CommunityPoolSpendProposalWithDeposit = exports.DelegationDelegatorReward = exports.DelegatorStartingInfo = exports.CommunityPoolSpendProposal = exports.FeePool = exports.ValidatorSlashEvents = exports.ValidatorSlashEvent = exports.ValidatorOutstandingRewards = exports.ValidatorAccumulatedCommission = exports.ValidatorCurrentRewards = exports.ValidatorHistoricalRewards = exports.Params = exports.protobufPackage = void 0; +/* eslint-disable */ +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.distribution.v1beta1"; +function createBaseParams() { + return { + communityTax: "", + baseProposerReward: "", + bonusProposerReward: "", + withdrawAddrEnabled: false, + }; +} +exports.Params = { + encode(message, writer = _m0.Writer.create()) { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.communityTax = reader.string(); + break; + case 2: + message.baseProposerReward = reader.string(); + break; + case 3: + message.bonusProposerReward = reader.string(); + break; + case 4: + message.withdrawAddrEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + communityTax: (0, helpers_1.isSet)(object.communityTax) ? String(object.communityTax) : "", + baseProposerReward: (0, helpers_1.isSet)(object.baseProposerReward) ? String(object.baseProposerReward) : "", + bonusProposerReward: (0, helpers_1.isSet)(object.bonusProposerReward) ? String(object.bonusProposerReward) : "", + withdrawAddrEnabled: (0, helpers_1.isSet)(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.communityTax !== undefined && (obj.communityTax = message.communityTax); + message.baseProposerReward !== undefined && (obj.baseProposerReward = message.baseProposerReward); + message.bonusProposerReward !== undefined && (obj.bonusProposerReward = message.bonusProposerReward); + message.withdrawAddrEnabled !== undefined && (obj.withdrawAddrEnabled = message.withdrawAddrEnabled); + return obj; + }, + fromPartial(object) { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, +}; +function createBaseValidatorHistoricalRewards() { + return { + cumulativeRewardRatio: [], + referenceCount: 0, + }; +} +exports.ValidatorHistoricalRewards = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.cumulativeRewardRatio) { + coin_1.DecCoin.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.cumulativeRewardRatio.push(coin_1.DecCoin.decode(reader, reader.uint32())); + break; + case 2: + message.referenceCount = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + cumulativeRewardRatio: Array.isArray(object?.cumulativeRewardRatio) + ? object.cumulativeRewardRatio.map((e) => coin_1.DecCoin.fromJSON(e)) + : [], + referenceCount: (0, helpers_1.isSet)(object.referenceCount) ? Number(object.referenceCount) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.cumulativeRewardRatio) { + obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map((e) => e ? coin_1.DecCoin.toJSON(e) : undefined); + } + else { + obj.cumulativeRewardRatio = []; + } + message.referenceCount !== undefined && (obj.referenceCount = Math.round(message.referenceCount)); + return obj; + }, + fromPartial(object) { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map((e) => coin_1.DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 0; + return message; + }, +}; +function createBaseValidatorCurrentRewards() { + return { + rewards: [], + period: helpers_1.Long.UZERO, + }; +} +exports.ValidatorCurrentRewards = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.rewards) { + coin_1.DecCoin.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (!message.period.isZero()) { + writer.uint32(16).uint64(message.period); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(coin_1.DecCoin.decode(reader, reader.uint32())); + break; + case 2: + message.period = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e) => coin_1.DecCoin.fromJSON(e)) : [], + period: (0, helpers_1.isSet)(object.period) ? helpers_1.Long.fromValue(object.period) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => (e ? coin_1.DecCoin.toJSON(e) : undefined)); + } + else { + obj.rewards = []; + } + message.period !== undefined && (obj.period = (message.period || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseValidatorCurrentRewards(); + message.rewards = object.rewards?.map((e) => coin_1.DecCoin.fromPartial(e)) || []; + message.period = + object.period !== undefined && object.period !== null ? helpers_1.Long.fromValue(object.period) : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseValidatorAccumulatedCommission() { + return { + commission: [], + }; +} +exports.ValidatorAccumulatedCommission = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.commission) { + coin_1.DecCoin.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission.push(coin_1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + commission: Array.isArray(object?.commission) + ? object.commission.map((e) => coin_1.DecCoin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.commission) { + obj.commission = message.commission.map((e) => (e ? coin_1.DecCoin.toJSON(e) : undefined)); + } + else { + obj.commission = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseValidatorAccumulatedCommission(); + message.commission = object.commission?.map((e) => coin_1.DecCoin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseValidatorOutstandingRewards() { + return { + rewards: [], + }; +} +exports.ValidatorOutstandingRewards = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.rewards) { + coin_1.DecCoin.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(coin_1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e) => coin_1.DecCoin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => (e ? coin_1.DecCoin.toJSON(e) : undefined)); + } + else { + obj.rewards = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => coin_1.DecCoin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseValidatorSlashEvent() { + return { + validatorPeriod: helpers_1.Long.UZERO, + fraction: "", + }; +} +exports.ValidatorSlashEvent = { + encode(message, writer = _m0.Writer.create()) { + if (!message.validatorPeriod.isZero()) { + writer.uint32(8).uint64(message.validatorPeriod); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorPeriod = reader.uint64(); + break; + case 2: + message.fraction = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validatorPeriod: (0, helpers_1.isSet)(object.validatorPeriod) ? helpers_1.Long.fromValue(object.validatorPeriod) : helpers_1.Long.UZERO, + fraction: (0, helpers_1.isSet)(object.fraction) ? String(object.fraction) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.validatorPeriod !== undefined && + (obj.validatorPeriod = (message.validatorPeriod || helpers_1.Long.UZERO).toString()); + message.fraction !== undefined && (obj.fraction = message.fraction); + return obj; + }, + fromPartial(object) { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = + object.validatorPeriod !== undefined && object.validatorPeriod !== null + ? helpers_1.Long.fromValue(object.validatorPeriod) + : helpers_1.Long.UZERO; + message.fraction = object.fraction ?? ""; + return message; + }, +}; +function createBaseValidatorSlashEvents() { + return { + validatorSlashEvents: [], + }; +} +exports.ValidatorSlashEvents = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.validatorSlashEvents) { + exports.ValidatorSlashEvent.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvents(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorSlashEvents.push(exports.ValidatorSlashEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) + ? object.validatorSlashEvents.map((e) => exports.ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.validatorSlashEvents) { + obj.validatorSlashEvents = message.validatorSlashEvents.map((e) => e ? exports.ValidatorSlashEvent.toJSON(e) : undefined); + } + else { + obj.validatorSlashEvents = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = + object.validatorSlashEvents?.map((e) => exports.ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; +function createBaseFeePool() { + return { + communityPool: [], + }; +} +exports.FeePool = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.communityPool) { + coin_1.DecCoin.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.communityPool.push(coin_1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + communityPool: Array.isArray(object?.communityPool) + ? object.communityPool.map((e) => coin_1.DecCoin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.communityPool) { + obj.communityPool = message.communityPool.map((e) => (e ? coin_1.DecCoin.toJSON(e) : undefined)); + } + else { + obj.communityPool = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.map((e) => coin_1.DecCoin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCommunityPoolSpendProposal() { + return { + title: "", + description: "", + recipient: "", + amount: [], + }; +} +exports.CommunityPoolSpendProposal = { + encode(message, writer = _m0.Writer.create()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + for (const v of message.amount) { + coin_1.Coin.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.recipient = reader.string(); + break; + case 4: + message.amount.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + title: (0, helpers_1.isSet)(object.title) ? String(object.title) : "", + description: (0, helpers_1.isSet)(object.description) ? String(object.description) : "", + recipient: (0, helpers_1.isSet)(object.recipient) ? String(object.recipient) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e) => coin_1.Coin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.amount = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseCommunityPoolSpendProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseDelegatorStartingInfo() { + return { + previousPeriod: helpers_1.Long.UZERO, + stake: "", + height: helpers_1.Long.UZERO, + }; +} +exports.DelegatorStartingInfo = { + encode(message, writer = _m0.Writer.create()) { + if (!message.previousPeriod.isZero()) { + writer.uint32(8).uint64(message.previousPeriod); + } + if (message.stake !== "") { + writer.uint32(18).string(message.stake); + } + if (!message.height.isZero()) { + writer.uint32(24).uint64(message.height); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.previousPeriod = reader.uint64(); + break; + case 2: + message.stake = reader.string(); + break; + case 3: + message.height = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + previousPeriod: (0, helpers_1.isSet)(object.previousPeriod) ? helpers_1.Long.fromValue(object.previousPeriod) : helpers_1.Long.UZERO, + stake: (0, helpers_1.isSet)(object.stake) ? String(object.stake) : "", + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.previousPeriod !== undefined && + (obj.previousPeriod = (message.previousPeriod || helpers_1.Long.UZERO).toString()); + message.stake !== undefined && (obj.stake = message.stake); + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = + object.previousPeriod !== undefined && object.previousPeriod !== null + ? helpers_1.Long.fromValue(object.previousPeriod) + : helpers_1.Long.UZERO; + message.stake = object.stake ?? ""; + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseDelegationDelegatorReward() { + return { + validatorAddress: "", + reward: [], + }; +} +exports.DelegationDelegatorReward = { + encode(message, writer = _m0.Writer.create()) { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + coin_1.DecCoin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + case 2: + message.reward.push(coin_1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + reward: Array.isArray(object?.reward) ? object.reward.map((e) => coin_1.DecCoin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + if (message.reward) { + obj.reward = message.reward.map((e) => (e ? coin_1.DecCoin.toJSON(e) : undefined)); + } + else { + obj.reward = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + message.reward = object.reward?.map((e) => coin_1.DecCoin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCommunityPoolSpendProposalWithDeposit() { + return { + title: "", + description: "", + recipient: "", + amount: "", + deposit: "", + }; +} +exports.CommunityPoolSpendProposalWithDeposit = { + encode(message, writer = _m0.Writer.create()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + if (message.amount !== "") { + writer.uint32(34).string(message.amount); + } + if (message.deposit !== "") { + writer.uint32(42).string(message.deposit); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.recipient = reader.string(); + break; + case 4: + message.amount = reader.string(); + break; + case 5: + message.deposit = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + title: (0, helpers_1.isSet)(object.title) ? String(object.title) : "", + description: (0, helpers_1.isSet)(object.description) ? String(object.description) : "", + recipient: (0, helpers_1.isSet)(object.recipient) ? String(object.recipient) : "", + amount: (0, helpers_1.isSet)(object.amount) ? String(object.amount) : "", + deposit: (0, helpers_1.isSet)(object.deposit) ? String(object.deposit) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.recipient !== undefined && (obj.recipient = message.recipient); + message.amount !== undefined && (obj.amount = message.amount); + message.deposit !== undefined && (obj.deposit = message.deposit); + return obj; + }, + fromPartial(object) { + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount ?? ""; + message.deposit = object.deposit ?? ""; + return message; + }, +}; +//# sourceMappingURL=distribution.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/distribution/v1beta1/query.js": +/*!************************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/distribution/v1beta1/query.js ***! + \************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QueryCommunityPoolResponse = exports.QueryCommunityPoolRequest = exports.QueryDelegatorWithdrawAddressResponse = exports.QueryDelegatorWithdrawAddressRequest = exports.QueryDelegatorValidatorsResponse = exports.QueryDelegatorValidatorsRequest = exports.QueryDelegationTotalRewardsResponse = exports.QueryDelegationTotalRewardsRequest = exports.QueryDelegationRewardsResponse = exports.QueryDelegationRewardsRequest = exports.QueryValidatorSlashesResponse = exports.QueryValidatorSlashesRequest = exports.QueryValidatorCommissionResponse = exports.QueryValidatorCommissionRequest = exports.QueryValidatorOutstandingRewardsResponse = exports.QueryValidatorOutstandingRewardsRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const pagination_1 = __webpack_require__(/*! ../../base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const distribution_1 = __webpack_require__(/*! ./distribution */ "./node_modules/cosmjs-types/cosmos/distribution/v1beta1/distribution.js"); +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.distribution.v1beta1"; +function createBaseQueryParamsRequest() { + return {}; +} +exports.QueryParamsRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { + params: undefined, + }; +} +exports.QueryParamsResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.params !== undefined) { + distribution_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = distribution_1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + params: (0, helpers_1.isSet)(object.params) ? distribution_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.params !== undefined && (obj.params = message.params ? distribution_1.Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null ? distribution_1.Params.fromPartial(object.params) : undefined; + return message; + }, +}; +function createBaseQueryValidatorOutstandingRewardsRequest() { + return { + validatorAddress: "", + }; +} +exports.QueryValidatorOutstandingRewardsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; +function createBaseQueryValidatorOutstandingRewardsResponse() { + return { + rewards: undefined, + }; +} +exports.QueryValidatorOutstandingRewardsResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.rewards !== undefined) { + distribution_1.ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorOutstandingRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards = distribution_1.ValidatorOutstandingRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + rewards: (0, helpers_1.isSet)(object.rewards) ? distribution_1.ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.rewards !== undefined && + (obj.rewards = message.rewards ? distribution_1.ValidatorOutstandingRewards.toJSON(message.rewards) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorOutstandingRewardsResponse(); + message.rewards = + object.rewards !== undefined && object.rewards !== null + ? distribution_1.ValidatorOutstandingRewards.fromPartial(object.rewards) + : undefined; + return message; + }, +}; +function createBaseQueryValidatorCommissionRequest() { + return { + validatorAddress: "", + }; +} +exports.QueryValidatorCommissionRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorCommissionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; +function createBaseQueryValidatorCommissionResponse() { + return { + commission: undefined, + }; +} +exports.QueryValidatorCommissionResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.commission !== undefined) { + distribution_1.ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission = distribution_1.ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + commission: (0, helpers_1.isSet)(object.commission) + ? distribution_1.ValidatorAccumulatedCommission.fromJSON(object.commission) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.commission !== undefined && + (obj.commission = message.commission + ? distribution_1.ValidatorAccumulatedCommission.toJSON(message.commission) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorCommissionResponse(); + message.commission = + object.commission !== undefined && object.commission !== null + ? distribution_1.ValidatorAccumulatedCommission.fromPartial(object.commission) + : undefined; + return message; + }, +}; +function createBaseQueryValidatorSlashesRequest() { + return { + validatorAddress: "", + startingHeight: helpers_1.Long.UZERO, + endingHeight: helpers_1.Long.UZERO, + pagination: undefined, + }; +} +exports.QueryValidatorSlashesRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (!message.startingHeight.isZero()) { + writer.uint32(16).uint64(message.startingHeight); + } + if (!message.endingHeight.isZero()) { + writer.uint32(24).uint64(message.endingHeight); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSlashesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + case 2: + message.startingHeight = reader.uint64(); + break; + case 3: + message.endingHeight = reader.uint64(); + break; + case 4: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + startingHeight: (0, helpers_1.isSet)(object.startingHeight) ? helpers_1.Long.fromValue(object.startingHeight) : helpers_1.Long.UZERO, + endingHeight: (0, helpers_1.isSet)(object.endingHeight) ? helpers_1.Long.fromValue(object.endingHeight) : helpers_1.Long.UZERO, + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.startingHeight !== undefined && + (obj.startingHeight = (message.startingHeight || helpers_1.Long.UZERO).toString()); + message.endingHeight !== undefined && + (obj.endingHeight = (message.endingHeight || helpers_1.Long.UZERO).toString()); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = + object.startingHeight !== undefined && object.startingHeight !== null + ? helpers_1.Long.fromValue(object.startingHeight) + : helpers_1.Long.UZERO; + message.endingHeight = + object.endingHeight !== undefined && object.endingHeight !== null + ? helpers_1.Long.fromValue(object.endingHeight) + : helpers_1.Long.UZERO; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryValidatorSlashesResponse() { + return { + slashes: [], + pagination: undefined, + }; +} +exports.QueryValidatorSlashesResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.slashes) { + distribution_1.ValidatorSlashEvent.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSlashesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.slashes.push(distribution_1.ValidatorSlashEvent.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + slashes: Array.isArray(object?.slashes) + ? object.slashes.map((e) => distribution_1.ValidatorSlashEvent.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.slashes) { + obj.slashes = message.slashes.map((e) => (e ? distribution_1.ValidatorSlashEvent.toJSON(e) : undefined)); + } + else { + obj.slashes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorSlashesResponse(); + message.slashes = object.slashes?.map((e) => distribution_1.ValidatorSlashEvent.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryDelegationRewardsRequest() { + return { + delegatorAddress: "", + validatorAddress: "", + }; +} +exports.QueryDelegationRewardsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; +function createBaseQueryDelegationRewardsResponse() { + return { + rewards: [], + }; +} +exports.QueryDelegationRewardsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.rewards) { + coin_1.DecCoin.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(coin_1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e) => coin_1.DecCoin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => (e ? coin_1.DecCoin.toJSON(e) : undefined)); + } + else { + obj.rewards = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => coin_1.DecCoin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseQueryDelegationTotalRewardsRequest() { + return { + delegatorAddress: "", + }; +} +exports.QueryDelegationTotalRewardsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationTotalRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; +function createBaseQueryDelegationTotalRewardsResponse() { + return { + rewards: [], + total: [], + }; +} +exports.QueryDelegationTotalRewardsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.rewards) { + distribution_1.DelegationDelegatorReward.encode(v, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.total) { + coin_1.DecCoin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationTotalRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(distribution_1.DelegationDelegatorReward.decode(reader, reader.uint32())); + break; + case 2: + message.total.push(coin_1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + rewards: Array.isArray(object?.rewards) + ? object.rewards.map((e) => distribution_1.DelegationDelegatorReward.fromJSON(e)) + : [], + total: Array.isArray(object?.total) ? object.total.map((e) => coin_1.DecCoin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => (e ? distribution_1.DelegationDelegatorReward.toJSON(e) : undefined)); + } + else { + obj.rewards = []; + } + if (message.total) { + obj.total = message.total.map((e) => (e ? coin_1.DecCoin.toJSON(e) : undefined)); + } + else { + obj.total = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegationTotalRewardsResponse(); + message.rewards = object.rewards?.map((e) => distribution_1.DelegationDelegatorReward.fromPartial(e)) || []; + message.total = object.total?.map((e) => coin_1.DecCoin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseQueryDelegatorValidatorsRequest() { + return { + delegatorAddress: "", + }; +} +exports.QueryDelegatorValidatorsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; +function createBaseQueryDelegatorValidatorsResponse() { + return { + validators: [], + }; +} +exports.QueryDelegatorValidatorsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.validators) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validators.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validators: Array.isArray(object?.validators) ? object.validators.map((e) => String(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => e); + } + else { + obj.validators = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; +function createBaseQueryDelegatorWithdrawAddressRequest() { + return { + delegatorAddress: "", + }; +} +exports.QueryDelegatorWithdrawAddressRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, +}; +function createBaseQueryDelegatorWithdrawAddressResponse() { + return { + withdrawAddress: "", + }; +} +exports.QueryDelegatorWithdrawAddressResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.withdrawAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + withdrawAddress: (0, helpers_1.isSet)(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.withdrawAddress !== undefined && (obj.withdrawAddress = message.withdrawAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; +function createBaseQueryCommunityPoolRequest() { + return {}; +} +exports.QueryCommunityPoolRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, +}; +function createBaseQueryCommunityPoolResponse() { + return { + pool: [], + }; +} +exports.QueryCommunityPoolResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.pool) { + coin_1.DecCoin.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool.push(coin_1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pool: Array.isArray(object?.pool) ? object.pool.map((e) => coin_1.DecCoin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pool) { + obj.pool = message.pool.map((e) => (e ? coin_1.DecCoin.toJSON(e) : undefined)); + } + else { + obj.pool = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseQueryCommunityPoolResponse(); + message.pool = object.pool?.map((e) => coin_1.DecCoin.fromPartial(e)) || []; + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.ValidatorOutstandingRewards = this.ValidatorOutstandingRewards.bind(this); + this.ValidatorCommission = this.ValidatorCommission.bind(this); + this.ValidatorSlashes = this.ValidatorSlashes.bind(this); + this.DelegationRewards = this.DelegationRewards.bind(this); + this.DelegationTotalRewards = this.DelegationTotalRewards.bind(this); + this.DelegatorValidators = this.DelegatorValidators.bind(this); + this.DelegatorWithdrawAddress = this.DelegatorWithdrawAddress.bind(this); + this.CommunityPool = this.CommunityPool.bind(this); + } + Params(request = {}) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new _m0.Reader(data))); + } + ValidatorOutstandingRewards(request) { + const data = exports.QueryValidatorOutstandingRewardsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "ValidatorOutstandingRewards", data); + return promise.then((data) => exports.QueryValidatorOutstandingRewardsResponse.decode(new _m0.Reader(data))); + } + ValidatorCommission(request) { + const data = exports.QueryValidatorCommissionRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "ValidatorCommission", data); + return promise.then((data) => exports.QueryValidatorCommissionResponse.decode(new _m0.Reader(data))); + } + ValidatorSlashes(request) { + const data = exports.QueryValidatorSlashesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "ValidatorSlashes", data); + return promise.then((data) => exports.QueryValidatorSlashesResponse.decode(new _m0.Reader(data))); + } + DelegationRewards(request) { + const data = exports.QueryDelegationRewardsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "DelegationRewards", data); + return promise.then((data) => exports.QueryDelegationRewardsResponse.decode(new _m0.Reader(data))); + } + DelegationTotalRewards(request) { + const data = exports.QueryDelegationTotalRewardsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "DelegationTotalRewards", data); + return promise.then((data) => exports.QueryDelegationTotalRewardsResponse.decode(new _m0.Reader(data))); + } + DelegatorValidators(request) { + const data = exports.QueryDelegatorValidatorsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "DelegatorValidators", data); + return promise.then((data) => exports.QueryDelegatorValidatorsResponse.decode(new _m0.Reader(data))); + } + DelegatorWithdrawAddress(request) { + const data = exports.QueryDelegatorWithdrawAddressRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "DelegatorWithdrawAddress", data); + return promise.then((data) => exports.QueryDelegatorWithdrawAddressResponse.decode(new _m0.Reader(data))); + } + CommunityPool(request = {}) { + const data = exports.QueryCommunityPoolRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "CommunityPool", data); + return promise.then((data) => exports.QueryCommunityPoolResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/distribution/v1beta1/tx.js": +/*!*********************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/distribution/v1beta1/tx.js ***! + \*********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MsgClientImpl = exports.MsgFundCommunityPoolResponse = exports.MsgFundCommunityPool = exports.MsgWithdrawValidatorCommissionResponse = exports.MsgWithdrawValidatorCommission = exports.MsgWithdrawDelegatorRewardResponse = exports.MsgWithdrawDelegatorReward = exports.MsgSetWithdrawAddressResponse = exports.MsgSetWithdrawAddress = exports.protobufPackage = void 0; +/* eslint-disable */ +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.distribution.v1beta1"; +function createBaseMsgSetWithdrawAddress() { + return { + delegatorAddress: "", + withdrawAddress: "", + }; +} +exports.MsgSetWithdrawAddress = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.withdrawAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + withdrawAddress: (0, helpers_1.isSet)(object.withdrawAddress) ? String(object.withdrawAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.withdrawAddress !== undefined && (obj.withdrawAddress = message.withdrawAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, +}; +function createBaseMsgSetWithdrawAddressResponse() { + return {}; +} +exports.MsgSetWithdrawAddressResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; +function createBaseMsgWithdrawDelegatorReward() { + return { + delegatorAddress: "", + validatorAddress: "", + }; +} +exports.MsgWithdrawDelegatorReward = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; +function createBaseMsgWithdrawDelegatorRewardResponse() { + return {}; +} +exports.MsgWithdrawDelegatorRewardResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + return message; + }, +}; +function createBaseMsgWithdrawValidatorCommission() { + return { + validatorAddress: "", + }; +} +exports.MsgWithdrawValidatorCommission = { + encode(message, writer = _m0.Writer.create()) { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; +function createBaseMsgWithdrawValidatorCommissionResponse() { + return {}; +} +exports.MsgWithdrawValidatorCommissionResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + return message; + }, +}; +function createBaseMsgFundCommunityPool() { + return { + amount: [], + depositor: "", + }; +} +exports.MsgFundCommunityPool = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.amount) { + coin_1.Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + amount: Array.isArray(object?.amount) ? object.amount.map((e) => coin_1.Coin.fromJSON(e)) : [], + depositor: (0, helpers_1.isSet)(object.depositor) ? String(object.depositor) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.amount = []; + } + message.depositor !== undefined && (obj.depositor = message.depositor); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgFundCommunityPool(); + message.amount = object.amount?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.depositor = object.depositor ?? ""; + return message; + }, +}; +function createBaseMsgFundCommunityPoolResponse() { + return {}; +} +exports.MsgFundCommunityPoolResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; +class MsgClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.SetWithdrawAddress = this.SetWithdrawAddress.bind(this); + this.WithdrawDelegatorReward = this.WithdrawDelegatorReward.bind(this); + this.WithdrawValidatorCommission = this.WithdrawValidatorCommission.bind(this); + this.FundCommunityPool = this.FundCommunityPool.bind(this); + } + SetWithdrawAddress(request) { + const data = exports.MsgSetWithdrawAddress.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "SetWithdrawAddress", data); + return promise.then((data) => exports.MsgSetWithdrawAddressResponse.decode(new _m0.Reader(data))); + } + WithdrawDelegatorReward(request) { + const data = exports.MsgWithdrawDelegatorReward.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "WithdrawDelegatorReward", data); + return promise.then((data) => exports.MsgWithdrawDelegatorRewardResponse.decode(new _m0.Reader(data))); + } + WithdrawValidatorCommission(request) { + const data = exports.MsgWithdrawValidatorCommission.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "WithdrawValidatorCommission", data); + return promise.then((data) => exports.MsgWithdrawValidatorCommissionResponse.decode(new _m0.Reader(data))); + } + FundCommunityPool(request) { + const data = exports.MsgFundCommunityPool.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "FundCommunityPool", data); + return promise.then((data) => exports.MsgFundCommunityPoolResponse.decode(new _m0.Reader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +//# sourceMappingURL=tx.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/feegrant/v1beta1/feegrant.js": +/*!***********************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/feegrant/v1beta1/feegrant.js ***! + \***********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Grant = exports.AllowedMsgAllowance = exports.PeriodicAllowance = exports.BasicAllowance = exports.protobufPackage = void 0; +/* eslint-disable */ +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const timestamp_1 = __webpack_require__(/*! ../../../google/protobuf/timestamp */ "./node_modules/cosmjs-types/google/protobuf/timestamp.js"); +const duration_1 = __webpack_require__(/*! ../../../google/protobuf/duration */ "./node_modules/cosmjs-types/google/protobuf/duration.js"); +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.feegrant.v1beta1"; +function createBaseBasicAllowance() { + return { + spendLimit: [], + expiration: undefined, + }; +} +exports.BasicAllowance = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.spendLimit) { + coin_1.Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.expiration !== undefined) { + timestamp_1.Timestamp.encode(message.expiration, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBasicAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.spendLimit.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 2: + message.expiration = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + spendLimit: Array.isArray(object?.spendLimit) + ? object.spendLimit.map((e) => coin_1.Coin.fromJSON(e)) + : [], + expiration: (0, helpers_1.isSet)(object.expiration) ? (0, helpers_1.fromJsonTimestamp)(object.expiration) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.spendLimit) { + obj.spendLimit = message.spendLimit.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.spendLimit = []; + } + message.expiration !== undefined && (obj.expiration = (0, helpers_1.fromTimestamp)(message.expiration).toISOString()); + return obj; + }, + fromPartial(object) { + const message = createBaseBasicAllowance(); + message.spendLimit = object.spendLimit?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.expiration = + object.expiration !== undefined && object.expiration !== null + ? timestamp_1.Timestamp.fromPartial(object.expiration) + : undefined; + return message; + }, +}; +function createBasePeriodicAllowance() { + return { + basic: undefined, + period: undefined, + periodSpendLimit: [], + periodCanSpend: [], + periodReset: undefined, + }; +} +exports.PeriodicAllowance = { + encode(message, writer = _m0.Writer.create()) { + if (message.basic !== undefined) { + exports.BasicAllowance.encode(message.basic, writer.uint32(10).fork()).ldelim(); + } + if (message.period !== undefined) { + duration_1.Duration.encode(message.period, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.periodSpendLimit) { + coin_1.Coin.encode(v, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.periodCanSpend) { + coin_1.Coin.encode(v, writer.uint32(34).fork()).ldelim(); + } + if (message.periodReset !== undefined) { + timestamp_1.Timestamp.encode(message.periodReset, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.basic = exports.BasicAllowance.decode(reader, reader.uint32()); + break; + case 2: + message.period = duration_1.Duration.decode(reader, reader.uint32()); + break; + case 3: + message.periodSpendLimit.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 4: + message.periodCanSpend.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 5: + message.periodReset = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + basic: (0, helpers_1.isSet)(object.basic) ? exports.BasicAllowance.fromJSON(object.basic) : undefined, + period: (0, helpers_1.isSet)(object.period) ? duration_1.Duration.fromJSON(object.period) : undefined, + periodSpendLimit: Array.isArray(object?.periodSpendLimit) + ? object.periodSpendLimit.map((e) => coin_1.Coin.fromJSON(e)) + : [], + periodCanSpend: Array.isArray(object?.periodCanSpend) + ? object.periodCanSpend.map((e) => coin_1.Coin.fromJSON(e)) + : [], + periodReset: (0, helpers_1.isSet)(object.periodReset) ? (0, helpers_1.fromJsonTimestamp)(object.periodReset) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.basic !== undefined && + (obj.basic = message.basic ? exports.BasicAllowance.toJSON(message.basic) : undefined); + message.period !== undefined && + (obj.period = message.period ? duration_1.Duration.toJSON(message.period) : undefined); + if (message.periodSpendLimit) { + obj.periodSpendLimit = message.periodSpendLimit.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.periodSpendLimit = []; + } + if (message.periodCanSpend) { + obj.periodCanSpend = message.periodCanSpend.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.periodCanSpend = []; + } + message.periodReset !== undefined && (obj.periodReset = (0, helpers_1.fromTimestamp)(message.periodReset).toISOString()); + return obj; + }, + fromPartial(object) { + const message = createBasePeriodicAllowance(); + message.basic = + object.basic !== undefined && object.basic !== null + ? exports.BasicAllowance.fromPartial(object.basic) + : undefined; + message.period = + object.period !== undefined && object.period !== null ? duration_1.Duration.fromPartial(object.period) : undefined; + message.periodSpendLimit = object.periodSpendLimit?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.periodCanSpend = object.periodCanSpend?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.periodReset = + object.periodReset !== undefined && object.periodReset !== null + ? timestamp_1.Timestamp.fromPartial(object.periodReset) + : undefined; + return message; + }, +}; +function createBaseAllowedMsgAllowance() { + return { + allowance: undefined, + allowedMessages: [], + }; +} +exports.AllowedMsgAllowance = { + encode(message, writer = _m0.Writer.create()) { + if (message.allowance !== undefined) { + any_1.Any.encode(message.allowance, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.allowedMessages) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllowedMsgAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowance = any_1.Any.decode(reader, reader.uint32()); + break; + case 2: + message.allowedMessages.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + allowance: (0, helpers_1.isSet)(object.allowance) ? any_1.Any.fromJSON(object.allowance) : undefined, + allowedMessages: Array.isArray(object?.allowedMessages) + ? object.allowedMessages.map((e) => String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.allowance !== undefined && + (obj.allowance = message.allowance ? any_1.Any.toJSON(message.allowance) : undefined); + if (message.allowedMessages) { + obj.allowedMessages = message.allowedMessages.map((e) => e); + } + else { + obj.allowedMessages = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseAllowedMsgAllowance(); + message.allowance = + object.allowance !== undefined && object.allowance !== null + ? any_1.Any.fromPartial(object.allowance) + : undefined; + message.allowedMessages = object.allowedMessages?.map((e) => e) || []; + return message; + }, +}; +function createBaseGrant() { + return { + granter: "", + grantee: "", + allowance: undefined, + }; +} +exports.Grant = { + encode(message, writer = _m0.Writer.create()) { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + any_1.Any.encode(message.allowance, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.allowance = any_1.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + granter: (0, helpers_1.isSet)(object.granter) ? String(object.granter) : "", + grantee: (0, helpers_1.isSet)(object.grantee) ? String(object.grantee) : "", + allowance: (0, helpers_1.isSet)(object.allowance) ? any_1.Any.fromJSON(object.allowance) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.allowance !== undefined && + (obj.allowance = message.allowance ? any_1.Any.toJSON(message.allowance) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseGrant(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.allowance = + object.allowance !== undefined && object.allowance !== null + ? any_1.Any.fromPartial(object.allowance) + : undefined; + return message; + }, +}; +//# sourceMappingURL=feegrant.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/feegrant/v1beta1/query.js": +/*!********************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/feegrant/v1beta1/query.js ***! + \********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QueryAllowancesByGranterResponse = exports.QueryAllowancesByGranterRequest = exports.QueryAllowancesResponse = exports.QueryAllowancesRequest = exports.QueryAllowanceResponse = exports.QueryAllowanceRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const pagination_1 = __webpack_require__(/*! ../../base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const feegrant_1 = __webpack_require__(/*! ./feegrant */ "./node_modules/cosmjs-types/cosmos/feegrant/v1beta1/feegrant.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.feegrant.v1beta1"; +function createBaseQueryAllowanceRequest() { + return { + granter: "", + grantee: "", + }; +} +exports.QueryAllowanceRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + granter: (0, helpers_1.isSet)(object.granter) ? String(object.granter) : "", + grantee: (0, helpers_1.isSet)(object.grantee) ? String(object.grantee) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAllowanceRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; +function createBaseQueryAllowanceResponse() { + return { + allowance: undefined, + }; +} +exports.QueryAllowanceResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.allowance !== undefined) { + feegrant_1.Grant.encode(message.allowance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowance = feegrant_1.Grant.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + allowance: (0, helpers_1.isSet)(object.allowance) ? feegrant_1.Grant.fromJSON(object.allowance) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.allowance !== undefined && + (obj.allowance = message.allowance ? feegrant_1.Grant.toJSON(message.allowance) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAllowanceResponse(); + message.allowance = + object.allowance !== undefined && object.allowance !== null + ? feegrant_1.Grant.fromPartial(object.allowance) + : undefined; + return message; + }, +}; +function createBaseQueryAllowancesRequest() { + return { + grantee: "", + pagination: undefined, + }; +} +exports.QueryAllowancesRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grantee = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + grantee: (0, helpers_1.isSet)(object.grantee) ? String(object.grantee) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.grantee !== undefined && (obj.grantee = message.grantee); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAllowancesRequest(); + message.grantee = object.grantee ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryAllowancesResponse() { + return { + allowances: [], + pagination: undefined, + }; +} +exports.QueryAllowancesResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.allowances) { + feegrant_1.Grant.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowances.push(feegrant_1.Grant.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + allowances: Array.isArray(object?.allowances) + ? object.allowances.map((e) => feegrant_1.Grant.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.allowances) { + obj.allowances = message.allowances.map((e) => (e ? feegrant_1.Grant.toJSON(e) : undefined)); + } + else { + obj.allowances = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAllowancesResponse(); + message.allowances = object.allowances?.map((e) => feegrant_1.Grant.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryAllowancesByGranterRequest() { + return { + granter: "", + pagination: undefined, + }; +} +exports.QueryAllowancesByGranterRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesByGranterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + granter: (0, helpers_1.isSet)(object.granter) ? String(object.granter) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAllowancesByGranterRequest(); + message.granter = object.granter ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryAllowancesByGranterResponse() { + return { + allowances: [], + pagination: undefined, + }; +} +exports.QueryAllowancesByGranterResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.allowances) { + feegrant_1.Grant.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesByGranterResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowances.push(feegrant_1.Grant.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + allowances: Array.isArray(object?.allowances) + ? object.allowances.map((e) => feegrant_1.Grant.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.allowances) { + obj.allowances = message.allowances.map((e) => (e ? feegrant_1.Grant.toJSON(e) : undefined)); + } + else { + obj.allowances = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAllowancesByGranterResponse(); + message.allowances = object.allowances?.map((e) => feegrant_1.Grant.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Allowance = this.Allowance.bind(this); + this.Allowances = this.Allowances.bind(this); + this.AllowancesByGranter = this.AllowancesByGranter.bind(this); + } + Allowance(request) { + const data = exports.QueryAllowanceRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.feegrant.v1beta1.Query", "Allowance", data); + return promise.then((data) => exports.QueryAllowanceResponse.decode(new _m0.Reader(data))); + } + Allowances(request) { + const data = exports.QueryAllowancesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.feegrant.v1beta1.Query", "Allowances", data); + return promise.then((data) => exports.QueryAllowancesResponse.decode(new _m0.Reader(data))); + } + AllowancesByGranter(request) { + const data = exports.QueryAllowancesByGranterRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.feegrant.v1beta1.Query", "AllowancesByGranter", data); + return promise.then((data) => exports.QueryAllowancesByGranterResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/feegrant/v1beta1/tx.js": +/*!*****************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/feegrant/v1beta1/tx.js ***! + \*****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MsgClientImpl = exports.MsgRevokeAllowanceResponse = exports.MsgRevokeAllowance = exports.MsgGrantAllowanceResponse = exports.MsgGrantAllowance = exports.protobufPackage = void 0; +/* eslint-disable */ +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.feegrant.v1beta1"; +function createBaseMsgGrantAllowance() { + return { + granter: "", + grantee: "", + allowance: undefined, + }; +} +exports.MsgGrantAllowance = { + encode(message, writer = _m0.Writer.create()) { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + any_1.Any.encode(message.allowance, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.allowance = any_1.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + granter: (0, helpers_1.isSet)(object.granter) ? String(object.granter) : "", + grantee: (0, helpers_1.isSet)(object.grantee) ? String(object.grantee) : "", + allowance: (0, helpers_1.isSet)(object.allowance) ? any_1.Any.fromJSON(object.allowance) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.allowance !== undefined && + (obj.allowance = message.allowance ? any_1.Any.toJSON(message.allowance) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgGrantAllowance(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.allowance = + object.allowance !== undefined && object.allowance !== null + ? any_1.Any.fromPartial(object.allowance) + : undefined; + return message; + }, +}; +function createBaseMsgGrantAllowanceResponse() { + return {}; +} +exports.MsgGrantAllowanceResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, +}; +function createBaseMsgRevokeAllowance() { + return { + granter: "", + grantee: "", + }; +} +exports.MsgRevokeAllowance = { + encode(message, writer = _m0.Writer.create()) { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + granter: (0, helpers_1.isSet)(object.granter) ? String(object.granter) : "", + grantee: (0, helpers_1.isSet)(object.grantee) ? String(object.grantee) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgRevokeAllowance(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; +function createBaseMsgRevokeAllowanceResponse() { + return {}; +} +exports.MsgRevokeAllowanceResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, +}; +class MsgClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.GrantAllowance = this.GrantAllowance.bind(this); + this.RevokeAllowance = this.RevokeAllowance.bind(this); + } + GrantAllowance(request) { + const data = exports.MsgGrantAllowance.encode(request).finish(); + const promise = this.rpc.request("cosmos.feegrant.v1beta1.Msg", "GrantAllowance", data); + return promise.then((data) => exports.MsgGrantAllowanceResponse.decode(new _m0.Reader(data))); + } + RevokeAllowance(request) { + const data = exports.MsgRevokeAllowance.encode(request).finish(); + const promise = this.rpc.request("cosmos.feegrant.v1beta1.Msg", "RevokeAllowance", data); + return promise.then((data) => exports.MsgRevokeAllowanceResponse.decode(new _m0.Reader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +//# sourceMappingURL=tx.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/gov/v1beta1/gov.js": +/*!*************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/gov/v1beta1/gov.js ***! + \*************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TallyParams = exports.VotingParams = exports.DepositParams = exports.Vote = exports.TallyResult = exports.Proposal = exports.Deposit = exports.TextProposal = exports.WeightedVoteOption = exports.proposalStatusToJSON = exports.proposalStatusFromJSON = exports.ProposalStatus = exports.voteOptionToJSON = exports.voteOptionFromJSON = exports.VoteOption = exports.protobufPackage = void 0; +/* eslint-disable */ +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const timestamp_1 = __webpack_require__(/*! ../../../google/protobuf/timestamp */ "./node_modules/cosmjs-types/google/protobuf/timestamp.js"); +const duration_1 = __webpack_require__(/*! ../../../google/protobuf/duration */ "./node_modules/cosmjs-types/google/protobuf/duration.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.gov.v1beta1"; +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +var VoteOption; +(function (VoteOption) { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VoteOption[VoteOption["VOTE_OPTION_UNSPECIFIED"] = 0] = "VOTE_OPTION_UNSPECIFIED"; + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VoteOption[VoteOption["VOTE_OPTION_YES"] = 1] = "VOTE_OPTION_YES"; + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VoteOption[VoteOption["VOTE_OPTION_ABSTAIN"] = 2] = "VOTE_OPTION_ABSTAIN"; + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VoteOption[VoteOption["VOTE_OPTION_NO"] = 3] = "VOTE_OPTION_NO"; + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VoteOption[VoteOption["VOTE_OPTION_NO_WITH_VETO"] = 4] = "VOTE_OPTION_NO_WITH_VETO"; + VoteOption[VoteOption["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(VoteOption = exports.VoteOption || (exports.VoteOption = {})); +function voteOptionFromJSON(object) { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} +exports.voteOptionFromJSON = voteOptionFromJSON; +function voteOptionToJSON(object) { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.voteOptionToJSON = voteOptionToJSON; +/** ProposalStatus enumerates the valid statuses of a proposal. */ +var ProposalStatus; +(function (ProposalStatus) { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. */ + ProposalStatus[ProposalStatus["PROPOSAL_STATUS_UNSPECIFIED"] = 0] = "PROPOSAL_STATUS_UNSPECIFIED"; + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + ProposalStatus[ProposalStatus["PROPOSAL_STATUS_DEPOSIT_PERIOD"] = 1] = "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + ProposalStatus[ProposalStatus["PROPOSAL_STATUS_VOTING_PERIOD"] = 2] = "PROPOSAL_STATUS_VOTING_PERIOD"; + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + ProposalStatus[ProposalStatus["PROPOSAL_STATUS_PASSED"] = 3] = "PROPOSAL_STATUS_PASSED"; + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + ProposalStatus[ProposalStatus["PROPOSAL_STATUS_REJECTED"] = 4] = "PROPOSAL_STATUS_REJECTED"; + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + ProposalStatus[ProposalStatus["PROPOSAL_STATUS_FAILED"] = 5] = "PROPOSAL_STATUS_FAILED"; + ProposalStatus[ProposalStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ProposalStatus = exports.ProposalStatus || (exports.ProposalStatus = {})); +function proposalStatusFromJSON(object) { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; + case 2: + case "PROPOSAL_STATUS_VOTING_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; + case 3: + case "PROPOSAL_STATUS_PASSED": + return ProposalStatus.PROPOSAL_STATUS_PASSED; + case 4: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 5: + case "PROPOSAL_STATUS_FAILED": + return ProposalStatus.PROPOSAL_STATUS_FAILED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} +exports.proposalStatusFromJSON = proposalStatusFromJSON; +function proposalStatusToJSON(object) { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return "PROPOSAL_STATUS_VOTING_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return "PROPOSAL_STATUS_PASSED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return "PROPOSAL_STATUS_FAILED"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.proposalStatusToJSON = proposalStatusToJSON; +function createBaseWeightedVoteOption() { + return { + option: 0, + weight: "", + }; +} +exports.WeightedVoteOption = { + encode(message, writer = _m0.Writer.create()) { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.option = reader.int32(); + break; + case 2: + message.weight = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + option: (0, helpers_1.isSet)(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: (0, helpers_1.isSet)(object.weight) ? String(object.weight) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + message.weight !== undefined && (obj.weight = message.weight); + return obj; + }, + fromPartial(object) { + const message = createBaseWeightedVoteOption(); + message.option = object.option ?? 0; + message.weight = object.weight ?? ""; + return message; + }, +}; +function createBaseTextProposal() { + return { + title: "", + description: "", + }; +} +exports.TextProposal = { + encode(message, writer = _m0.Writer.create()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTextProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + title: (0, helpers_1.isSet)(object.title) ? String(object.title) : "", + description: (0, helpers_1.isSet)(object.description) ? String(object.description) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + return obj; + }, + fromPartial(object) { + const message = createBaseTextProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; +function createBaseDeposit() { + return { + proposalId: helpers_1.Long.UZERO, + depositor: "", + amount: [], + }; +} +exports.Deposit = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + coin_1.Coin.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + depositor: (0, helpers_1.isSet)(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e) => coin_1.Coin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.amount = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseDeposit(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseProposal() { + return { + proposalId: helpers_1.Long.UZERO, + content: undefined, + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + }; +} +exports.Proposal = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.content !== undefined) { + any_1.Any.encode(message.content, writer.uint32(18).fork()).ldelim(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + exports.TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).ldelim(); + } + if (message.submitTime !== undefined) { + timestamp_1.Timestamp.encode(message.submitTime, writer.uint32(42).fork()).ldelim(); + } + if (message.depositEndTime !== undefined) { + timestamp_1.Timestamp.encode(message.depositEndTime, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.totalDeposit) { + coin_1.Coin.encode(v, writer.uint32(58).fork()).ldelim(); + } + if (message.votingStartTime !== undefined) { + timestamp_1.Timestamp.encode(message.votingStartTime, writer.uint32(66).fork()).ldelim(); + } + if (message.votingEndTime !== undefined) { + timestamp_1.Timestamp.encode(message.votingEndTime, writer.uint32(74).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.content = any_1.Any.decode(reader, reader.uint32()); + break; + case 3: + message.status = reader.int32(); + break; + case 4: + message.finalTallyResult = exports.TallyResult.decode(reader, reader.uint32()); + break; + case 5: + message.submitTime = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.depositEndTime = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.totalDeposit.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 8: + message.votingStartTime = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 9: + message.votingEndTime = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + content: (0, helpers_1.isSet)(object.content) ? any_1.Any.fromJSON(object.content) : undefined, + status: (0, helpers_1.isSet)(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: (0, helpers_1.isSet)(object.finalTallyResult) + ? exports.TallyResult.fromJSON(object.finalTallyResult) + : undefined, + submitTime: (0, helpers_1.isSet)(object.submitTime) ? (0, helpers_1.fromJsonTimestamp)(object.submitTime) : undefined, + depositEndTime: (0, helpers_1.isSet)(object.depositEndTime) ? (0, helpers_1.fromJsonTimestamp)(object.depositEndTime) : undefined, + totalDeposit: Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e) => coin_1.Coin.fromJSON(e)) + : [], + votingStartTime: (0, helpers_1.isSet)(object.votingStartTime) ? (0, helpers_1.fromJsonTimestamp)(object.votingStartTime) : undefined, + votingEndTime: (0, helpers_1.isSet)(object.votingEndTime) ? (0, helpers_1.fromJsonTimestamp)(object.votingEndTime) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + message.content !== undefined && + (obj.content = message.content ? any_1.Any.toJSON(message.content) : undefined); + message.status !== undefined && (obj.status = proposalStatusToJSON(message.status)); + message.finalTallyResult !== undefined && + (obj.finalTallyResult = message.finalTallyResult + ? exports.TallyResult.toJSON(message.finalTallyResult) + : undefined); + message.submitTime !== undefined && (obj.submitTime = (0, helpers_1.fromTimestamp)(message.submitTime).toISOString()); + message.depositEndTime !== undefined && + (obj.depositEndTime = (0, helpers_1.fromTimestamp)(message.depositEndTime).toISOString()); + if (message.totalDeposit) { + obj.totalDeposit = message.totalDeposit.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.totalDeposit = []; + } + message.votingStartTime !== undefined && + (obj.votingStartTime = (0, helpers_1.fromTimestamp)(message.votingStartTime).toISOString()); + message.votingEndTime !== undefined && + (obj.votingEndTime = (0, helpers_1.fromTimestamp)(message.votingEndTime).toISOString()); + return obj; + }, + fromPartial(object) { + const message = createBaseProposal(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + message.content = + object.content !== undefined && object.content !== null ? any_1.Any.fromPartial(object.content) : undefined; + message.status = object.status ?? 0; + message.finalTallyResult = + object.finalTallyResult !== undefined && object.finalTallyResult !== null + ? exports.TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = + object.submitTime !== undefined && object.submitTime !== null + ? timestamp_1.Timestamp.fromPartial(object.submitTime) + : undefined; + message.depositEndTime = + object.depositEndTime !== undefined && object.depositEndTime !== null + ? timestamp_1.Timestamp.fromPartial(object.depositEndTime) + : undefined; + message.totalDeposit = object.totalDeposit?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.votingStartTime = + object.votingStartTime !== undefined && object.votingStartTime !== null + ? timestamp_1.Timestamp.fromPartial(object.votingStartTime) + : undefined; + message.votingEndTime = + object.votingEndTime !== undefined && object.votingEndTime !== null + ? timestamp_1.Timestamp.fromPartial(object.votingEndTime) + : undefined; + return message; + }, +}; +function createBaseTallyResult() { + return { + yes: "", + abstain: "", + no: "", + noWithVeto: "", + }; +} +exports.TallyResult = { + encode(message, writer = _m0.Writer.create()) { + if (message.yes !== "") { + writer.uint32(10).string(message.yes); + } + if (message.abstain !== "") { + writer.uint32(18).string(message.abstain); + } + if (message.no !== "") { + writer.uint32(26).string(message.no); + } + if (message.noWithVeto !== "") { + writer.uint32(34).string(message.noWithVeto); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.yes = reader.string(); + break; + case 2: + message.abstain = reader.string(); + break; + case 3: + message.no = reader.string(); + break; + case 4: + message.noWithVeto = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + yes: (0, helpers_1.isSet)(object.yes) ? String(object.yes) : "", + abstain: (0, helpers_1.isSet)(object.abstain) ? String(object.abstain) : "", + no: (0, helpers_1.isSet)(object.no) ? String(object.no) : "", + noWithVeto: (0, helpers_1.isSet)(object.noWithVeto) ? String(object.noWithVeto) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.yes !== undefined && (obj.yes = message.yes); + message.abstain !== undefined && (obj.abstain = message.abstain); + message.no !== undefined && (obj.no = message.no); + message.noWithVeto !== undefined && (obj.noWithVeto = message.noWithVeto); + return obj; + }, + fromPartial(object) { + const message = createBaseTallyResult(); + message.yes = object.yes ?? ""; + message.abstain = object.abstain ?? ""; + message.no = object.no ?? ""; + message.noWithVeto = object.noWithVeto ?? ""; + return message; + }, +}; +function createBaseVote() { + return { + proposalId: helpers_1.Long.UZERO, + voter: "", + option: 0, + options: [], + }; +} +exports.Vote = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + for (const v of message.options) { + exports.WeightedVoteOption.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = reader.int32(); + break; + case 4: + message.options.push(exports.WeightedVoteOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + voter: (0, helpers_1.isSet)(object.voter) ? String(object.voter) : "", + option: (0, helpers_1.isSet)(object.option) ? voteOptionFromJSON(object.option) : 0, + options: Array.isArray(object?.options) + ? object.options.map((e) => exports.WeightedVoteOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); + if (message.options) { + obj.options = message.options.map((e) => (e ? exports.WeightedVoteOption.toJSON(e) : undefined)); + } + else { + obj.options = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseVote(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.options = object.options?.map((e) => exports.WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseDepositParams() { + return { + minDeposit: [], + maxDepositPeriod: undefined, + }; +} +exports.DepositParams = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.minDeposit) { + coin_1.Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.maxDepositPeriod !== undefined) { + duration_1.Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minDeposit.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 2: + message.maxDepositPeriod = duration_1.Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + minDeposit: Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e) => coin_1.Coin.fromJSON(e)) + : [], + maxDepositPeriod: (0, helpers_1.isSet)(object.maxDepositPeriod) + ? duration_1.Duration.fromJSON(object.maxDepositPeriod) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.minDeposit) { + obj.minDeposit = message.minDeposit.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.minDeposit = []; + } + message.maxDepositPeriod !== undefined && + (obj.maxDepositPeriod = message.maxDepositPeriod + ? duration_1.Duration.toJSON(message.maxDepositPeriod) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.maxDepositPeriod = + object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null + ? duration_1.Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, +}; +function createBaseVotingParams() { + return { + votingPeriod: undefined, + }; +} +exports.VotingParams = { + encode(message, writer = _m0.Writer.create()) { + if (message.votingPeriod !== undefined) { + duration_1.Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingPeriod = duration_1.Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + votingPeriod: (0, helpers_1.isSet)(object.votingPeriod) ? duration_1.Duration.fromJSON(object.votingPeriod) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.votingPeriod !== undefined && + (obj.votingPeriod = message.votingPeriod ? duration_1.Duration.toJSON(message.votingPeriod) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseVotingParams(); + message.votingPeriod = + object.votingPeriod !== undefined && object.votingPeriod !== null + ? duration_1.Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, +}; +function createBaseTallyParams() { + return { + quorum: new Uint8Array(), + threshold: new Uint8Array(), + vetoThreshold: new Uint8Array(), + }; +} +exports.TallyParams = { + encode(message, writer = _m0.Writer.create()) { + if (message.quorum.length !== 0) { + writer.uint32(10).bytes(message.quorum); + } + if (message.threshold.length !== 0) { + writer.uint32(18).bytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + writer.uint32(26).bytes(message.vetoThreshold); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.quorum = reader.bytes(); + break; + case 2: + message.threshold = reader.bytes(); + break; + case 3: + message.vetoThreshold = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + quorum: (0, helpers_1.isSet)(object.quorum) ? (0, helpers_1.bytesFromBase64)(object.quorum) : new Uint8Array(), + threshold: (0, helpers_1.isSet)(object.threshold) ? (0, helpers_1.bytesFromBase64)(object.threshold) : new Uint8Array(), + vetoThreshold: (0, helpers_1.isSet)(object.vetoThreshold) ? (0, helpers_1.bytesFromBase64)(object.vetoThreshold) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.quorum !== undefined && + (obj.quorum = (0, helpers_1.base64FromBytes)(message.quorum !== undefined ? message.quorum : new Uint8Array())); + message.threshold !== undefined && + (obj.threshold = (0, helpers_1.base64FromBytes)(message.threshold !== undefined ? message.threshold : new Uint8Array())); + message.vetoThreshold !== undefined && + (obj.vetoThreshold = (0, helpers_1.base64FromBytes)(message.vetoThreshold !== undefined ? message.vetoThreshold : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseTallyParams(); + message.quorum = object.quorum ?? new Uint8Array(); + message.threshold = object.threshold ?? new Uint8Array(); + message.vetoThreshold = object.vetoThreshold ?? new Uint8Array(); + return message; + }, +}; +//# sourceMappingURL=gov.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/gov/v1beta1/query.js": +/*!***************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/gov/v1beta1/query.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QueryTallyResultResponse = exports.QueryTallyResultRequest = exports.QueryDepositsResponse = exports.QueryDepositsRequest = exports.QueryDepositResponse = exports.QueryDepositRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.QueryVotesResponse = exports.QueryVotesRequest = exports.QueryVoteResponse = exports.QueryVoteRequest = exports.QueryProposalsResponse = exports.QueryProposalsRequest = exports.QueryProposalResponse = exports.QueryProposalRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const gov_1 = __webpack_require__(/*! ./gov */ "./node_modules/cosmjs-types/cosmos/gov/v1beta1/gov.js"); +const pagination_1 = __webpack_require__(/*! ../../base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "cosmos.gov.v1beta1"; +function createBaseQueryProposalRequest() { + return { + proposalId: helpers_1.Long.UZERO, + }; +} +exports.QueryProposalRequest = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryProposalRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseQueryProposalResponse() { + return { + proposal: undefined, + }; +} +exports.QueryProposalResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.proposal !== undefined) { + gov_1.Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal = gov_1.Proposal.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposal: (0, helpers_1.isSet)(object.proposal) ? gov_1.Proposal.fromJSON(object.proposal) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.proposal !== undefined && + (obj.proposal = message.proposal ? gov_1.Proposal.toJSON(message.proposal) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryProposalResponse(); + message.proposal = + object.proposal !== undefined && object.proposal !== null + ? gov_1.Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, +}; +function createBaseQueryProposalsRequest() { + return { + proposalStatus: 0, + voter: "", + depositor: "", + pagination: undefined, + }; +} +exports.QueryProposalsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalStatus = reader.int32(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.depositor = reader.string(); + break; + case 4: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalStatus: (0, helpers_1.isSet)(object.proposalStatus) ? (0, gov_1.proposalStatusFromJSON)(object.proposalStatus) : 0, + voter: (0, helpers_1.isSet)(object.voter) ? String(object.voter) : "", + depositor: (0, helpers_1.isSet)(object.depositor) ? String(object.depositor) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.proposalStatus !== undefined && + (obj.proposalStatus = (0, gov_1.proposalStatusToJSON)(message.proposalStatus)); + message.voter !== undefined && (obj.voter = message.voter); + message.depositor !== undefined && (obj.depositor = message.depositor); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryProposalsRequest(); + message.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryProposalsResponse() { + return { + proposals: [], + pagination: undefined, + }; +} +exports.QueryProposalsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.proposals) { + gov_1.Proposal.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposals.push(gov_1.Proposal.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposals: Array.isArray(object?.proposals) + ? object.proposals.map((e) => gov_1.Proposal.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.proposals) { + obj.proposals = message.proposals.map((e) => (e ? gov_1.Proposal.toJSON(e) : undefined)); + } + else { + obj.proposals = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryProposalsResponse(); + message.proposals = object.proposals?.map((e) => gov_1.Proposal.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryVoteRequest() { + return { + proposalId: helpers_1.Long.UZERO, + voter: "", + }; +} +exports.QueryVoteRequest = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + voter: (0, helpers_1.isSet)(object.voter) ? String(object.voter) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + message.voter !== undefined && (obj.voter = message.voter); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryVoteRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + message.voter = object.voter ?? ""; + return message; + }, +}; +function createBaseQueryVoteResponse() { + return { + vote: undefined, + }; +} +exports.QueryVoteResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.vote !== undefined) { + gov_1.Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vote = gov_1.Vote.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + vote: (0, helpers_1.isSet)(object.vote) ? gov_1.Vote.fromJSON(object.vote) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.vote !== undefined && (obj.vote = message.vote ? gov_1.Vote.toJSON(message.vote) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryVoteResponse(); + message.vote = + object.vote !== undefined && object.vote !== null ? gov_1.Vote.fromPartial(object.vote) : undefined; + return message; + }, +}; +function createBaseQueryVotesRequest() { + return { + proposalId: helpers_1.Long.UZERO, + pagination: undefined, + }; +} +exports.QueryVotesRequest = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryVotesRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryVotesResponse() { + return { + votes: [], + pagination: undefined, + }; +} +exports.QueryVotesResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.votes) { + gov_1.Vote.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votes.push(gov_1.Vote.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + votes: Array.isArray(object?.votes) ? object.votes.map((e) => gov_1.Vote.fromJSON(e)) : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => (e ? gov_1.Vote.toJSON(e) : undefined)); + } + else { + obj.votes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryVotesResponse(); + message.votes = object.votes?.map((e) => gov_1.Vote.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryParamsRequest() { + return { + paramsType: "", + }; +} +exports.QueryParamsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.paramsType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + paramsType: (0, helpers_1.isSet)(object.paramsType) ? String(object.paramsType) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.paramsType !== undefined && (obj.paramsType = message.paramsType); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { + votingParams: undefined, + depositParams: undefined, + tallyParams: undefined, + }; +} +exports.QueryParamsResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.votingParams !== undefined) { + gov_1.VotingParams.encode(message.votingParams, writer.uint32(10).fork()).ldelim(); + } + if (message.depositParams !== undefined) { + gov_1.DepositParams.encode(message.depositParams, writer.uint32(18).fork()).ldelim(); + } + if (message.tallyParams !== undefined) { + gov_1.TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingParams = gov_1.VotingParams.decode(reader, reader.uint32()); + break; + case 2: + message.depositParams = gov_1.DepositParams.decode(reader, reader.uint32()); + break; + case 3: + message.tallyParams = gov_1.TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + votingParams: (0, helpers_1.isSet)(object.votingParams) ? gov_1.VotingParams.fromJSON(object.votingParams) : undefined, + depositParams: (0, helpers_1.isSet)(object.depositParams) ? gov_1.DepositParams.fromJSON(object.depositParams) : undefined, + tallyParams: (0, helpers_1.isSet)(object.tallyParams) ? gov_1.TallyParams.fromJSON(object.tallyParams) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.votingParams !== undefined && + (obj.votingParams = message.votingParams ? gov_1.VotingParams.toJSON(message.votingParams) : undefined); + message.depositParams !== undefined && + (obj.depositParams = message.depositParams ? gov_1.DepositParams.toJSON(message.depositParams) : undefined); + message.tallyParams !== undefined && + (obj.tallyParams = message.tallyParams ? gov_1.TallyParams.toJSON(message.tallyParams) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.votingParams = + object.votingParams !== undefined && object.votingParams !== null + ? gov_1.VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = + object.depositParams !== undefined && object.depositParams !== null + ? gov_1.DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = + object.tallyParams !== undefined && object.tallyParams !== null + ? gov_1.TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, +}; +function createBaseQueryDepositRequest() { + return { + proposalId: helpers_1.Long.UZERO, + depositor: "", + }; +} +exports.QueryDepositRequest = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + depositor: (0, helpers_1.isSet)(object.depositor) ? String(object.depositor) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + message.depositor !== undefined && (obj.depositor = message.depositor); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDepositRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + message.depositor = object.depositor ?? ""; + return message; + }, +}; +function createBaseQueryDepositResponse() { + return { + deposit: undefined, + }; +} +exports.QueryDepositResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.deposit !== undefined) { + gov_1.Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposit = gov_1.Deposit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + deposit: (0, helpers_1.isSet)(object.deposit) ? gov_1.Deposit.fromJSON(object.deposit) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.deposit !== undefined && + (obj.deposit = message.deposit ? gov_1.Deposit.toJSON(message.deposit) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDepositResponse(); + message.deposit = + object.deposit !== undefined && object.deposit !== null + ? gov_1.Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, +}; +function createBaseQueryDepositsRequest() { + return { + proposalId: helpers_1.Long.UZERO, + pagination: undefined, + }; +} +exports.QueryDepositsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDepositsRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryDepositsResponse() { + return { + deposits: [], + pagination: undefined, + }; +} +exports.QueryDepositsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.deposits) { + gov_1.Deposit.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposits.push(gov_1.Deposit.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + deposits: Array.isArray(object?.deposits) ? object.deposits.map((e) => gov_1.Deposit.fromJSON(e)) : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.deposits) { + obj.deposits = message.deposits.map((e) => (e ? gov_1.Deposit.toJSON(e) : undefined)); + } + else { + obj.deposits = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDepositsResponse(); + message.deposits = object.deposits?.map((e) => gov_1.Deposit.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryTallyResultRequest() { + return { + proposalId: helpers_1.Long.UZERO, + }; +} +exports.QueryTallyResultRequest = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseQueryTallyResultResponse() { + return { + tally: undefined, + }; +} +exports.QueryTallyResultResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.tally !== undefined) { + gov_1.TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tally = gov_1.TallyResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + tally: (0, helpers_1.isSet)(object.tally) ? gov_1.TallyResult.fromJSON(object.tally) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.tally !== undefined && + (obj.tally = message.tally ? gov_1.TallyResult.toJSON(message.tally) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryTallyResultResponse(); + message.tally = + object.tally !== undefined && object.tally !== null ? gov_1.TallyResult.fromPartial(object.tally) : undefined; + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Proposal = this.Proposal.bind(this); + this.Proposals = this.Proposals.bind(this); + this.Vote = this.Vote.bind(this); + this.Votes = this.Votes.bind(this); + this.Params = this.Params.bind(this); + this.Deposit = this.Deposit.bind(this); + this.Deposits = this.Deposits.bind(this); + this.TallyResult = this.TallyResult.bind(this); + } + Proposal(request) { + const data = exports.QueryProposalRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Proposal", data); + return promise.then((data) => exports.QueryProposalResponse.decode(new _m0.Reader(data))); + } + Proposals(request) { + const data = exports.QueryProposalsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Proposals", data); + return promise.then((data) => exports.QueryProposalsResponse.decode(new _m0.Reader(data))); + } + Vote(request) { + const data = exports.QueryVoteRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Vote", data); + return promise.then((data) => exports.QueryVoteResponse.decode(new _m0.Reader(data))); + } + Votes(request) { + const data = exports.QueryVotesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Votes", data); + return promise.then((data) => exports.QueryVotesResponse.decode(new _m0.Reader(data))); + } + Params(request) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new _m0.Reader(data))); + } + Deposit(request) { + const data = exports.QueryDepositRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Deposit", data); + return promise.then((data) => exports.QueryDepositResponse.decode(new _m0.Reader(data))); + } + Deposits(request) { + const data = exports.QueryDepositsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Deposits", data); + return promise.then((data) => exports.QueryDepositsResponse.decode(new _m0.Reader(data))); + } + TallyResult(request) { + const data = exports.QueryTallyResultRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "TallyResult", data); + return promise.then((data) => exports.QueryTallyResultResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/gov/v1beta1/tx.js": +/*!************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/gov/v1beta1/tx.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MsgClientImpl = exports.MsgDepositResponse = exports.MsgDeposit = exports.MsgVoteWeightedResponse = exports.MsgVoteWeighted = exports.MsgVoteResponse = exports.MsgVote = exports.MsgSubmitProposalResponse = exports.MsgSubmitProposal = exports.protobufPackage = void 0; +/* eslint-disable */ +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const gov_1 = __webpack_require__(/*! ./gov */ "./node_modules/cosmjs-types/cosmos/gov/v1beta1/gov.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.gov.v1beta1"; +function createBaseMsgSubmitProposal() { + return { + content: undefined, + initialDeposit: [], + proposer: "", + }; +} +exports.MsgSubmitProposal = { + encode(message, writer = _m0.Writer.create()) { + if (message.content !== undefined) { + any_1.Any.encode(message.content, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.initialDeposit) { + coin_1.Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content = any_1.Any.decode(reader, reader.uint32()); + break; + case 2: + message.initialDeposit.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 3: + message.proposer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + content: (0, helpers_1.isSet)(object.content) ? any_1.Any.fromJSON(object.content) : undefined, + initialDeposit: Array.isArray(object?.initialDeposit) + ? object.initialDeposit.map((e) => coin_1.Coin.fromJSON(e)) + : [], + proposer: (0, helpers_1.isSet)(object.proposer) ? String(object.proposer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.content !== undefined && + (obj.content = message.content ? any_1.Any.toJSON(message.content) : undefined); + if (message.initialDeposit) { + obj.initialDeposit = message.initialDeposit.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.initialDeposit = []; + } + message.proposer !== undefined && (obj.proposer = message.proposer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgSubmitProposal(); + message.content = + object.content !== undefined && object.content !== null ? any_1.Any.fromPartial(object.content) : undefined; + message.initialDeposit = object.initialDeposit?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + return message; + }, +}; +function createBaseMsgSubmitProposalResponse() { + return { + proposalId: helpers_1.Long.UZERO, + }; +} +exports.MsgSubmitProposalResponse = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseMsgVote() { + return { + proposalId: helpers_1.Long.UZERO, + voter: "", + option: 0, + }; +} +exports.MsgVote = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + voter: (0, helpers_1.isSet)(object.voter) ? String(object.voter) : "", + option: (0, helpers_1.isSet)(object.option) ? (0, gov_1.voteOptionFromJSON)(object.option) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && (obj.option = (0, gov_1.voteOptionToJSON)(message.option)); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgVote(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + return message; + }, +}; +function createBaseMsgVoteResponse() { + return {}; +} +exports.MsgVoteResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; +function createBaseMsgVoteWeighted() { + return { + proposalId: helpers_1.Long.UZERO, + voter: "", + options: [], + }; +} +exports.MsgVoteWeighted = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + gov_1.WeightedVoteOption.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.options.push(gov_1.WeightedVoteOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + voter: (0, helpers_1.isSet)(object.voter) ? String(object.voter) : "", + options: Array.isArray(object?.options) + ? object.options.map((e) => gov_1.WeightedVoteOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + message.voter !== undefined && (obj.voter = message.voter); + if (message.options) { + obj.options = message.options.map((e) => (e ? gov_1.WeightedVoteOption.toJSON(e) : undefined)); + } + else { + obj.options = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseMsgVoteWeighted(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => gov_1.WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgVoteWeightedResponse() { + return {}; +} +exports.MsgVoteWeightedResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; +function createBaseMsgDeposit() { + return { + proposalId: helpers_1.Long.UZERO, + depositor: "", + amount: [], + }; +} +exports.MsgDeposit = { + encode(message, writer = _m0.Writer.create()) { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + coin_1.Coin.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proposalId: (0, helpers_1.isSet)(object.proposalId) ? helpers_1.Long.fromValue(object.proposalId) : helpers_1.Long.UZERO, + depositor: (0, helpers_1.isSet)(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e) => coin_1.Coin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.proposalId !== undefined && (obj.proposalId = (message.proposalId || helpers_1.Long.UZERO).toString()); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.amount = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseMsgDeposit(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? helpers_1.Long.fromValue(object.proposalId) + : helpers_1.Long.UZERO; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgDepositResponse() { + return {}; +} +exports.MsgDepositResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; +class MsgClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteWeighted = this.VoteWeighted.bind(this); + this.Deposit = this.Deposit.bind(this); + } + SubmitProposal(request) { + const data = exports.MsgSubmitProposal.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "SubmitProposal", data); + return promise.then((data) => exports.MsgSubmitProposalResponse.decode(new _m0.Reader(data))); + } + Vote(request) { + const data = exports.MsgVote.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "Vote", data); + return promise.then((data) => exports.MsgVoteResponse.decode(new _m0.Reader(data))); + } + VoteWeighted(request) { + const data = exports.MsgVoteWeighted.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "VoteWeighted", data); + return promise.then((data) => exports.MsgVoteWeightedResponse.decode(new _m0.Reader(data))); + } + Deposit(request) { + const data = exports.MsgDeposit.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "Deposit", data); + return promise.then((data) => exports.MsgDepositResponse.decode(new _m0.Reader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +//# sourceMappingURL=tx.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/mint/v1beta1/mint.js": +/*!***************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/mint/v1beta1/mint.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Params = exports.Minter = exports.protobufPackage = void 0; +/* eslint-disable */ +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.mint.v1beta1"; +function createBaseMinter() { + return { + inflation: "", + annualProvisions: "", + }; +} +exports.Minter = { + encode(message, writer = _m0.Writer.create()) { + if (message.inflation !== "") { + writer.uint32(10).string(message.inflation); + } + if (message.annualProvisions !== "") { + writer.uint32(18).string(message.annualProvisions); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMinter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inflation = reader.string(); + break; + case 2: + message.annualProvisions = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + inflation: (0, helpers_1.isSet)(object.inflation) ? String(object.inflation) : "", + annualProvisions: (0, helpers_1.isSet)(object.annualProvisions) ? String(object.annualProvisions) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.inflation !== undefined && (obj.inflation = message.inflation); + message.annualProvisions !== undefined && (obj.annualProvisions = message.annualProvisions); + return obj; + }, + fromPartial(object) { + const message = createBaseMinter(); + message.inflation = object.inflation ?? ""; + message.annualProvisions = object.annualProvisions ?? ""; + return message; + }, +}; +function createBaseParams() { + return { + mintDenom: "", + inflationRateChange: "", + inflationMax: "", + inflationMin: "", + goalBonded: "", + blocksPerYear: helpers_1.Long.UZERO, + }; +} +exports.Params = { + encode(message, writer = _m0.Writer.create()) { + if (message.mintDenom !== "") { + writer.uint32(10).string(message.mintDenom); + } + if (message.inflationRateChange !== "") { + writer.uint32(18).string(message.inflationRateChange); + } + if (message.inflationMax !== "") { + writer.uint32(26).string(message.inflationMax); + } + if (message.inflationMin !== "") { + writer.uint32(34).string(message.inflationMin); + } + if (message.goalBonded !== "") { + writer.uint32(42).string(message.goalBonded); + } + if (!message.blocksPerYear.isZero()) { + writer.uint32(48).uint64(message.blocksPerYear); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mintDenom = reader.string(); + break; + case 2: + message.inflationRateChange = reader.string(); + break; + case 3: + message.inflationMax = reader.string(); + break; + case 4: + message.inflationMin = reader.string(); + break; + case 5: + message.goalBonded = reader.string(); + break; + case 6: + message.blocksPerYear = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + mintDenom: (0, helpers_1.isSet)(object.mintDenom) ? String(object.mintDenom) : "", + inflationRateChange: (0, helpers_1.isSet)(object.inflationRateChange) ? String(object.inflationRateChange) : "", + inflationMax: (0, helpers_1.isSet)(object.inflationMax) ? String(object.inflationMax) : "", + inflationMin: (0, helpers_1.isSet)(object.inflationMin) ? String(object.inflationMin) : "", + goalBonded: (0, helpers_1.isSet)(object.goalBonded) ? String(object.goalBonded) : "", + blocksPerYear: (0, helpers_1.isSet)(object.blocksPerYear) ? helpers_1.Long.fromValue(object.blocksPerYear) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.mintDenom !== undefined && (obj.mintDenom = message.mintDenom); + message.inflationRateChange !== undefined && (obj.inflationRateChange = message.inflationRateChange); + message.inflationMax !== undefined && (obj.inflationMax = message.inflationMax); + message.inflationMin !== undefined && (obj.inflationMin = message.inflationMin); + message.goalBonded !== undefined && (obj.goalBonded = message.goalBonded); + message.blocksPerYear !== undefined && + (obj.blocksPerYear = (message.blocksPerYear || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseParams(); + message.mintDenom = object.mintDenom ?? ""; + message.inflationRateChange = object.inflationRateChange ?? ""; + message.inflationMax = object.inflationMax ?? ""; + message.inflationMin = object.inflationMin ?? ""; + message.goalBonded = object.goalBonded ?? ""; + message.blocksPerYear = + object.blocksPerYear !== undefined && object.blocksPerYear !== null + ? helpers_1.Long.fromValue(object.blocksPerYear) + : helpers_1.Long.UZERO; + return message; + }, +}; +//# sourceMappingURL=mint.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/mint/v1beta1/query.js": +/*!****************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/mint/v1beta1/query.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QueryAnnualProvisionsResponse = exports.QueryAnnualProvisionsRequest = exports.QueryInflationResponse = exports.QueryInflationRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const mint_1 = __webpack_require__(/*! ./mint */ "./node_modules/cosmjs-types/cosmos/mint/v1beta1/mint.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.mint.v1beta1"; +function createBaseQueryParamsRequest() { + return {}; +} +exports.QueryParamsRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { + params: undefined, + }; +} +exports.QueryParamsResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.params !== undefined) { + mint_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = mint_1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + params: (0, helpers_1.isSet)(object.params) ? mint_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.params !== undefined && (obj.params = message.params ? mint_1.Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null ? mint_1.Params.fromPartial(object.params) : undefined; + return message; + }, +}; +function createBaseQueryInflationRequest() { + return {}; +} +exports.QueryInflationRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryInflationRequest(); + return message; + }, +}; +function createBaseQueryInflationResponse() { + return { + inflation: new Uint8Array(), + }; +} +exports.QueryInflationResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.inflation.length !== 0) { + writer.uint32(10).bytes(message.inflation); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inflation = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + inflation: (0, helpers_1.isSet)(object.inflation) ? (0, helpers_1.bytesFromBase64)(object.inflation) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.inflation !== undefined && + (obj.inflation = (0, helpers_1.base64FromBytes)(message.inflation !== undefined ? message.inflation : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryInflationResponse(); + message.inflation = object.inflation ?? new Uint8Array(); + return message; + }, +}; +function createBaseQueryAnnualProvisionsRequest() { + return {}; +} +exports.QueryAnnualProvisionsRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryAnnualProvisionsRequest(); + return message; + }, +}; +function createBaseQueryAnnualProvisionsResponse() { + return { + annualProvisions: new Uint8Array(), + }; +} +exports.QueryAnnualProvisionsResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.annualProvisions.length !== 0) { + writer.uint32(10).bytes(message.annualProvisions); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.annualProvisions = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + annualProvisions: (0, helpers_1.isSet)(object.annualProvisions) + ? (0, helpers_1.bytesFromBase64)(object.annualProvisions) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.annualProvisions !== undefined && + (obj.annualProvisions = (0, helpers_1.base64FromBytes)(message.annualProvisions !== undefined ? message.annualProvisions : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryAnnualProvisionsResponse(); + message.annualProvisions = object.annualProvisions ?? new Uint8Array(); + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Inflation = this.Inflation.bind(this); + this.AnnualProvisions = this.AnnualProvisions.bind(this); + } + Params(request = {}) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.mint.v1beta1.Query", "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new _m0.Reader(data))); + } + Inflation(request = {}) { + const data = exports.QueryInflationRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.mint.v1beta1.Query", "Inflation", data); + return promise.then((data) => exports.QueryInflationResponse.decode(new _m0.Reader(data))); + } + AnnualProvisions(request = {}) { + const data = exports.QueryAnnualProvisionsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.mint.v1beta1.Query", "AnnualProvisions", data); + return promise.then((data) => exports.QueryAnnualProvisionsResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/slashing/v1beta1/query.js": +/*!********************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/slashing/v1beta1/query.js ***! + \********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QuerySigningInfosResponse = exports.QuerySigningInfosRequest = exports.QuerySigningInfoResponse = exports.QuerySigningInfoRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const pagination_1 = __webpack_require__(/*! ../../base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const slashing_1 = __webpack_require__(/*! ./slashing */ "./node_modules/cosmjs-types/cosmos/slashing/v1beta1/slashing.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.slashing.v1beta1"; +function createBaseQueryParamsRequest() { + return {}; +} +exports.QueryParamsRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { + params: undefined, + }; +} +exports.QueryParamsResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.params !== undefined) { + slashing_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = slashing_1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + params: (0, helpers_1.isSet)(object.params) ? slashing_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.params !== undefined && (obj.params = message.params ? slashing_1.Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null ? slashing_1.Params.fromPartial(object.params) : undefined; + return message; + }, +}; +function createBaseQuerySigningInfoRequest() { + return { + consAddress: "", + }; +} +exports.QuerySigningInfoRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.consAddress !== "") { + writer.uint32(10).string(message.consAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + consAddress: (0, helpers_1.isSet)(object.consAddress) ? String(object.consAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.consAddress !== undefined && (obj.consAddress = message.consAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseQuerySigningInfoRequest(); + message.consAddress = object.consAddress ?? ""; + return message; + }, +}; +function createBaseQuerySigningInfoResponse() { + return { + valSigningInfo: undefined, + }; +} +exports.QuerySigningInfoResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.valSigningInfo !== undefined) { + slashing_1.ValidatorSigningInfo.encode(message.valSigningInfo, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.valSigningInfo = slashing_1.ValidatorSigningInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + valSigningInfo: (0, helpers_1.isSet)(object.valSigningInfo) + ? slashing_1.ValidatorSigningInfo.fromJSON(object.valSigningInfo) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.valSigningInfo !== undefined && + (obj.valSigningInfo = message.valSigningInfo + ? slashing_1.ValidatorSigningInfo.toJSON(message.valSigningInfo) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQuerySigningInfoResponse(); + message.valSigningInfo = + object.valSigningInfo !== undefined && object.valSigningInfo !== null + ? slashing_1.ValidatorSigningInfo.fromPartial(object.valSigningInfo) + : undefined; + return message; + }, +}; +function createBaseQuerySigningInfosRequest() { + return { + pagination: undefined, + }; +} +exports.QuerySigningInfosRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfosRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQuerySigningInfosRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQuerySigningInfosResponse() { + return { + info: [], + pagination: undefined, + }; +} +exports.QuerySigningInfosResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.info) { + slashing_1.ValidatorSigningInfo.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfosResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.info.push(slashing_1.ValidatorSigningInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + info: Array.isArray(object?.info) ? object.info.map((e) => slashing_1.ValidatorSigningInfo.fromJSON(e)) : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.info) { + obj.info = message.info.map((e) => (e ? slashing_1.ValidatorSigningInfo.toJSON(e) : undefined)); + } + else { + obj.info = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQuerySigningInfosResponse(); + message.info = object.info?.map((e) => slashing_1.ValidatorSigningInfo.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.SigningInfo = this.SigningInfo.bind(this); + this.SigningInfos = this.SigningInfos.bind(this); + } + Params(request = {}) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.slashing.v1beta1.Query", "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new _m0.Reader(data))); + } + SigningInfo(request) { + const data = exports.QuerySigningInfoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.slashing.v1beta1.Query", "SigningInfo", data); + return promise.then((data) => exports.QuerySigningInfoResponse.decode(new _m0.Reader(data))); + } + SigningInfos(request = { + pagination: undefined, + }) { + const data = exports.QuerySigningInfosRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.slashing.v1beta1.Query", "SigningInfos", data); + return promise.then((data) => exports.QuerySigningInfosResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/slashing/v1beta1/slashing.js": +/*!***********************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/slashing/v1beta1/slashing.js ***! + \***********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Params = exports.ValidatorSigningInfo = exports.protobufPackage = void 0; +/* eslint-disable */ +const timestamp_1 = __webpack_require__(/*! ../../../google/protobuf/timestamp */ "./node_modules/cosmjs-types/google/protobuf/timestamp.js"); +const duration_1 = __webpack_require__(/*! ../../../google/protobuf/duration */ "./node_modules/cosmjs-types/google/protobuf/duration.js"); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "cosmos.slashing.v1beta1"; +function createBaseValidatorSigningInfo() { + return { + address: "", + startHeight: helpers_1.Long.ZERO, + indexOffset: helpers_1.Long.ZERO, + jailedUntil: undefined, + tombstoned: false, + missedBlocksCounter: helpers_1.Long.ZERO, + }; +} +exports.ValidatorSigningInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (!message.startHeight.isZero()) { + writer.uint32(16).int64(message.startHeight); + } + if (!message.indexOffset.isZero()) { + writer.uint32(24).int64(message.indexOffset); + } + if (message.jailedUntil !== undefined) { + timestamp_1.Timestamp.encode(message.jailedUntil, writer.uint32(34).fork()).ldelim(); + } + if (message.tombstoned === true) { + writer.uint32(40).bool(message.tombstoned); + } + if (!message.missedBlocksCounter.isZero()) { + writer.uint32(48).int64(message.missedBlocksCounter); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSigningInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.startHeight = reader.int64(); + break; + case 3: + message.indexOffset = reader.int64(); + break; + case 4: + message.jailedUntil = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.tombstoned = reader.bool(); + break; + case 6: + message.missedBlocksCounter = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + address: (0, helpers_1.isSet)(object.address) ? String(object.address) : "", + startHeight: (0, helpers_1.isSet)(object.startHeight) ? helpers_1.Long.fromValue(object.startHeight) : helpers_1.Long.ZERO, + indexOffset: (0, helpers_1.isSet)(object.indexOffset) ? helpers_1.Long.fromValue(object.indexOffset) : helpers_1.Long.ZERO, + jailedUntil: (0, helpers_1.isSet)(object.jailedUntil) ? (0, helpers_1.fromJsonTimestamp)(object.jailedUntil) : undefined, + tombstoned: (0, helpers_1.isSet)(object.tombstoned) ? Boolean(object.tombstoned) : false, + missedBlocksCounter: (0, helpers_1.isSet)(object.missedBlocksCounter) + ? helpers_1.Long.fromValue(object.missedBlocksCounter) + : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && (obj.address = message.address); + message.startHeight !== undefined && (obj.startHeight = (message.startHeight || helpers_1.Long.ZERO).toString()); + message.indexOffset !== undefined && (obj.indexOffset = (message.indexOffset || helpers_1.Long.ZERO).toString()); + message.jailedUntil !== undefined && (obj.jailedUntil = (0, helpers_1.fromTimestamp)(message.jailedUntil).toISOString()); + message.tombstoned !== undefined && (obj.tombstoned = message.tombstoned); + message.missedBlocksCounter !== undefined && + (obj.missedBlocksCounter = (message.missedBlocksCounter || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseValidatorSigningInfo(); + message.address = object.address ?? ""; + message.startHeight = + object.startHeight !== undefined && object.startHeight !== null + ? helpers_1.Long.fromValue(object.startHeight) + : helpers_1.Long.ZERO; + message.indexOffset = + object.indexOffset !== undefined && object.indexOffset !== null + ? helpers_1.Long.fromValue(object.indexOffset) + : helpers_1.Long.ZERO; + message.jailedUntil = + object.jailedUntil !== undefined && object.jailedUntil !== null + ? timestamp_1.Timestamp.fromPartial(object.jailedUntil) + : undefined; + message.tombstoned = object.tombstoned ?? false; + message.missedBlocksCounter = + object.missedBlocksCounter !== undefined && object.missedBlocksCounter !== null + ? helpers_1.Long.fromValue(object.missedBlocksCounter) + : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseParams() { + return { + signedBlocksWindow: helpers_1.Long.ZERO, + minSignedPerWindow: new Uint8Array(), + downtimeJailDuration: undefined, + slashFractionDoubleSign: new Uint8Array(), + slashFractionDowntime: new Uint8Array(), + }; +} +exports.Params = { + encode(message, writer = _m0.Writer.create()) { + if (!message.signedBlocksWindow.isZero()) { + writer.uint32(8).int64(message.signedBlocksWindow); + } + if (message.minSignedPerWindow.length !== 0) { + writer.uint32(18).bytes(message.minSignedPerWindow); + } + if (message.downtimeJailDuration !== undefined) { + duration_1.Duration.encode(message.downtimeJailDuration, writer.uint32(26).fork()).ldelim(); + } + if (message.slashFractionDoubleSign.length !== 0) { + writer.uint32(34).bytes(message.slashFractionDoubleSign); + } + if (message.slashFractionDowntime.length !== 0) { + writer.uint32(42).bytes(message.slashFractionDowntime); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signedBlocksWindow = reader.int64(); + break; + case 2: + message.minSignedPerWindow = reader.bytes(); + break; + case 3: + message.downtimeJailDuration = duration_1.Duration.decode(reader, reader.uint32()); + break; + case 4: + message.slashFractionDoubleSign = reader.bytes(); + break; + case 5: + message.slashFractionDowntime = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + signedBlocksWindow: (0, helpers_1.isSet)(object.signedBlocksWindow) + ? helpers_1.Long.fromValue(object.signedBlocksWindow) + : helpers_1.Long.ZERO, + minSignedPerWindow: (0, helpers_1.isSet)(object.minSignedPerWindow) + ? (0, helpers_1.bytesFromBase64)(object.minSignedPerWindow) + : new Uint8Array(), + downtimeJailDuration: (0, helpers_1.isSet)(object.downtimeJailDuration) + ? duration_1.Duration.fromJSON(object.downtimeJailDuration) + : undefined, + slashFractionDoubleSign: (0, helpers_1.isSet)(object.slashFractionDoubleSign) + ? (0, helpers_1.bytesFromBase64)(object.slashFractionDoubleSign) + : new Uint8Array(), + slashFractionDowntime: (0, helpers_1.isSet)(object.slashFractionDowntime) + ? (0, helpers_1.bytesFromBase64)(object.slashFractionDowntime) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.signedBlocksWindow !== undefined && + (obj.signedBlocksWindow = (message.signedBlocksWindow || helpers_1.Long.ZERO).toString()); + message.minSignedPerWindow !== undefined && + (obj.minSignedPerWindow = (0, helpers_1.base64FromBytes)(message.minSignedPerWindow !== undefined ? message.minSignedPerWindow : new Uint8Array())); + message.downtimeJailDuration !== undefined && + (obj.downtimeJailDuration = message.downtimeJailDuration + ? duration_1.Duration.toJSON(message.downtimeJailDuration) + : undefined); + message.slashFractionDoubleSign !== undefined && + (obj.slashFractionDoubleSign = (0, helpers_1.base64FromBytes)(message.slashFractionDoubleSign !== undefined ? message.slashFractionDoubleSign : new Uint8Array())); + message.slashFractionDowntime !== undefined && + (obj.slashFractionDowntime = (0, helpers_1.base64FromBytes)(message.slashFractionDowntime !== undefined ? message.slashFractionDowntime : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseParams(); + message.signedBlocksWindow = + object.signedBlocksWindow !== undefined && object.signedBlocksWindow !== null + ? helpers_1.Long.fromValue(object.signedBlocksWindow) + : helpers_1.Long.ZERO; + message.minSignedPerWindow = object.minSignedPerWindow ?? new Uint8Array(); + message.downtimeJailDuration = + object.downtimeJailDuration !== undefined && object.downtimeJailDuration !== null + ? duration_1.Duration.fromPartial(object.downtimeJailDuration) + : undefined; + message.slashFractionDoubleSign = object.slashFractionDoubleSign ?? new Uint8Array(); + message.slashFractionDowntime = object.slashFractionDowntime ?? new Uint8Array(); + return message; + }, +}; +//# sourceMappingURL=slashing.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/staking/v1beta1/query.js": +/*!*******************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/staking/v1beta1/query.js ***! + \*******************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.QueryPoolResponse = exports.QueryPoolRequest = exports.QueryHistoricalInfoResponse = exports.QueryHistoricalInfoRequest = exports.QueryDelegatorValidatorResponse = exports.QueryDelegatorValidatorRequest = exports.QueryDelegatorValidatorsResponse = exports.QueryDelegatorValidatorsRequest = exports.QueryRedelegationsResponse = exports.QueryRedelegationsRequest = exports.QueryDelegatorUnbondingDelegationsResponse = exports.QueryDelegatorUnbondingDelegationsRequest = exports.QueryDelegatorDelegationsResponse = exports.QueryDelegatorDelegationsRequest = exports.QueryUnbondingDelegationResponse = exports.QueryUnbondingDelegationRequest = exports.QueryDelegationResponse = exports.QueryDelegationRequest = exports.QueryValidatorUnbondingDelegationsResponse = exports.QueryValidatorUnbondingDelegationsRequest = exports.QueryValidatorDelegationsResponse = exports.QueryValidatorDelegationsRequest = exports.QueryValidatorResponse = exports.QueryValidatorRequest = exports.QueryValidatorsResponse = exports.QueryValidatorsRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const pagination_1 = __webpack_require__(/*! ../../base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const staking_1 = __webpack_require__(/*! ./staking */ "./node_modules/cosmjs-types/cosmos/staking/v1beta1/staking.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.staking.v1beta1"; +function createBaseQueryValidatorsRequest() { + return { + status: "", + pagination: undefined, + }; +} +exports.QueryValidatorsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + status: (0, helpers_1.isSet)(object.status) ? String(object.status) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.status !== undefined && (obj.status = message.status); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorsRequest(); + message.status = object.status ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryValidatorsResponse() { + return { + validators: [], + pagination: undefined, + }; +} +exports.QueryValidatorsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.validators) { + staking_1.Validator.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validators.push(staking_1.Validator.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validators: Array.isArray(object?.validators) + ? object.validators.map((e) => staking_1.Validator.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => (e ? staking_1.Validator.toJSON(e) : undefined)); + } + else { + obj.validators = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorsResponse(); + message.validators = object.validators?.map((e) => staking_1.Validator.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryValidatorRequest() { + return { + validatorAddr: "", + }; +} +exports.QueryValidatorRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validatorAddr: (0, helpers_1.isSet)(object.validatorAddr) ? String(object.validatorAddr) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; +function createBaseQueryValidatorResponse() { + return { + validator: undefined, + }; +} +exports.QueryValidatorResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.validator !== undefined) { + staking_1.Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = staking_1.Validator.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validator: (0, helpers_1.isSet)(object.validator) ? staking_1.Validator.fromJSON(object.validator) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.validator !== undefined && + (obj.validator = message.validator ? staking_1.Validator.toJSON(message.validator) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorResponse(); + message.validator = + object.validator !== undefined && object.validator !== null + ? staking_1.Validator.fromPartial(object.validator) + : undefined; + return message; + }, +}; +function createBaseQueryValidatorDelegationsRequest() { + return { + validatorAddr: "", + pagination: undefined, + }; +} +exports.QueryValidatorDelegationsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddr = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validatorAddr: (0, helpers_1.isSet)(object.validatorAddr) ? String(object.validatorAddr) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryValidatorDelegationsResponse() { + return { + delegationResponses: [], + pagination: undefined, + }; +} +exports.QueryValidatorDelegationsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.delegationResponses) { + staking_1.DelegationResponse.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegationResponses.push(staking_1.DelegationResponse.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegationResponses: Array.isArray(object?.delegationResponses) + ? object.delegationResponses.map((e) => staking_1.DelegationResponse.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.delegationResponses) { + obj.delegationResponses = message.delegationResponses.map((e) => e ? staking_1.DelegationResponse.toJSON(e) : undefined); + } + else { + obj.delegationResponses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegationResponses = + object.delegationResponses?.map((e) => staking_1.DelegationResponse.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryValidatorUnbondingDelegationsRequest() { + return { + validatorAddr: "", + pagination: undefined, + }; +} +exports.QueryValidatorUnbondingDelegationsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddr = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validatorAddr: (0, helpers_1.isSet)(object.validatorAddr) ? String(object.validatorAddr) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryValidatorUnbondingDelegationsResponse() { + return { + unbondingResponses: [], + pagination: undefined, + }; +} +exports.QueryValidatorUnbondingDelegationsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.unbondingResponses) { + staking_1.UnbondingDelegation.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbondingResponses.push(staking_1.UnbondingDelegation.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + unbondingResponses: Array.isArray(object?.unbondingResponses) + ? object.unbondingResponses.map((e) => staking_1.UnbondingDelegation.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.unbondingResponses) { + obj.unbondingResponses = message.unbondingResponses.map((e) => e ? staking_1.UnbondingDelegation.toJSON(e) : undefined); + } + else { + obj.unbondingResponses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbondingResponses = + object.unbondingResponses?.map((e) => staking_1.UnbondingDelegation.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryDelegationRequest() { + return { + delegatorAddr: "", + validatorAddr: "", + }; +} +exports.QueryDelegationRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.validatorAddr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddr: (0, helpers_1.isSet)(object.delegatorAddr) ? String(object.delegatorAddr) : "", + validatorAddr: (0, helpers_1.isSet)(object.validatorAddr) ? String(object.validatorAddr) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; +function createBaseQueryDelegationResponse() { + return { + delegationResponse: undefined, + }; +} +exports.QueryDelegationResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegationResponse !== undefined) { + staking_1.DelegationResponse.encode(message.delegationResponse, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegationResponse = staking_1.DelegationResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegationResponse: (0, helpers_1.isSet)(object.delegationResponse) + ? staking_1.DelegationResponse.fromJSON(object.delegationResponse) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.delegationResponse !== undefined && + (obj.delegationResponse = message.delegationResponse + ? staking_1.DelegationResponse.toJSON(message.delegationResponse) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegationResponse(); + message.delegationResponse = + object.delegationResponse !== undefined && object.delegationResponse !== null + ? staking_1.DelegationResponse.fromPartial(object.delegationResponse) + : undefined; + return message; + }, +}; +function createBaseQueryUnbondingDelegationRequest() { + return { + delegatorAddr: "", + validatorAddr: "", + }; +} +exports.QueryUnbondingDelegationRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.validatorAddr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddr: (0, helpers_1.isSet)(object.delegatorAddr) ? String(object.delegatorAddr) : "", + validatorAddr: (0, helpers_1.isSet)(object.validatorAddr) ? String(object.validatorAddr) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryUnbondingDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; +function createBaseQueryUnbondingDelegationResponse() { + return { + unbond: undefined, + }; +} +exports.QueryUnbondingDelegationResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.unbond !== undefined) { + staking_1.UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbond = staking_1.UnbondingDelegation.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + unbond: (0, helpers_1.isSet)(object.unbond) ? staking_1.UnbondingDelegation.fromJSON(object.unbond) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.unbond !== undefined && + (obj.unbond = message.unbond ? staking_1.UnbondingDelegation.toJSON(message.unbond) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryUnbondingDelegationResponse(); + message.unbond = + object.unbond !== undefined && object.unbond !== null + ? staking_1.UnbondingDelegation.fromPartial(object.unbond) + : undefined; + return message; + }, +}; +function createBaseQueryDelegatorDelegationsRequest() { + return { + delegatorAddr: "", + pagination: undefined, + }; +} +exports.QueryDelegatorDelegationsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddr: (0, helpers_1.isSet)(object.delegatorAddr) ? String(object.delegatorAddr) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegatorDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryDelegatorDelegationsResponse() { + return { + delegationResponses: [], + pagination: undefined, + }; +} +exports.QueryDelegatorDelegationsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.delegationResponses) { + staking_1.DelegationResponse.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegationResponses.push(staking_1.DelegationResponse.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegationResponses: Array.isArray(object?.delegationResponses) + ? object.delegationResponses.map((e) => staking_1.DelegationResponse.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.delegationResponses) { + obj.delegationResponses = message.delegationResponses.map((e) => e ? staking_1.DelegationResponse.toJSON(e) : undefined); + } + else { + obj.delegationResponses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegationResponses = + object.delegationResponses?.map((e) => staking_1.DelegationResponse.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryDelegatorUnbondingDelegationsRequest() { + return { + delegatorAddr: "", + pagination: undefined, + }; +} +exports.QueryDelegatorUnbondingDelegationsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddr: (0, helpers_1.isSet)(object.delegatorAddr) ? String(object.delegatorAddr) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryDelegatorUnbondingDelegationsResponse() { + return { + unbondingResponses: [], + pagination: undefined, + }; +} +exports.QueryDelegatorUnbondingDelegationsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.unbondingResponses) { + staking_1.UnbondingDelegation.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbondingResponses.push(staking_1.UnbondingDelegation.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + unbondingResponses: Array.isArray(object?.unbondingResponses) + ? object.unbondingResponses.map((e) => staking_1.UnbondingDelegation.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.unbondingResponses) { + obj.unbondingResponses = message.unbondingResponses.map((e) => e ? staking_1.UnbondingDelegation.toJSON(e) : undefined); + } + else { + obj.unbondingResponses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbondingResponses = + object.unbondingResponses?.map((e) => staking_1.UnbondingDelegation.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryRedelegationsRequest() { + return { + delegatorAddr: "", + srcValidatorAddr: "", + dstValidatorAddr: "", + pagination: undefined, + }; +} +exports.QueryRedelegationsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.srcValidatorAddr !== "") { + writer.uint32(18).string(message.srcValidatorAddr); + } + if (message.dstValidatorAddr !== "") { + writer.uint32(26).string(message.dstValidatorAddr); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.srcValidatorAddr = reader.string(); + break; + case 3: + message.dstValidatorAddr = reader.string(); + break; + case 4: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddr: (0, helpers_1.isSet)(object.delegatorAddr) ? String(object.delegatorAddr) : "", + srcValidatorAddr: (0, helpers_1.isSet)(object.srcValidatorAddr) ? String(object.srcValidatorAddr) : "", + dstValidatorAddr: (0, helpers_1.isSet)(object.dstValidatorAddr) ? String(object.dstValidatorAddr) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.srcValidatorAddr !== undefined && (obj.srcValidatorAddr = message.srcValidatorAddr); + message.dstValidatorAddr !== undefined && (obj.dstValidatorAddr = message.dstValidatorAddr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryRedelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.srcValidatorAddr = object.srcValidatorAddr ?? ""; + message.dstValidatorAddr = object.dstValidatorAddr ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryRedelegationsResponse() { + return { + redelegationResponses: [], + pagination: undefined, + }; +} +exports.QueryRedelegationsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.redelegationResponses) { + staking_1.RedelegationResponse.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegationResponses.push(staking_1.RedelegationResponse.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + redelegationResponses: Array.isArray(object?.redelegationResponses) + ? object.redelegationResponses.map((e) => staking_1.RedelegationResponse.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.redelegationResponses) { + obj.redelegationResponses = message.redelegationResponses.map((e) => e ? staking_1.RedelegationResponse.toJSON(e) : undefined); + } + else { + obj.redelegationResponses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryRedelegationsResponse(); + message.redelegationResponses = + object.redelegationResponses?.map((e) => staking_1.RedelegationResponse.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryDelegatorValidatorsRequest() { + return { + delegatorAddr: "", + pagination: undefined, + }; +} +exports.QueryDelegatorValidatorsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddr: (0, helpers_1.isSet)(object.delegatorAddr) ? String(object.delegatorAddr) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryDelegatorValidatorsResponse() { + return { + validators: [], + pagination: undefined, + }; +} +exports.QueryDelegatorValidatorsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.validators) { + staking_1.Validator.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validators.push(staking_1.Validator.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validators: Array.isArray(object?.validators) + ? object.validators.map((e) => staking_1.Validator.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => (e ? staking_1.Validator.toJSON(e) : undefined)); + } + else { + obj.validators = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => staking_1.Validator.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryDelegatorValidatorRequest() { + return { + delegatorAddr: "", + validatorAddr: "", + }; +} +exports.QueryDelegatorValidatorRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.validatorAddr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddr: (0, helpers_1.isSet)(object.delegatorAddr) ? String(object.delegatorAddr) : "", + validatorAddr: (0, helpers_1.isSet)(object.validatorAddr) ? String(object.validatorAddr) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegatorValidatorRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, +}; +function createBaseQueryDelegatorValidatorResponse() { + return { + validator: undefined, + }; +} +exports.QueryDelegatorValidatorResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.validator !== undefined) { + staking_1.Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = staking_1.Validator.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validator: (0, helpers_1.isSet)(object.validator) ? staking_1.Validator.fromJSON(object.validator) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.validator !== undefined && + (obj.validator = message.validator ? staking_1.Validator.toJSON(message.validator) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDelegatorValidatorResponse(); + message.validator = + object.validator !== undefined && object.validator !== null + ? staking_1.Validator.fromPartial(object.validator) + : undefined; + return message; + }, +}; +function createBaseQueryHistoricalInfoRequest() { + return { + height: helpers_1.Long.ZERO, + }; +} +exports.QueryHistoricalInfoRequest = { + encode(message, writer = _m0.Writer.create()) { + if (!message.height.isZero()) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryHistoricalInfoRequest(); + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseQueryHistoricalInfoResponse() { + return { + hist: undefined, + }; +} +exports.QueryHistoricalInfoResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.hist !== undefined) { + staking_1.HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hist = staking_1.HistoricalInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + hist: (0, helpers_1.isSet)(object.hist) ? staking_1.HistoricalInfo.fromJSON(object.hist) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.hist !== undefined && (obj.hist = message.hist ? staking_1.HistoricalInfo.toJSON(message.hist) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryHistoricalInfoResponse(); + message.hist = + object.hist !== undefined && object.hist !== null ? staking_1.HistoricalInfo.fromPartial(object.hist) : undefined; + return message; + }, +}; +function createBaseQueryPoolRequest() { + return {}; +} +exports.QueryPoolRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryPoolRequest(); + return message; + }, +}; +function createBaseQueryPoolResponse() { + return { + pool: undefined, + }; +} +exports.QueryPoolResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.pool !== undefined) { + staking_1.Pool.encode(message.pool, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool = staking_1.Pool.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pool: (0, helpers_1.isSet)(object.pool) ? staking_1.Pool.fromJSON(object.pool) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.pool !== undefined && (obj.pool = message.pool ? staking_1.Pool.toJSON(message.pool) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryPoolResponse(); + message.pool = + object.pool !== undefined && object.pool !== null ? staking_1.Pool.fromPartial(object.pool) : undefined; + return message; + }, +}; +function createBaseQueryParamsRequest() { + return {}; +} +exports.QueryParamsRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { + params: undefined, + }; +} +exports.QueryParamsResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.params !== undefined) { + staking_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = staking_1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + params: (0, helpers_1.isSet)(object.params) ? staking_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.params !== undefined && (obj.params = message.params ? staking_1.Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null ? staking_1.Params.fromPartial(object.params) : undefined; + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Validators = this.Validators.bind(this); + this.Validator = this.Validator.bind(this); + this.ValidatorDelegations = this.ValidatorDelegations.bind(this); + this.ValidatorUnbondingDelegations = this.ValidatorUnbondingDelegations.bind(this); + this.Delegation = this.Delegation.bind(this); + this.UnbondingDelegation = this.UnbondingDelegation.bind(this); + this.DelegatorDelegations = this.DelegatorDelegations.bind(this); + this.DelegatorUnbondingDelegations = this.DelegatorUnbondingDelegations.bind(this); + this.Redelegations = this.Redelegations.bind(this); + this.DelegatorValidators = this.DelegatorValidators.bind(this); + this.DelegatorValidator = this.DelegatorValidator.bind(this); + this.HistoricalInfo = this.HistoricalInfo.bind(this); + this.Pool = this.Pool.bind(this); + this.Params = this.Params.bind(this); + } + Validators(request) { + const data = exports.QueryValidatorsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "Validators", data); + return promise.then((data) => exports.QueryValidatorsResponse.decode(new _m0.Reader(data))); + } + Validator(request) { + const data = exports.QueryValidatorRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "Validator", data); + return promise.then((data) => exports.QueryValidatorResponse.decode(new _m0.Reader(data))); + } + ValidatorDelegations(request) { + const data = exports.QueryValidatorDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "ValidatorDelegations", data); + return promise.then((data) => exports.QueryValidatorDelegationsResponse.decode(new _m0.Reader(data))); + } + ValidatorUnbondingDelegations(request) { + const data = exports.QueryValidatorUnbondingDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "ValidatorUnbondingDelegations", data); + return promise.then((data) => exports.QueryValidatorUnbondingDelegationsResponse.decode(new _m0.Reader(data))); + } + Delegation(request) { + const data = exports.QueryDelegationRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "Delegation", data); + return promise.then((data) => exports.QueryDelegationResponse.decode(new _m0.Reader(data))); + } + UnbondingDelegation(request) { + const data = exports.QueryUnbondingDelegationRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "UnbondingDelegation", data); + return promise.then((data) => exports.QueryUnbondingDelegationResponse.decode(new _m0.Reader(data))); + } + DelegatorDelegations(request) { + const data = exports.QueryDelegatorDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "DelegatorDelegations", data); + return promise.then((data) => exports.QueryDelegatorDelegationsResponse.decode(new _m0.Reader(data))); + } + DelegatorUnbondingDelegations(request) { + const data = exports.QueryDelegatorUnbondingDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "DelegatorUnbondingDelegations", data); + return promise.then((data) => exports.QueryDelegatorUnbondingDelegationsResponse.decode(new _m0.Reader(data))); + } + Redelegations(request) { + const data = exports.QueryRedelegationsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "Redelegations", data); + return promise.then((data) => exports.QueryRedelegationsResponse.decode(new _m0.Reader(data))); + } + DelegatorValidators(request) { + const data = exports.QueryDelegatorValidatorsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "DelegatorValidators", data); + return promise.then((data) => exports.QueryDelegatorValidatorsResponse.decode(new _m0.Reader(data))); + } + DelegatorValidator(request) { + const data = exports.QueryDelegatorValidatorRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "DelegatorValidator", data); + return promise.then((data) => exports.QueryDelegatorValidatorResponse.decode(new _m0.Reader(data))); + } + HistoricalInfo(request) { + const data = exports.QueryHistoricalInfoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "HistoricalInfo", data); + return promise.then((data) => exports.QueryHistoricalInfoResponse.decode(new _m0.Reader(data))); + } + Pool(request = {}) { + const data = exports.QueryPoolRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "Pool", data); + return promise.then((data) => exports.QueryPoolResponse.decode(new _m0.Reader(data))); + } + Params(request = {}) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/staking/v1beta1/staking.js": +/*!*********************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/staking/v1beta1/staking.js ***! + \*********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Pool = exports.RedelegationResponse = exports.RedelegationEntryResponse = exports.DelegationResponse = exports.Params = exports.Redelegation = exports.RedelegationEntry = exports.UnbondingDelegationEntry = exports.UnbondingDelegation = exports.Delegation = exports.DVVTriplets = exports.DVVTriplet = exports.DVPairs = exports.DVPair = exports.ValAddresses = exports.Validator = exports.Description = exports.Commission = exports.CommissionRates = exports.HistoricalInfo = exports.bondStatusToJSON = exports.bondStatusFromJSON = exports.BondStatus = exports.protobufPackage = void 0; +/* eslint-disable */ +const types_1 = __webpack_require__(/*! ../../../tendermint/types/types */ "./node_modules/cosmjs-types/tendermint/types/types.js"); +const timestamp_1 = __webpack_require__(/*! ../../../google/protobuf/timestamp */ "./node_modules/cosmjs-types/google/protobuf/timestamp.js"); +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const duration_1 = __webpack_require__(/*! ../../../google/protobuf/duration */ "./node_modules/cosmjs-types/google/protobuf/duration.js"); +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.staking.v1beta1"; +/** BondStatus is the status of a validator. */ +var BondStatus; +(function (BondStatus) { + /** BOND_STATUS_UNSPECIFIED - UNSPECIFIED defines an invalid validator status. */ + BondStatus[BondStatus["BOND_STATUS_UNSPECIFIED"] = 0] = "BOND_STATUS_UNSPECIFIED"; + /** BOND_STATUS_UNBONDED - UNBONDED defines a validator that is not bonded. */ + BondStatus[BondStatus["BOND_STATUS_UNBONDED"] = 1] = "BOND_STATUS_UNBONDED"; + /** BOND_STATUS_UNBONDING - UNBONDING defines a validator that is unbonding. */ + BondStatus[BondStatus["BOND_STATUS_UNBONDING"] = 2] = "BOND_STATUS_UNBONDING"; + /** BOND_STATUS_BONDED - BONDED defines a validator that is bonded. */ + BondStatus[BondStatus["BOND_STATUS_BONDED"] = 3] = "BOND_STATUS_BONDED"; + BondStatus[BondStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(BondStatus = exports.BondStatus || (exports.BondStatus = {})); +function bondStatusFromJSON(object) { + switch (object) { + case 0: + case "BOND_STATUS_UNSPECIFIED": + return BondStatus.BOND_STATUS_UNSPECIFIED; + case 1: + case "BOND_STATUS_UNBONDED": + return BondStatus.BOND_STATUS_UNBONDED; + case 2: + case "BOND_STATUS_UNBONDING": + return BondStatus.BOND_STATUS_UNBONDING; + case 3: + case "BOND_STATUS_BONDED": + return BondStatus.BOND_STATUS_BONDED; + case -1: + case "UNRECOGNIZED": + default: + return BondStatus.UNRECOGNIZED; + } +} +exports.bondStatusFromJSON = bondStatusFromJSON; +function bondStatusToJSON(object) { + switch (object) { + case BondStatus.BOND_STATUS_UNSPECIFIED: + return "BOND_STATUS_UNSPECIFIED"; + case BondStatus.BOND_STATUS_UNBONDED: + return "BOND_STATUS_UNBONDED"; + case BondStatus.BOND_STATUS_UNBONDING: + return "BOND_STATUS_UNBONDING"; + case BondStatus.BOND_STATUS_BONDED: + return "BOND_STATUS_BONDED"; + case BondStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.bondStatusToJSON = bondStatusToJSON; +function createBaseHistoricalInfo() { + return { + header: undefined, + valset: [], + }; +} +exports.HistoricalInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.header !== undefined) { + types_1.Header.encode(message.header, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.valset) { + exports.Validator.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHistoricalInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = types_1.Header.decode(reader, reader.uint32()); + break; + case 2: + message.valset.push(exports.Validator.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + header: (0, helpers_1.isSet)(object.header) ? types_1.Header.fromJSON(object.header) : undefined, + valset: Array.isArray(object?.valset) ? object.valset.map((e) => exports.Validator.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.header !== undefined && (obj.header = message.header ? types_1.Header.toJSON(message.header) : undefined); + if (message.valset) { + obj.valset = message.valset.map((e) => (e ? exports.Validator.toJSON(e) : undefined)); + } + else { + obj.valset = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseHistoricalInfo(); + message.header = + object.header !== undefined && object.header !== null ? types_1.Header.fromPartial(object.header) : undefined; + message.valset = object.valset?.map((e) => exports.Validator.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCommissionRates() { + return { + rate: "", + maxRate: "", + maxChangeRate: "", + }; +} +exports.CommissionRates = { + encode(message, writer = _m0.Writer.create()) { + if (message.rate !== "") { + writer.uint32(10).string(message.rate); + } + if (message.maxRate !== "") { + writer.uint32(18).string(message.maxRate); + } + if (message.maxChangeRate !== "") { + writer.uint32(26).string(message.maxChangeRate); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionRates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rate = reader.string(); + break; + case 2: + message.maxRate = reader.string(); + break; + case 3: + message.maxChangeRate = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + rate: (0, helpers_1.isSet)(object.rate) ? String(object.rate) : "", + maxRate: (0, helpers_1.isSet)(object.maxRate) ? String(object.maxRate) : "", + maxChangeRate: (0, helpers_1.isSet)(object.maxChangeRate) ? String(object.maxChangeRate) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.rate !== undefined && (obj.rate = message.rate); + message.maxRate !== undefined && (obj.maxRate = message.maxRate); + message.maxChangeRate !== undefined && (obj.maxChangeRate = message.maxChangeRate); + return obj; + }, + fromPartial(object) { + const message = createBaseCommissionRates(); + message.rate = object.rate ?? ""; + message.maxRate = object.maxRate ?? ""; + message.maxChangeRate = object.maxChangeRate ?? ""; + return message; + }, +}; +function createBaseCommission() { + return { + commissionRates: undefined, + updateTime: undefined, + }; +} +exports.Commission = { + encode(message, writer = _m0.Writer.create()) { + if (message.commissionRates !== undefined) { + exports.CommissionRates.encode(message.commissionRates, writer.uint32(10).fork()).ldelim(); + } + if (message.updateTime !== undefined) { + timestamp_1.Timestamp.encode(message.updateTime, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commissionRates = exports.CommissionRates.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + commissionRates: (0, helpers_1.isSet)(object.commissionRates) + ? exports.CommissionRates.fromJSON(object.commissionRates) + : undefined, + updateTime: (0, helpers_1.isSet)(object.updateTime) ? (0, helpers_1.fromJsonTimestamp)(object.updateTime) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.commissionRates !== undefined && + (obj.commissionRates = message.commissionRates + ? exports.CommissionRates.toJSON(message.commissionRates) + : undefined); + message.updateTime !== undefined && (obj.updateTime = (0, helpers_1.fromTimestamp)(message.updateTime).toISOString()); + return obj; + }, + fromPartial(object) { + const message = createBaseCommission(); + message.commissionRates = + object.commissionRates !== undefined && object.commissionRates !== null + ? exports.CommissionRates.fromPartial(object.commissionRates) + : undefined; + message.updateTime = + object.updateTime !== undefined && object.updateTime !== null + ? timestamp_1.Timestamp.fromPartial(object.updateTime) + : undefined; + return message; + }, +}; +function createBaseDescription() { + return { + moniker: "", + identity: "", + website: "", + securityContact: "", + details: "", + }; +} +exports.Description = { + encode(message, writer = _m0.Writer.create()) { + if (message.moniker !== "") { + writer.uint32(10).string(message.moniker); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.securityContact !== "") { + writer.uint32(34).string(message.securityContact); + } + if (message.details !== "") { + writer.uint32(42).string(message.details); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescription(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.moniker = reader.string(); + break; + case 2: + message.identity = reader.string(); + break; + case 3: + message.website = reader.string(); + break; + case 4: + message.securityContact = reader.string(); + break; + case 5: + message.details = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + moniker: (0, helpers_1.isSet)(object.moniker) ? String(object.moniker) : "", + identity: (0, helpers_1.isSet)(object.identity) ? String(object.identity) : "", + website: (0, helpers_1.isSet)(object.website) ? String(object.website) : "", + securityContact: (0, helpers_1.isSet)(object.securityContact) ? String(object.securityContact) : "", + details: (0, helpers_1.isSet)(object.details) ? String(object.details) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.moniker !== undefined && (obj.moniker = message.moniker); + message.identity !== undefined && (obj.identity = message.identity); + message.website !== undefined && (obj.website = message.website); + message.securityContact !== undefined && (obj.securityContact = message.securityContact); + message.details !== undefined && (obj.details = message.details); + return obj; + }, + fromPartial(object) { + const message = createBaseDescription(); + message.moniker = object.moniker ?? ""; + message.identity = object.identity ?? ""; + message.website = object.website ?? ""; + message.securityContact = object.securityContact ?? ""; + message.details = object.details ?? ""; + return message; + }, +}; +function createBaseValidator() { + return { + operatorAddress: "", + consensusPubkey: undefined, + jailed: false, + status: 0, + tokens: "", + delegatorShares: "", + description: undefined, + unbondingHeight: helpers_1.Long.ZERO, + unbondingTime: undefined, + commission: undefined, + minSelfDelegation: "", + }; +} +exports.Validator = { + encode(message, writer = _m0.Writer.create()) { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + if (message.consensusPubkey !== undefined) { + any_1.Any.encode(message.consensusPubkey, writer.uint32(18).fork()).ldelim(); + } + if (message.jailed === true) { + writer.uint32(24).bool(message.jailed); + } + if (message.status !== 0) { + writer.uint32(32).int32(message.status); + } + if (message.tokens !== "") { + writer.uint32(42).string(message.tokens); + } + if (message.delegatorShares !== "") { + writer.uint32(50).string(message.delegatorShares); + } + if (message.description !== undefined) { + exports.Description.encode(message.description, writer.uint32(58).fork()).ldelim(); + } + if (!message.unbondingHeight.isZero()) { + writer.uint32(64).int64(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + timestamp_1.Timestamp.encode(message.unbondingTime, writer.uint32(74).fork()).ldelim(); + } + if (message.commission !== undefined) { + exports.Commission.encode(message.commission, writer.uint32(82).fork()).ldelim(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(90).string(message.minSelfDelegation); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.operatorAddress = reader.string(); + break; + case 2: + message.consensusPubkey = any_1.Any.decode(reader, reader.uint32()); + break; + case 3: + message.jailed = reader.bool(); + break; + case 4: + message.status = reader.int32(); + break; + case 5: + message.tokens = reader.string(); + break; + case 6: + message.delegatorShares = reader.string(); + break; + case 7: + message.description = exports.Description.decode(reader, reader.uint32()); + break; + case 8: + message.unbondingHeight = reader.int64(); + break; + case 9: + message.unbondingTime = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 10: + message.commission = exports.Commission.decode(reader, reader.uint32()); + break; + case 11: + message.minSelfDelegation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + operatorAddress: (0, helpers_1.isSet)(object.operatorAddress) ? String(object.operatorAddress) : "", + consensusPubkey: (0, helpers_1.isSet)(object.consensusPubkey) ? any_1.Any.fromJSON(object.consensusPubkey) : undefined, + jailed: (0, helpers_1.isSet)(object.jailed) ? Boolean(object.jailed) : false, + status: (0, helpers_1.isSet)(object.status) ? bondStatusFromJSON(object.status) : 0, + tokens: (0, helpers_1.isSet)(object.tokens) ? String(object.tokens) : "", + delegatorShares: (0, helpers_1.isSet)(object.delegatorShares) ? String(object.delegatorShares) : "", + description: (0, helpers_1.isSet)(object.description) ? exports.Description.fromJSON(object.description) : undefined, + unbondingHeight: (0, helpers_1.isSet)(object.unbondingHeight) ? helpers_1.Long.fromValue(object.unbondingHeight) : helpers_1.Long.ZERO, + unbondingTime: (0, helpers_1.isSet)(object.unbondingTime) ? (0, helpers_1.fromJsonTimestamp)(object.unbondingTime) : undefined, + commission: (0, helpers_1.isSet)(object.commission) ? exports.Commission.fromJSON(object.commission) : undefined, + minSelfDelegation: (0, helpers_1.isSet)(object.minSelfDelegation) ? String(object.minSelfDelegation) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.operatorAddress !== undefined && (obj.operatorAddress = message.operatorAddress); + message.consensusPubkey !== undefined && + (obj.consensusPubkey = message.consensusPubkey ? any_1.Any.toJSON(message.consensusPubkey) : undefined); + message.jailed !== undefined && (obj.jailed = message.jailed); + message.status !== undefined && (obj.status = bondStatusToJSON(message.status)); + message.tokens !== undefined && (obj.tokens = message.tokens); + message.delegatorShares !== undefined && (obj.delegatorShares = message.delegatorShares); + message.description !== undefined && + (obj.description = message.description ? exports.Description.toJSON(message.description) : undefined); + message.unbondingHeight !== undefined && + (obj.unbondingHeight = (message.unbondingHeight || helpers_1.Long.ZERO).toString()); + message.unbondingTime !== undefined && + (obj.unbondingTime = (0, helpers_1.fromTimestamp)(message.unbondingTime).toISOString()); + message.commission !== undefined && + (obj.commission = message.commission ? exports.Commission.toJSON(message.commission) : undefined); + message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation); + return obj; + }, + fromPartial(object) { + const message = createBaseValidator(); + message.operatorAddress = object.operatorAddress ?? ""; + message.consensusPubkey = + object.consensusPubkey !== undefined && object.consensusPubkey !== null + ? any_1.Any.fromPartial(object.consensusPubkey) + : undefined; + message.jailed = object.jailed ?? false; + message.status = object.status ?? 0; + message.tokens = object.tokens ?? ""; + message.delegatorShares = object.delegatorShares ?? ""; + message.description = + object.description !== undefined && object.description !== null + ? exports.Description.fromPartial(object.description) + : undefined; + message.unbondingHeight = + object.unbondingHeight !== undefined && object.unbondingHeight !== null + ? helpers_1.Long.fromValue(object.unbondingHeight) + : helpers_1.Long.ZERO; + message.unbondingTime = + object.unbondingTime !== undefined && object.unbondingTime !== null + ? timestamp_1.Timestamp.fromPartial(object.unbondingTime) + : undefined; + message.commission = + object.commission !== undefined && object.commission !== null + ? exports.Commission.fromPartial(object.commission) + : undefined; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + return message; + }, +}; +function createBaseValAddresses() { + return { + addresses: [], + }; +} +exports.ValAddresses = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.addresses) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.addresses.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + addresses: Array.isArray(object?.addresses) ? object.addresses.map((e) => String(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.addresses) { + obj.addresses = message.addresses.map((e) => e); + } + else { + obj.addresses = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; +function createBaseDVPair() { + return { + delegatorAddress: "", + validatorAddress: "", + }; +} +exports.DVPair = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseDVPair(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, +}; +function createBaseDVPairs() { + return { + pairs: [], + }; +} +exports.DVPairs = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.pairs) { + exports.DVPair.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pairs.push(exports.DVPair.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pairs: Array.isArray(object?.pairs) ? object.pairs.map((e) => exports.DVPair.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pairs) { + obj.pairs = message.pairs.map((e) => (e ? exports.DVPair.toJSON(e) : undefined)); + } + else { + obj.pairs = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map((e) => exports.DVPair.fromPartial(e)) || []; + return message; + }, +}; +function createBaseDVVTriplet() { + return { + delegatorAddress: "", + validatorSrcAddress: "", + validatorDstAddress: "", + }; +} +exports.DVVTriplet = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorSrcAddress = reader.string(); + break; + case 3: + message.validatorDstAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorSrcAddress: (0, helpers_1.isSet)(object.validatorSrcAddress) ? String(object.validatorSrcAddress) : "", + validatorDstAddress: (0, helpers_1.isSet)(object.validatorDstAddress) ? String(object.validatorDstAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress); + message.validatorDstAddress !== undefined && (obj.validatorDstAddress = message.validatorDstAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseDVVTriplet(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + return message; + }, +}; +function createBaseDVVTriplets() { + return { + triplets: [], + }; +} +exports.DVVTriplets = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.triplets) { + exports.DVVTriplet.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.triplets.push(exports.DVVTriplet.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + triplets: Array.isArray(object?.triplets) + ? object.triplets.map((e) => exports.DVVTriplet.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.triplets) { + obj.triplets = message.triplets.map((e) => (e ? exports.DVVTriplet.toJSON(e) : undefined)); + } + else { + obj.triplets = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map((e) => exports.DVVTriplet.fromPartial(e)) || []; + return message; + }, +}; +function createBaseDelegation() { + return { + delegatorAddress: "", + validatorAddress: "", + shares: "", + }; +} +exports.Delegation = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.shares !== "") { + writer.uint32(26).string(message.shares); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.shares = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + shares: (0, helpers_1.isSet)(object.shares) ? String(object.shares) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.shares !== undefined && (obj.shares = message.shares); + return obj; + }, + fromPartial(object) { + const message = createBaseDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.shares = object.shares ?? ""; + return message; + }, +}; +function createBaseUnbondingDelegation() { + return { + delegatorAddress: "", + validatorAddress: "", + entries: [], + }; +} +exports.UnbondingDelegation = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.entries) { + exports.UnbondingDelegationEntry.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.entries.push(exports.UnbondingDelegationEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + entries: Array.isArray(object?.entries) + ? object.entries.map((e) => exports.UnbondingDelegationEntry.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + if (message.entries) { + obj.entries = message.entries.map((e) => (e ? exports.UnbondingDelegationEntry.toJSON(e) : undefined)); + } + else { + obj.entries = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.entries = object.entries?.map((e) => exports.UnbondingDelegationEntry.fromPartial(e)) || []; + return message; + }, +}; +function createBaseUnbondingDelegationEntry() { + return { + creationHeight: helpers_1.Long.ZERO, + completionTime: undefined, + initialBalance: "", + balance: "", + }; +} +exports.UnbondingDelegationEntry = { + encode(message, writer = _m0.Writer.create()) { + if (!message.creationHeight.isZero()) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + timestamp_1.Timestamp.encode(message.completionTime, writer.uint32(18).fork()).ldelim(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creationHeight = reader.int64(); + break; + case 2: + message.completionTime = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.initialBalance = reader.string(); + break; + case 4: + message.balance = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + creationHeight: (0, helpers_1.isSet)(object.creationHeight) ? helpers_1.Long.fromValue(object.creationHeight) : helpers_1.Long.ZERO, + completionTime: (0, helpers_1.isSet)(object.completionTime) ? (0, helpers_1.fromJsonTimestamp)(object.completionTime) : undefined, + initialBalance: (0, helpers_1.isSet)(object.initialBalance) ? String(object.initialBalance) : "", + balance: (0, helpers_1.isSet)(object.balance) ? String(object.balance) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.creationHeight !== undefined && + (obj.creationHeight = (message.creationHeight || helpers_1.Long.ZERO).toString()); + message.completionTime !== undefined && + (obj.completionTime = (0, helpers_1.fromTimestamp)(message.completionTime).toISOString()); + message.initialBalance !== undefined && (obj.initialBalance = message.initialBalance); + message.balance !== undefined && (obj.balance = message.balance); + return obj; + }, + fromPartial(object) { + const message = createBaseUnbondingDelegationEntry(); + message.creationHeight = + object.creationHeight !== undefined && object.creationHeight !== null + ? helpers_1.Long.fromValue(object.creationHeight) + : helpers_1.Long.ZERO; + message.completionTime = + object.completionTime !== undefined && object.completionTime !== null + ? timestamp_1.Timestamp.fromPartial(object.completionTime) + : undefined; + message.initialBalance = object.initialBalance ?? ""; + message.balance = object.balance ?? ""; + return message; + }, +}; +function createBaseRedelegationEntry() { + return { + creationHeight: helpers_1.Long.ZERO, + completionTime: undefined, + initialBalance: "", + sharesDst: "", + }; +} +exports.RedelegationEntry = { + encode(message, writer = _m0.Writer.create()) { + if (!message.creationHeight.isZero()) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + timestamp_1.Timestamp.encode(message.completionTime, writer.uint32(18).fork()).ldelim(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.sharesDst !== "") { + writer.uint32(34).string(message.sharesDst); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creationHeight = reader.int64(); + break; + case 2: + message.completionTime = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.initialBalance = reader.string(); + break; + case 4: + message.sharesDst = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + creationHeight: (0, helpers_1.isSet)(object.creationHeight) ? helpers_1.Long.fromValue(object.creationHeight) : helpers_1.Long.ZERO, + completionTime: (0, helpers_1.isSet)(object.completionTime) ? (0, helpers_1.fromJsonTimestamp)(object.completionTime) : undefined, + initialBalance: (0, helpers_1.isSet)(object.initialBalance) ? String(object.initialBalance) : "", + sharesDst: (0, helpers_1.isSet)(object.sharesDst) ? String(object.sharesDst) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.creationHeight !== undefined && + (obj.creationHeight = (message.creationHeight || helpers_1.Long.ZERO).toString()); + message.completionTime !== undefined && + (obj.completionTime = (0, helpers_1.fromTimestamp)(message.completionTime).toISOString()); + message.initialBalance !== undefined && (obj.initialBalance = message.initialBalance); + message.sharesDst !== undefined && (obj.sharesDst = message.sharesDst); + return obj; + }, + fromPartial(object) { + const message = createBaseRedelegationEntry(); + message.creationHeight = + object.creationHeight !== undefined && object.creationHeight !== null + ? helpers_1.Long.fromValue(object.creationHeight) + : helpers_1.Long.ZERO; + message.completionTime = + object.completionTime !== undefined && object.completionTime !== null + ? timestamp_1.Timestamp.fromPartial(object.completionTime) + : undefined; + message.initialBalance = object.initialBalance ?? ""; + message.sharesDst = object.sharesDst ?? ""; + return message; + }, +}; +function createBaseRedelegation() { + return { + delegatorAddress: "", + validatorSrcAddress: "", + validatorDstAddress: "", + entries: [], + }; +} +exports.Redelegation = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + for (const v of message.entries) { + exports.RedelegationEntry.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorSrcAddress = reader.string(); + break; + case 3: + message.validatorDstAddress = reader.string(); + break; + case 4: + message.entries.push(exports.RedelegationEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorSrcAddress: (0, helpers_1.isSet)(object.validatorSrcAddress) ? String(object.validatorSrcAddress) : "", + validatorDstAddress: (0, helpers_1.isSet)(object.validatorDstAddress) ? String(object.validatorDstAddress) : "", + entries: Array.isArray(object?.entries) + ? object.entries.map((e) => exports.RedelegationEntry.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress); + message.validatorDstAddress !== undefined && (obj.validatorDstAddress = message.validatorDstAddress); + if (message.entries) { + obj.entries = message.entries.map((e) => (e ? exports.RedelegationEntry.toJSON(e) : undefined)); + } + else { + obj.entries = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseRedelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.entries = object.entries?.map((e) => exports.RedelegationEntry.fromPartial(e)) || []; + return message; + }, +}; +function createBaseParams() { + return { + unbondingTime: undefined, + maxValidators: 0, + maxEntries: 0, + historicalEntries: 0, + bondDenom: "", + }; +} +exports.Params = { + encode(message, writer = _m0.Writer.create()) { + if (message.unbondingTime !== undefined) { + duration_1.Duration.encode(message.unbondingTime, writer.uint32(10).fork()).ldelim(); + } + if (message.maxValidators !== 0) { + writer.uint32(16).uint32(message.maxValidators); + } + if (message.maxEntries !== 0) { + writer.uint32(24).uint32(message.maxEntries); + } + if (message.historicalEntries !== 0) { + writer.uint32(32).uint32(message.historicalEntries); + } + if (message.bondDenom !== "") { + writer.uint32(42).string(message.bondDenom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbondingTime = duration_1.Duration.decode(reader, reader.uint32()); + break; + case 2: + message.maxValidators = reader.uint32(); + break; + case 3: + message.maxEntries = reader.uint32(); + break; + case 4: + message.historicalEntries = reader.uint32(); + break; + case 5: + message.bondDenom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + unbondingTime: (0, helpers_1.isSet)(object.unbondingTime) ? duration_1.Duration.fromJSON(object.unbondingTime) : undefined, + maxValidators: (0, helpers_1.isSet)(object.maxValidators) ? Number(object.maxValidators) : 0, + maxEntries: (0, helpers_1.isSet)(object.maxEntries) ? Number(object.maxEntries) : 0, + historicalEntries: (0, helpers_1.isSet)(object.historicalEntries) ? Number(object.historicalEntries) : 0, + bondDenom: (0, helpers_1.isSet)(object.bondDenom) ? String(object.bondDenom) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.unbondingTime !== undefined && + (obj.unbondingTime = message.unbondingTime ? duration_1.Duration.toJSON(message.unbondingTime) : undefined); + message.maxValidators !== undefined && (obj.maxValidators = Math.round(message.maxValidators)); + message.maxEntries !== undefined && (obj.maxEntries = Math.round(message.maxEntries)); + message.historicalEntries !== undefined && + (obj.historicalEntries = Math.round(message.historicalEntries)); + message.bondDenom !== undefined && (obj.bondDenom = message.bondDenom); + return obj; + }, + fromPartial(object) { + const message = createBaseParams(); + message.unbondingTime = + object.unbondingTime !== undefined && object.unbondingTime !== null + ? duration_1.Duration.fromPartial(object.unbondingTime) + : undefined; + message.maxValidators = object.maxValidators ?? 0; + message.maxEntries = object.maxEntries ?? 0; + message.historicalEntries = object.historicalEntries ?? 0; + message.bondDenom = object.bondDenom ?? ""; + return message; + }, +}; +function createBaseDelegationResponse() { + return { + delegation: undefined, + balance: undefined, + }; +} +exports.DelegationResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegation !== undefined) { + exports.Delegation.encode(message.delegation, writer.uint32(10).fork()).ldelim(); + } + if (message.balance !== undefined) { + coin_1.Coin.encode(message.balance, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegation = exports.Delegation.decode(reader, reader.uint32()); + break; + case 2: + message.balance = coin_1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegation: (0, helpers_1.isSet)(object.delegation) ? exports.Delegation.fromJSON(object.delegation) : undefined, + balance: (0, helpers_1.isSet)(object.balance) ? coin_1.Coin.fromJSON(object.balance) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.delegation !== undefined && + (obj.delegation = message.delegation ? exports.Delegation.toJSON(message.delegation) : undefined); + message.balance !== undefined && + (obj.balance = message.balance ? coin_1.Coin.toJSON(message.balance) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseDelegationResponse(); + message.delegation = + object.delegation !== undefined && object.delegation !== null + ? exports.Delegation.fromPartial(object.delegation) + : undefined; + message.balance = + object.balance !== undefined && object.balance !== null ? coin_1.Coin.fromPartial(object.balance) : undefined; + return message; + }, +}; +function createBaseRedelegationEntryResponse() { + return { + redelegationEntry: undefined, + balance: "", + }; +} +exports.RedelegationEntryResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.redelegationEntry !== undefined) { + exports.RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).ldelim(); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegationEntry = exports.RedelegationEntry.decode(reader, reader.uint32()); + break; + case 4: + message.balance = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + redelegationEntry: (0, helpers_1.isSet)(object.redelegationEntry) + ? exports.RedelegationEntry.fromJSON(object.redelegationEntry) + : undefined, + balance: (0, helpers_1.isSet)(object.balance) ? String(object.balance) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.redelegationEntry !== undefined && + (obj.redelegationEntry = message.redelegationEntry + ? exports.RedelegationEntry.toJSON(message.redelegationEntry) + : undefined); + message.balance !== undefined && (obj.balance = message.balance); + return obj; + }, + fromPartial(object) { + const message = createBaseRedelegationEntryResponse(); + message.redelegationEntry = + object.redelegationEntry !== undefined && object.redelegationEntry !== null + ? exports.RedelegationEntry.fromPartial(object.redelegationEntry) + : undefined; + message.balance = object.balance ?? ""; + return message; + }, +}; +function createBaseRedelegationResponse() { + return { + redelegation: undefined, + entries: [], + }; +} +exports.RedelegationResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.redelegation !== undefined) { + exports.Redelegation.encode(message.redelegation, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.entries) { + exports.RedelegationEntryResponse.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegation = exports.Redelegation.decode(reader, reader.uint32()); + break; + case 2: + message.entries.push(exports.RedelegationEntryResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + redelegation: (0, helpers_1.isSet)(object.redelegation) ? exports.Redelegation.fromJSON(object.redelegation) : undefined, + entries: Array.isArray(object?.entries) + ? object.entries.map((e) => exports.RedelegationEntryResponse.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.redelegation !== undefined && + (obj.redelegation = message.redelegation ? exports.Redelegation.toJSON(message.redelegation) : undefined); + if (message.entries) { + obj.entries = message.entries.map((e) => (e ? exports.RedelegationEntryResponse.toJSON(e) : undefined)); + } + else { + obj.entries = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseRedelegationResponse(); + message.redelegation = + object.redelegation !== undefined && object.redelegation !== null + ? exports.Redelegation.fromPartial(object.redelegation) + : undefined; + message.entries = object.entries?.map((e) => exports.RedelegationEntryResponse.fromPartial(e)) || []; + return message; + }, +}; +function createBasePool() { + return { + notBondedTokens: "", + bondedTokens: "", + }; +} +exports.Pool = { + encode(message, writer = _m0.Writer.create()) { + if (message.notBondedTokens !== "") { + writer.uint32(10).string(message.notBondedTokens); + } + if (message.bondedTokens !== "") { + writer.uint32(18).string(message.bondedTokens); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.notBondedTokens = reader.string(); + break; + case 2: + message.bondedTokens = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + notBondedTokens: (0, helpers_1.isSet)(object.notBondedTokens) ? String(object.notBondedTokens) : "", + bondedTokens: (0, helpers_1.isSet)(object.bondedTokens) ? String(object.bondedTokens) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.notBondedTokens !== undefined && (obj.notBondedTokens = message.notBondedTokens); + message.bondedTokens !== undefined && (obj.bondedTokens = message.bondedTokens); + return obj; + }, + fromPartial(object) { + const message = createBasePool(); + message.notBondedTokens = object.notBondedTokens ?? ""; + message.bondedTokens = object.bondedTokens ?? ""; + return message; + }, +}; +//# sourceMappingURL=staking.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/staking/v1beta1/tx.js": +/*!****************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/staking/v1beta1/tx.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MsgClientImpl = exports.MsgUndelegateResponse = exports.MsgUndelegate = exports.MsgBeginRedelegateResponse = exports.MsgBeginRedelegate = exports.MsgDelegateResponse = exports.MsgDelegate = exports.MsgEditValidatorResponse = exports.MsgEditValidator = exports.MsgCreateValidatorResponse = exports.MsgCreateValidator = exports.protobufPackage = void 0; +/* eslint-disable */ +const staking_1 = __webpack_require__(/*! ./staking */ "./node_modules/cosmjs-types/cosmos/staking/v1beta1/staking.js"); +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const timestamp_1 = __webpack_require__(/*! ../../../google/protobuf/timestamp */ "./node_modules/cosmjs-types/google/protobuf/timestamp.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.staking.v1beta1"; +function createBaseMsgCreateValidator() { + return { + description: undefined, + commission: undefined, + minSelfDelegation: "", + delegatorAddress: "", + validatorAddress: "", + pubkey: undefined, + value: undefined, + }; +} +exports.MsgCreateValidator = { + encode(message, writer = _m0.Writer.create()) { + if (message.description !== undefined) { + staking_1.Description.encode(message.description, writer.uint32(10).fork()).ldelim(); + } + if (message.commission !== undefined) { + staking_1.CommissionRates.encode(message.commission, writer.uint32(18).fork()).ldelim(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(26).string(message.minSelfDelegation); + } + if (message.delegatorAddress !== "") { + writer.uint32(34).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(42).string(message.validatorAddress); + } + if (message.pubkey !== undefined) { + any_1.Any.encode(message.pubkey, writer.uint32(50).fork()).ldelim(); + } + if (message.value !== undefined) { + coin_1.Coin.encode(message.value, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.description = staking_1.Description.decode(reader, reader.uint32()); + break; + case 2: + message.commission = staking_1.CommissionRates.decode(reader, reader.uint32()); + break; + case 3: + message.minSelfDelegation = reader.string(); + break; + case 4: + message.delegatorAddress = reader.string(); + break; + case 5: + message.validatorAddress = reader.string(); + break; + case 6: + message.pubkey = any_1.Any.decode(reader, reader.uint32()); + break; + case 7: + message.value = coin_1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + description: (0, helpers_1.isSet)(object.description) ? staking_1.Description.fromJSON(object.description) : undefined, + commission: (0, helpers_1.isSet)(object.commission) ? staking_1.CommissionRates.fromJSON(object.commission) : undefined, + minSelfDelegation: (0, helpers_1.isSet)(object.minSelfDelegation) ? String(object.minSelfDelegation) : "", + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + pubkey: (0, helpers_1.isSet)(object.pubkey) ? any_1.Any.fromJSON(object.pubkey) : undefined, + value: (0, helpers_1.isSet)(object.value) ? coin_1.Coin.fromJSON(object.value) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.description !== undefined && + (obj.description = message.description ? staking_1.Description.toJSON(message.description) : undefined); + message.commission !== undefined && + (obj.commission = message.commission ? staking_1.CommissionRates.toJSON(message.commission) : undefined); + message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation); + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? any_1.Any.toJSON(message.pubkey) : undefined); + message.value !== undefined && (obj.value = message.value ? coin_1.Coin.toJSON(message.value) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgCreateValidator(); + message.description = + object.description !== undefined && object.description !== null + ? staking_1.Description.fromPartial(object.description) + : undefined; + message.commission = + object.commission !== undefined && object.commission !== null + ? staking_1.CommissionRates.fromPartial(object.commission) + : undefined; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.pubkey = + object.pubkey !== undefined && object.pubkey !== null ? any_1.Any.fromPartial(object.pubkey) : undefined; + message.value = + object.value !== undefined && object.value !== null ? coin_1.Coin.fromPartial(object.value) : undefined; + return message; + }, +}; +function createBaseMsgCreateValidatorResponse() { + return {}; +} +exports.MsgCreateValidatorResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, +}; +function createBaseMsgEditValidator() { + return { + description: undefined, + validatorAddress: "", + commissionRate: "", + minSelfDelegation: "", + }; +} +exports.MsgEditValidator = { + encode(message, writer = _m0.Writer.create()) { + if (message.description !== undefined) { + staking_1.Description.encode(message.description, writer.uint32(10).fork()).ldelim(); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.commissionRate !== "") { + writer.uint32(26).string(message.commissionRate); + } + if (message.minSelfDelegation !== "") { + writer.uint32(34).string(message.minSelfDelegation); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.description = staking_1.Description.decode(reader, reader.uint32()); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.commissionRate = reader.string(); + break; + case 4: + message.minSelfDelegation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + description: (0, helpers_1.isSet)(object.description) ? staking_1.Description.fromJSON(object.description) : undefined, + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + commissionRate: (0, helpers_1.isSet)(object.commissionRate) ? String(object.commissionRate) : "", + minSelfDelegation: (0, helpers_1.isSet)(object.minSelfDelegation) ? String(object.minSelfDelegation) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.description !== undefined && + (obj.description = message.description ? staking_1.Description.toJSON(message.description) : undefined); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.commissionRate !== undefined && (obj.commissionRate = message.commissionRate); + message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgEditValidator(); + message.description = + object.description !== undefined && object.description !== null + ? staking_1.Description.fromPartial(object.description) + : undefined; + message.validatorAddress = object.validatorAddress ?? ""; + message.commissionRate = object.commissionRate ?? ""; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + return message; + }, +}; +function createBaseMsgEditValidatorResponse() { + return {}; +} +exports.MsgEditValidatorResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, +}; +function createBaseMsgDelegate() { + return { + delegatorAddress: "", + validatorAddress: "", + amount: undefined, + }; +} +exports.MsgDelegate = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + coin_1.Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.amount = coin_1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: (0, helpers_1.isSet)(object.amount) ? coin_1.Coin.fromJSON(object.amount) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.amount !== undefined && (obj.amount = message.amount ? coin_1.Coin.toJSON(message.amount) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgDelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = + object.amount !== undefined && object.amount !== null ? coin_1.Coin.fromPartial(object.amount) : undefined; + return message; + }, +}; +function createBaseMsgDelegateResponse() { + return {}; +} +exports.MsgDelegateResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgDelegateResponse(); + return message; + }, +}; +function createBaseMsgBeginRedelegate() { + return { + delegatorAddress: "", + validatorSrcAddress: "", + validatorDstAddress: "", + amount: undefined, + }; +} +exports.MsgBeginRedelegate = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + if (message.amount !== undefined) { + coin_1.Coin.encode(message.amount, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorSrcAddress = reader.string(); + break; + case 3: + message.validatorDstAddress = reader.string(); + break; + case 4: + message.amount = coin_1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorSrcAddress: (0, helpers_1.isSet)(object.validatorSrcAddress) ? String(object.validatorSrcAddress) : "", + validatorDstAddress: (0, helpers_1.isSet)(object.validatorDstAddress) ? String(object.validatorDstAddress) : "", + amount: (0, helpers_1.isSet)(object.amount) ? coin_1.Coin.fromJSON(object.amount) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress); + message.validatorDstAddress !== undefined && (obj.validatorDstAddress = message.validatorDstAddress); + message.amount !== undefined && (obj.amount = message.amount ? coin_1.Coin.toJSON(message.amount) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgBeginRedelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.amount = + object.amount !== undefined && object.amount !== null ? coin_1.Coin.fromPartial(object.amount) : undefined; + return message; + }, +}; +function createBaseMsgBeginRedelegateResponse() { + return { + completionTime: undefined, + }; +} +exports.MsgBeginRedelegateResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.completionTime !== undefined) { + timestamp_1.Timestamp.encode(message.completionTime, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.completionTime = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + completionTime: (0, helpers_1.isSet)(object.completionTime) ? (0, helpers_1.fromJsonTimestamp)(object.completionTime) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.completionTime !== undefined && + (obj.completionTime = (0, helpers_1.fromTimestamp)(message.completionTime).toISOString()); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgBeginRedelegateResponse(); + message.completionTime = + object.completionTime !== undefined && object.completionTime !== null + ? timestamp_1.Timestamp.fromPartial(object.completionTime) + : undefined; + return message; + }, +}; +function createBaseMsgUndelegate() { + return { + delegatorAddress: "", + validatorAddress: "", + amount: undefined, + }; +} +exports.MsgUndelegate = { + encode(message, writer = _m0.Writer.create()) { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + coin_1.Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.amount = coin_1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + delegatorAddress: (0, helpers_1.isSet)(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: (0, helpers_1.isSet)(object.amount) ? coin_1.Coin.fromJSON(object.amount) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.amount !== undefined && (obj.amount = message.amount ? coin_1.Coin.toJSON(message.amount) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgUndelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = + object.amount !== undefined && object.amount !== null ? coin_1.Coin.fromPartial(object.amount) : undefined; + return message; + }, +}; +function createBaseMsgUndelegateResponse() { + return { + completionTime: undefined, + }; +} +exports.MsgUndelegateResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.completionTime !== undefined) { + timestamp_1.Timestamp.encode(message.completionTime, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.completionTime = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + completionTime: (0, helpers_1.isSet)(object.completionTime) ? (0, helpers_1.fromJsonTimestamp)(object.completionTime) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.completionTime !== undefined && + (obj.completionTime = (0, helpers_1.fromTimestamp)(message.completionTime).toISOString()); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgUndelegateResponse(); + message.completionTime = + object.completionTime !== undefined && object.completionTime !== null + ? timestamp_1.Timestamp.fromPartial(object.completionTime) + : undefined; + return message; + }, +}; +class MsgClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.CreateValidator = this.CreateValidator.bind(this); + this.EditValidator = this.EditValidator.bind(this); + this.Delegate = this.Delegate.bind(this); + this.BeginRedelegate = this.BeginRedelegate.bind(this); + this.Undelegate = this.Undelegate.bind(this); + } + CreateValidator(request) { + const data = exports.MsgCreateValidator.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "CreateValidator", data); + return promise.then((data) => exports.MsgCreateValidatorResponse.decode(new _m0.Reader(data))); + } + EditValidator(request) { + const data = exports.MsgEditValidator.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "EditValidator", data); + return promise.then((data) => exports.MsgEditValidatorResponse.decode(new _m0.Reader(data))); + } + Delegate(request) { + const data = exports.MsgDelegate.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "Delegate", data); + return promise.then((data) => exports.MsgDelegateResponse.decode(new _m0.Reader(data))); + } + BeginRedelegate(request) { + const data = exports.MsgBeginRedelegate.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "BeginRedelegate", data); + return promise.then((data) => exports.MsgBeginRedelegateResponse.decode(new _m0.Reader(data))); + } + Undelegate(request) { + const data = exports.MsgUndelegate.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "Undelegate", data); + return promise.then((data) => exports.MsgUndelegateResponse.decode(new _m0.Reader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +//# sourceMappingURL=tx.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/tx/signing/v1beta1/signing.js": +/*!************************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/tx/signing/v1beta1/signing.js ***! + \************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SignatureDescriptor_Data_Multi = exports.SignatureDescriptor_Data_Single = exports.SignatureDescriptor_Data = exports.SignatureDescriptor = exports.SignatureDescriptors = exports.signModeToJSON = exports.signModeFromJSON = exports.SignMode = exports.protobufPackage = void 0; +/* eslint-disable */ +const multisig_1 = __webpack_require__(/*! ../../../crypto/multisig/v1beta1/multisig */ "./node_modules/cosmjs-types/cosmos/crypto/multisig/v1beta1/multisig.js"); +const any_1 = __webpack_require__(/*! ../../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.tx.signing.v1beta1"; +/** SignMode represents a signing mode with its own security guarantees. */ +var SignMode; +(function (SignMode) { + /** + * SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be + * rejected + */ + SignMode[SignMode["SIGN_MODE_UNSPECIFIED"] = 0] = "SIGN_MODE_UNSPECIFIED"; + /** + * SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is + * verified with raw bytes from Tx + */ + SignMode[SignMode["SIGN_MODE_DIRECT"] = 1] = "SIGN_MODE_DIRECT"; + /** + * SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some + * human-readable textual representation on top of the binary representation + * from SIGN_MODE_DIRECT + */ + SignMode[SignMode["SIGN_MODE_TEXTUAL"] = 2] = "SIGN_MODE_TEXTUAL"; + /** + * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + * Amino JSON and will be removed in the future + */ + SignMode[SignMode["SIGN_MODE_LEGACY_AMINO_JSON"] = 127] = "SIGN_MODE_LEGACY_AMINO_JSON"; + /** + * SIGN_MODE_EIP_191 - SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos + * SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 + * + * Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, + * but is not implemented on the SDK by default. To enable EIP-191, you need + * to pass a custom `TxConfig` that has an implementation of + * `SignModeHandler` for EIP-191. The SDK may decide to fully support + * EIP-191 in the future. + * + * Since: cosmos-sdk 0.45.2 + */ + SignMode[SignMode["SIGN_MODE_EIP_191"] = 191] = "SIGN_MODE_EIP_191"; + SignMode[SignMode["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(SignMode = exports.SignMode || (exports.SignMode = {})); +function signModeFromJSON(object) { + switch (object) { + case 0: + case "SIGN_MODE_UNSPECIFIED": + return SignMode.SIGN_MODE_UNSPECIFIED; + case 1: + case "SIGN_MODE_DIRECT": + return SignMode.SIGN_MODE_DIRECT; + case 2: + case "SIGN_MODE_TEXTUAL": + return SignMode.SIGN_MODE_TEXTUAL; + case 127: + case "SIGN_MODE_LEGACY_AMINO_JSON": + return SignMode.SIGN_MODE_LEGACY_AMINO_JSON; + case 191: + case "SIGN_MODE_EIP_191": + return SignMode.SIGN_MODE_EIP_191; + case -1: + case "UNRECOGNIZED": + default: + return SignMode.UNRECOGNIZED; + } +} +exports.signModeFromJSON = signModeFromJSON; +function signModeToJSON(object) { + switch (object) { + case SignMode.SIGN_MODE_UNSPECIFIED: + return "SIGN_MODE_UNSPECIFIED"; + case SignMode.SIGN_MODE_DIRECT: + return "SIGN_MODE_DIRECT"; + case SignMode.SIGN_MODE_TEXTUAL: + return "SIGN_MODE_TEXTUAL"; + case SignMode.SIGN_MODE_LEGACY_AMINO_JSON: + return "SIGN_MODE_LEGACY_AMINO_JSON"; + case SignMode.SIGN_MODE_EIP_191: + return "SIGN_MODE_EIP_191"; + case SignMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.signModeToJSON = signModeToJSON; +function createBaseSignatureDescriptors() { + return { + signatures: [], + }; +} +exports.SignatureDescriptors = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.signatures) { + exports.SignatureDescriptor.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptors(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signatures.push(exports.SignatureDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e) => exports.SignatureDescriptor.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.signatures) { + obj.signatures = message.signatures.map((e) => (e ? exports.SignatureDescriptor.toJSON(e) : undefined)); + } + else { + obj.signatures = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map((e) => exports.SignatureDescriptor.fromPartial(e)) || []; + return message; + }, +}; +function createBaseSignatureDescriptor() { + return { + publicKey: undefined, + data: undefined, + sequence: helpers_1.Long.UZERO, + }; +} +exports.SignatureDescriptor = { + encode(message, writer = _m0.Writer.create()) { + if (message.publicKey !== undefined) { + any_1.Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); + } + if (message.data !== undefined) { + exports.SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).ldelim(); + } + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.publicKey = any_1.Any.decode(reader, reader.uint32()); + break; + case 2: + message.data = exports.SignatureDescriptor_Data.decode(reader, reader.uint32()); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + publicKey: (0, helpers_1.isSet)(object.publicKey) ? any_1.Any.fromJSON(object.publicKey) : undefined, + data: (0, helpers_1.isSet)(object.data) ? exports.SignatureDescriptor_Data.fromJSON(object.data) : undefined, + sequence: (0, helpers_1.isSet)(object.sequence) ? helpers_1.Long.fromValue(object.sequence) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.publicKey !== undefined && + (obj.publicKey = message.publicKey ? any_1.Any.toJSON(message.publicKey) : undefined); + message.data !== undefined && + (obj.data = message.data ? exports.SignatureDescriptor_Data.toJSON(message.data) : undefined); + message.sequence !== undefined && (obj.sequence = (message.sequence || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseSignatureDescriptor(); + message.publicKey = + object.publicKey !== undefined && object.publicKey !== null + ? any_1.Any.fromPartial(object.publicKey) + : undefined; + message.data = + object.data !== undefined && object.data !== null + ? exports.SignatureDescriptor_Data.fromPartial(object.data) + : undefined; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? helpers_1.Long.fromValue(object.sequence) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseSignatureDescriptor_Data() { + return { + single: undefined, + multi: undefined, + }; +} +exports.SignatureDescriptor_Data = { + encode(message, writer = _m0.Writer.create()) { + if (message.single !== undefined) { + exports.SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); + } + if (message.multi !== undefined) { + exports.SignatureDescriptor_Data_Multi.encode(message.multi, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.single = exports.SignatureDescriptor_Data_Single.decode(reader, reader.uint32()); + break; + case 2: + message.multi = exports.SignatureDescriptor_Data_Multi.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + single: (0, helpers_1.isSet)(object.single) ? exports.SignatureDescriptor_Data_Single.fromJSON(object.single) : undefined, + multi: (0, helpers_1.isSet)(object.multi) ? exports.SignatureDescriptor_Data_Multi.fromJSON(object.multi) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.single !== undefined && + (obj.single = message.single ? exports.SignatureDescriptor_Data_Single.toJSON(message.single) : undefined); + message.multi !== undefined && + (obj.multi = message.multi ? exports.SignatureDescriptor_Data_Multi.toJSON(message.multi) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseSignatureDescriptor_Data(); + message.single = + object.single !== undefined && object.single !== null + ? exports.SignatureDescriptor_Data_Single.fromPartial(object.single) + : undefined; + message.multi = + object.multi !== undefined && object.multi !== null + ? exports.SignatureDescriptor_Data_Multi.fromPartial(object.multi) + : undefined; + return message; + }, +}; +function createBaseSignatureDescriptor_Data_Single() { + return { + mode: 0, + signature: new Uint8Array(), + }; +} +exports.SignatureDescriptor_Data_Single = { + encode(message, writer = _m0.Writer.create()) { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + case 2: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + mode: (0, helpers_1.isSet)(object.mode) ? signModeFromJSON(object.mode) : 0, + signature: (0, helpers_1.isSet)(object.signature) ? (0, helpers_1.bytesFromBase64)(object.signature) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); + message.signature !== undefined && + (obj.signature = (0, helpers_1.base64FromBytes)(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseSignatureDescriptor_Data_Single(); + message.mode = object.mode ?? 0; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; +function createBaseSignatureDescriptor_Data_Multi() { + return { + bitarray: undefined, + signatures: [], + }; +} +exports.SignatureDescriptor_Data_Multi = { + encode(message, writer = _m0.Writer.create()) { + if (message.bitarray !== undefined) { + multisig_1.CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.signatures) { + exports.SignatureDescriptor_Data.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bitarray = multisig_1.CompactBitArray.decode(reader, reader.uint32()); + break; + case 2: + message.signatures.push(exports.SignatureDescriptor_Data.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + bitarray: (0, helpers_1.isSet)(object.bitarray) ? multisig_1.CompactBitArray.fromJSON(object.bitarray) : undefined, + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e) => exports.SignatureDescriptor_Data.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.bitarray !== undefined && + (obj.bitarray = message.bitarray ? multisig_1.CompactBitArray.toJSON(message.bitarray) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => (e ? exports.SignatureDescriptor_Data.toJSON(e) : undefined)); + } + else { + obj.signatures = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseSignatureDescriptor_Data_Multi(); + message.bitarray = + object.bitarray !== undefined && object.bitarray !== null + ? multisig_1.CompactBitArray.fromPartial(object.bitarray) + : undefined; + message.signatures = object.signatures?.map((e) => exports.SignatureDescriptor_Data.fromPartial(e)) || []; + return message; + }, +}; +//# sourceMappingURL=signing.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/tx/v1beta1/service.js": +/*!****************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/tx/v1beta1/service.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ServiceClientImpl = exports.GetBlockWithTxsResponse = exports.GetBlockWithTxsRequest = exports.GetTxResponse = exports.GetTxRequest = exports.SimulateResponse = exports.SimulateRequest = exports.BroadcastTxResponse = exports.BroadcastTxRequest = exports.GetTxsEventResponse = exports.GetTxsEventRequest = exports.broadcastModeToJSON = exports.broadcastModeFromJSON = exports.BroadcastMode = exports.orderByToJSON = exports.orderByFromJSON = exports.OrderBy = exports.protobufPackage = void 0; +/* eslint-disable */ +const tx_1 = __webpack_require__(/*! ./tx */ "./node_modules/cosmjs-types/cosmos/tx/v1beta1/tx.js"); +const pagination_1 = __webpack_require__(/*! ../../base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const abci_1 = __webpack_require__(/*! ../../base/abci/v1beta1/abci */ "./node_modules/cosmjs-types/cosmos/base/abci/v1beta1/abci.js"); +const types_1 = __webpack_require__(/*! ../../../tendermint/types/types */ "./node_modules/cosmjs-types/tendermint/types/types.js"); +const block_1 = __webpack_require__(/*! ../../../tendermint/types/block */ "./node_modules/cosmjs-types/tendermint/types/block.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.tx.v1beta1"; +/** OrderBy defines the sorting order */ +var OrderBy; +(function (OrderBy) { + /** ORDER_BY_UNSPECIFIED - ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. */ + OrderBy[OrderBy["ORDER_BY_UNSPECIFIED"] = 0] = "ORDER_BY_UNSPECIFIED"; + /** ORDER_BY_ASC - ORDER_BY_ASC defines ascending order */ + OrderBy[OrderBy["ORDER_BY_ASC"] = 1] = "ORDER_BY_ASC"; + /** ORDER_BY_DESC - ORDER_BY_DESC defines descending order */ + OrderBy[OrderBy["ORDER_BY_DESC"] = 2] = "ORDER_BY_DESC"; + OrderBy[OrderBy["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(OrderBy = exports.OrderBy || (exports.OrderBy = {})); +function orderByFromJSON(object) { + switch (object) { + case 0: + case "ORDER_BY_UNSPECIFIED": + return OrderBy.ORDER_BY_UNSPECIFIED; + case 1: + case "ORDER_BY_ASC": + return OrderBy.ORDER_BY_ASC; + case 2: + case "ORDER_BY_DESC": + return OrderBy.ORDER_BY_DESC; + case -1: + case "UNRECOGNIZED": + default: + return OrderBy.UNRECOGNIZED; + } +} +exports.orderByFromJSON = orderByFromJSON; +function orderByToJSON(object) { + switch (object) { + case OrderBy.ORDER_BY_UNSPECIFIED: + return "ORDER_BY_UNSPECIFIED"; + case OrderBy.ORDER_BY_ASC: + return "ORDER_BY_ASC"; + case OrderBy.ORDER_BY_DESC: + return "ORDER_BY_DESC"; + case OrderBy.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.orderByToJSON = orderByToJSON; +/** BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. */ +var BroadcastMode; +(function (BroadcastMode) { + /** BROADCAST_MODE_UNSPECIFIED - zero-value for mode ordering */ + BroadcastMode[BroadcastMode["BROADCAST_MODE_UNSPECIFIED"] = 0] = "BROADCAST_MODE_UNSPECIFIED"; + /** + * BROADCAST_MODE_BLOCK - BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for + * the tx to be committed in a block. + */ + BroadcastMode[BroadcastMode["BROADCAST_MODE_BLOCK"] = 1] = "BROADCAST_MODE_BLOCK"; + /** + * BROADCAST_MODE_SYNC - BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for + * a CheckTx execution response only. + */ + BroadcastMode[BroadcastMode["BROADCAST_MODE_SYNC"] = 2] = "BROADCAST_MODE_SYNC"; + /** + * BROADCAST_MODE_ASYNC - BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns + * immediately. + */ + BroadcastMode[BroadcastMode["BROADCAST_MODE_ASYNC"] = 3] = "BROADCAST_MODE_ASYNC"; + BroadcastMode[BroadcastMode["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(BroadcastMode = exports.BroadcastMode || (exports.BroadcastMode = {})); +function broadcastModeFromJSON(object) { + switch (object) { + case 0: + case "BROADCAST_MODE_UNSPECIFIED": + return BroadcastMode.BROADCAST_MODE_UNSPECIFIED; + case 1: + case "BROADCAST_MODE_BLOCK": + return BroadcastMode.BROADCAST_MODE_BLOCK; + case 2: + case "BROADCAST_MODE_SYNC": + return BroadcastMode.BROADCAST_MODE_SYNC; + case 3: + case "BROADCAST_MODE_ASYNC": + return BroadcastMode.BROADCAST_MODE_ASYNC; + case -1: + case "UNRECOGNIZED": + default: + return BroadcastMode.UNRECOGNIZED; + } +} +exports.broadcastModeFromJSON = broadcastModeFromJSON; +function broadcastModeToJSON(object) { + switch (object) { + case BroadcastMode.BROADCAST_MODE_UNSPECIFIED: + return "BROADCAST_MODE_UNSPECIFIED"; + case BroadcastMode.BROADCAST_MODE_BLOCK: + return "BROADCAST_MODE_BLOCK"; + case BroadcastMode.BROADCAST_MODE_SYNC: + return "BROADCAST_MODE_SYNC"; + case BroadcastMode.BROADCAST_MODE_ASYNC: + return "BROADCAST_MODE_ASYNC"; + case BroadcastMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.broadcastModeToJSON = broadcastModeToJSON; +function createBaseGetTxsEventRequest() { + return { + events: [], + pagination: undefined, + orderBy: 0, + }; +} +exports.GetTxsEventRequest = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.events) { + writer.uint32(10).string(v); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.orderBy !== 0) { + writer.uint32(24).int32(message.orderBy); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.events.push(reader.string()); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + case 3: + message.orderBy = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + events: Array.isArray(object?.events) ? object.events.map((e) => String(e)) : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + orderBy: (0, helpers_1.isSet)(object.orderBy) ? orderByFromJSON(object.orderBy) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.events) { + obj.events = message.events.map((e) => e); + } + else { + obj.events = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + message.orderBy !== undefined && (obj.orderBy = orderByToJSON(message.orderBy)); + return obj; + }, + fromPartial(object) { + const message = createBaseGetTxsEventRequest(); + message.events = object.events?.map((e) => e) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + message.orderBy = object.orderBy ?? 0; + return message; + }, +}; +function createBaseGetTxsEventResponse() { + return { + txs: [], + txResponses: [], + pagination: undefined, + }; +} +exports.GetTxsEventResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.txs) { + tx_1.Tx.encode(v, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.txResponses) { + abci_1.TxResponse.encode(v, writer.uint32(18).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(tx_1.Tx.decode(reader, reader.uint32())); + break; + case 2: + message.txResponses.push(abci_1.TxResponse.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + txs: Array.isArray(object?.txs) ? object.txs.map((e) => tx_1.Tx.fromJSON(e)) : [], + txResponses: Array.isArray(object?.txResponses) + ? object.txResponses.map((e) => abci_1.TxResponse.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => (e ? tx_1.Tx.toJSON(e) : undefined)); + } + else { + obj.txs = []; + } + if (message.txResponses) { + obj.txResponses = message.txResponses.map((e) => (e ? abci_1.TxResponse.toJSON(e) : undefined)); + } + else { + obj.txResponses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map((e) => tx_1.Tx.fromPartial(e)) || []; + message.txResponses = object.txResponses?.map((e) => abci_1.TxResponse.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseBroadcastTxRequest() { + return { + txBytes: new Uint8Array(), + mode: 0, + }; +} +exports.BroadcastTxRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + if (message.mode !== 0) { + writer.uint32(16).int32(message.mode); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txBytes = reader.bytes(); + break; + case 2: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + txBytes: (0, helpers_1.isSet)(object.txBytes) ? (0, helpers_1.bytesFromBase64)(object.txBytes) : new Uint8Array(), + mode: (0, helpers_1.isSet)(object.mode) ? broadcastModeFromJSON(object.mode) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.txBytes !== undefined && + (obj.txBytes = (0, helpers_1.base64FromBytes)(message.txBytes !== undefined ? message.txBytes : new Uint8Array())); + message.mode !== undefined && (obj.mode = broadcastModeToJSON(message.mode)); + return obj; + }, + fromPartial(object) { + const message = createBaseBroadcastTxRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(); + message.mode = object.mode ?? 0; + return message; + }, +}; +function createBaseBroadcastTxResponse() { + return { + txResponse: undefined, + }; +} +exports.BroadcastTxResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.txResponse !== undefined) { + abci_1.TxResponse.encode(message.txResponse, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txResponse = abci_1.TxResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + txResponse: (0, helpers_1.isSet)(object.txResponse) ? abci_1.TxResponse.fromJSON(object.txResponse) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.txResponse !== undefined && + (obj.txResponse = message.txResponse ? abci_1.TxResponse.toJSON(message.txResponse) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseBroadcastTxResponse(); + message.txResponse = + object.txResponse !== undefined && object.txResponse !== null + ? abci_1.TxResponse.fromPartial(object.txResponse) + : undefined; + return message; + }, +}; +function createBaseSimulateRequest() { + return { + tx: undefined, + txBytes: new Uint8Array(), + }; +} +exports.SimulateRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.tx !== undefined) { + tx_1.Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + if (message.txBytes.length !== 0) { + writer.uint32(18).bytes(message.txBytes); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = tx_1.Tx.decode(reader, reader.uint32()); + break; + case 2: + message.txBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + tx: (0, helpers_1.isSet)(object.tx) ? tx_1.Tx.fromJSON(object.tx) : undefined, + txBytes: (0, helpers_1.isSet)(object.txBytes) ? (0, helpers_1.bytesFromBase64)(object.txBytes) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.tx !== undefined && (obj.tx = message.tx ? tx_1.Tx.toJSON(message.tx) : undefined); + message.txBytes !== undefined && + (obj.txBytes = (0, helpers_1.base64FromBytes)(message.txBytes !== undefined ? message.txBytes : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseSimulateRequest(); + message.tx = object.tx !== undefined && object.tx !== null ? tx_1.Tx.fromPartial(object.tx) : undefined; + message.txBytes = object.txBytes ?? new Uint8Array(); + return message; + }, +}; +function createBaseSimulateResponse() { + return { + gasInfo: undefined, + result: undefined, + }; +} +exports.SimulateResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.gasInfo !== undefined) { + abci_1.GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).ldelim(); + } + if (message.result !== undefined) { + abci_1.Result.encode(message.result, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gasInfo = abci_1.GasInfo.decode(reader, reader.uint32()); + break; + case 2: + message.result = abci_1.Result.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + gasInfo: (0, helpers_1.isSet)(object.gasInfo) ? abci_1.GasInfo.fromJSON(object.gasInfo) : undefined, + result: (0, helpers_1.isSet)(object.result) ? abci_1.Result.fromJSON(object.result) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.gasInfo !== undefined && + (obj.gasInfo = message.gasInfo ? abci_1.GasInfo.toJSON(message.gasInfo) : undefined); + message.result !== undefined && (obj.result = message.result ? abci_1.Result.toJSON(message.result) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseSimulateResponse(); + message.gasInfo = + object.gasInfo !== undefined && object.gasInfo !== null + ? abci_1.GasInfo.fromPartial(object.gasInfo) + : undefined; + message.result = + object.result !== undefined && object.result !== null ? abci_1.Result.fromPartial(object.result) : undefined; + return message; + }, +}; +function createBaseGetTxRequest() { + return { + hash: "", + }; +} +exports.GetTxRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + hash: (0, helpers_1.isSet)(object.hash) ? String(object.hash) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.hash !== undefined && (obj.hash = message.hash); + return obj; + }, + fromPartial(object) { + const message = createBaseGetTxRequest(); + message.hash = object.hash ?? ""; + return message; + }, +}; +function createBaseGetTxResponse() { + return { + tx: undefined, + txResponse: undefined, + }; +} +exports.GetTxResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.tx !== undefined) { + tx_1.Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + if (message.txResponse !== undefined) { + abci_1.TxResponse.encode(message.txResponse, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = tx_1.Tx.decode(reader, reader.uint32()); + break; + case 2: + message.txResponse = abci_1.TxResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + tx: (0, helpers_1.isSet)(object.tx) ? tx_1.Tx.fromJSON(object.tx) : undefined, + txResponse: (0, helpers_1.isSet)(object.txResponse) ? abci_1.TxResponse.fromJSON(object.txResponse) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.tx !== undefined && (obj.tx = message.tx ? tx_1.Tx.toJSON(message.tx) : undefined); + message.txResponse !== undefined && + (obj.txResponse = message.txResponse ? abci_1.TxResponse.toJSON(message.txResponse) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseGetTxResponse(); + message.tx = object.tx !== undefined && object.tx !== null ? tx_1.Tx.fromPartial(object.tx) : undefined; + message.txResponse = + object.txResponse !== undefined && object.txResponse !== null + ? abci_1.TxResponse.fromPartial(object.txResponse) + : undefined; + return message; + }, +}; +function createBaseGetBlockWithTxsRequest() { + return { + height: helpers_1.Long.ZERO, + pagination: undefined, + }; +} +exports.GetBlockWithTxsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (!message.height.isZero()) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseGetBlockWithTxsRequest(); + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseGetBlockWithTxsResponse() { + return { + txs: [], + blockId: undefined, + block: undefined, + pagination: undefined, + }; +} +exports.GetBlockWithTxsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.txs) { + tx_1.Tx.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.blockId !== undefined) { + types_1.BlockID.encode(message.blockId, writer.uint32(18).fork()).ldelim(); + } + if (message.block !== undefined) { + block_1.Block.encode(message.block, writer.uint32(26).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(tx_1.Tx.decode(reader, reader.uint32())); + break; + case 2: + message.blockId = types_1.BlockID.decode(reader, reader.uint32()); + break; + case 3: + message.block = block_1.Block.decode(reader, reader.uint32()); + break; + case 4: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + txs: Array.isArray(object?.txs) ? object.txs.map((e) => tx_1.Tx.fromJSON(e)) : [], + blockId: (0, helpers_1.isSet)(object.blockId) ? types_1.BlockID.fromJSON(object.blockId) : undefined, + block: (0, helpers_1.isSet)(object.block) ? block_1.Block.fromJSON(object.block) : undefined, + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => (e ? tx_1.Tx.toJSON(e) : undefined)); + } + else { + obj.txs = []; + } + message.blockId !== undefined && + (obj.blockId = message.blockId ? types_1.BlockID.toJSON(message.blockId) : undefined); + message.block !== undefined && (obj.block = message.block ? block_1.Block.toJSON(message.block) : undefined); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map((e) => tx_1.Tx.fromPartial(e)) || []; + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? types_1.BlockID.fromPartial(object.blockId) + : undefined; + message.block = + object.block !== undefined && object.block !== null ? block_1.Block.fromPartial(object.block) : undefined; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +class ServiceClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Simulate = this.Simulate.bind(this); + this.GetTx = this.GetTx.bind(this); + this.BroadcastTx = this.BroadcastTx.bind(this); + this.GetTxsEvent = this.GetTxsEvent.bind(this); + this.GetBlockWithTxs = this.GetBlockWithTxs.bind(this); + } + Simulate(request) { + const data = exports.SimulateRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "Simulate", data); + return promise.then((data) => exports.SimulateResponse.decode(new _m0.Reader(data))); + } + GetTx(request) { + const data = exports.GetTxRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "GetTx", data); + return promise.then((data) => exports.GetTxResponse.decode(new _m0.Reader(data))); + } + BroadcastTx(request) { + const data = exports.BroadcastTxRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "BroadcastTx", data); + return promise.then((data) => exports.BroadcastTxResponse.decode(new _m0.Reader(data))); + } + GetTxsEvent(request) { + const data = exports.GetTxsEventRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "GetTxsEvent", data); + return promise.then((data) => exports.GetTxsEventResponse.decode(new _m0.Reader(data))); + } + GetBlockWithTxs(request) { + const data = exports.GetBlockWithTxsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "GetBlockWithTxs", data); + return promise.then((data) => exports.GetBlockWithTxsResponse.decode(new _m0.Reader(data))); + } +} +exports.ServiceClientImpl = ServiceClientImpl; +//# sourceMappingURL=service.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/tx/v1beta1/tx.js": +/*!***********************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/tx/v1beta1/tx.js ***! + \***********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Fee = exports.ModeInfo_Multi = exports.ModeInfo_Single = exports.ModeInfo = exports.SignerInfo = exports.AuthInfo = exports.TxBody = exports.SignDoc = exports.TxRaw = exports.Tx = exports.protobufPackage = void 0; +/* eslint-disable */ +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const signing_1 = __webpack_require__(/*! ../signing/v1beta1/signing */ "./node_modules/cosmjs-types/cosmos/tx/signing/v1beta1/signing.js"); +const multisig_1 = __webpack_require__(/*! ../../crypto/multisig/v1beta1/multisig */ "./node_modules/cosmjs-types/cosmos/crypto/multisig/v1beta1/multisig.js"); +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "cosmos.tx.v1beta1"; +function createBaseTx() { + return { + body: undefined, + authInfo: undefined, + signatures: [], + }; +} +exports.Tx = { + encode(message, writer = _m0.Writer.create()) { + if (message.body !== undefined) { + exports.TxBody.encode(message.body, writer.uint32(10).fork()).ldelim(); + } + if (message.authInfo !== undefined) { + exports.AuthInfo.encode(message.authInfo, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.body = exports.TxBody.decode(reader, reader.uint32()); + break; + case 2: + message.authInfo = exports.AuthInfo.decode(reader, reader.uint32()); + break; + case 3: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + body: (0, helpers_1.isSet)(object.body) ? exports.TxBody.fromJSON(object.body) : undefined, + authInfo: (0, helpers_1.isSet)(object.authInfo) ? exports.AuthInfo.fromJSON(object.authInfo) : undefined, + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e) => (0, helpers_1.bytesFromBase64)(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.body !== undefined && (obj.body = message.body ? exports.TxBody.toJSON(message.body) : undefined); + message.authInfo !== undefined && + (obj.authInfo = message.authInfo ? exports.AuthInfo.toJSON(message.authInfo) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => (0, helpers_1.base64FromBytes)(e !== undefined ? e : new Uint8Array())); + } + else { + obj.signatures = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseTx(); + message.body = + object.body !== undefined && object.body !== null ? exports.TxBody.fromPartial(object.body) : undefined; + message.authInfo = + object.authInfo !== undefined && object.authInfo !== null + ? exports.AuthInfo.fromPartial(object.authInfo) + : undefined; + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; +function createBaseTxRaw() { + return { + bodyBytes: new Uint8Array(), + authInfoBytes: new Uint8Array(), + signatures: [], + }; +} +exports.TxRaw = { + encode(message, writer = _m0.Writer.create()) { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxRaw(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bodyBytes = reader.bytes(); + break; + case 2: + message.authInfoBytes = reader.bytes(); + break; + case 3: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + bodyBytes: (0, helpers_1.isSet)(object.bodyBytes) ? (0, helpers_1.bytesFromBase64)(object.bodyBytes) : new Uint8Array(), + authInfoBytes: (0, helpers_1.isSet)(object.authInfoBytes) ? (0, helpers_1.bytesFromBase64)(object.authInfoBytes) : new Uint8Array(), + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e) => (0, helpers_1.bytesFromBase64)(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.bodyBytes !== undefined && + (obj.bodyBytes = (0, helpers_1.base64FromBytes)(message.bodyBytes !== undefined ? message.bodyBytes : new Uint8Array())); + message.authInfoBytes !== undefined && + (obj.authInfoBytes = (0, helpers_1.base64FromBytes)(message.authInfoBytes !== undefined ? message.authInfoBytes : new Uint8Array())); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => (0, helpers_1.base64FromBytes)(e !== undefined ? e : new Uint8Array())); + } + else { + obj.signatures = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseTxRaw(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; +function createBaseSignDoc() { + return { + bodyBytes: new Uint8Array(), + authInfoBytes: new Uint8Array(), + chainId: "", + accountNumber: helpers_1.Long.UZERO, + }; +} +exports.SignDoc = { + encode(message, writer = _m0.Writer.create()) { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (!message.accountNumber.isZero()) { + writer.uint32(32).uint64(message.accountNumber); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDoc(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bodyBytes = reader.bytes(); + break; + case 2: + message.authInfoBytes = reader.bytes(); + break; + case 3: + message.chainId = reader.string(); + break; + case 4: + message.accountNumber = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + bodyBytes: (0, helpers_1.isSet)(object.bodyBytes) ? (0, helpers_1.bytesFromBase64)(object.bodyBytes) : new Uint8Array(), + authInfoBytes: (0, helpers_1.isSet)(object.authInfoBytes) ? (0, helpers_1.bytesFromBase64)(object.authInfoBytes) : new Uint8Array(), + chainId: (0, helpers_1.isSet)(object.chainId) ? String(object.chainId) : "", + accountNumber: (0, helpers_1.isSet)(object.accountNumber) ? helpers_1.Long.fromValue(object.accountNumber) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.bodyBytes !== undefined && + (obj.bodyBytes = (0, helpers_1.base64FromBytes)(message.bodyBytes !== undefined ? message.bodyBytes : new Uint8Array())); + message.authInfoBytes !== undefined && + (obj.authInfoBytes = (0, helpers_1.base64FromBytes)(message.authInfoBytes !== undefined ? message.authInfoBytes : new Uint8Array())); + message.chainId !== undefined && (obj.chainId = message.chainId); + message.accountNumber !== undefined && + (obj.accountNumber = (message.accountNumber || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseSignDoc(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(); + message.chainId = object.chainId ?? ""; + message.accountNumber = + object.accountNumber !== undefined && object.accountNumber !== null + ? helpers_1.Long.fromValue(object.accountNumber) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseTxBody() { + return { + messages: [], + memo: "", + timeoutHeight: helpers_1.Long.UZERO, + extensionOptions: [], + nonCriticalExtensionOptions: [], + }; +} +exports.TxBody = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.messages) { + any_1.Any.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.memo !== "") { + writer.uint32(18).string(message.memo); + } + if (!message.timeoutHeight.isZero()) { + writer.uint32(24).uint64(message.timeoutHeight); + } + for (const v of message.extensionOptions) { + any_1.Any.encode(v, writer.uint32(8186).fork()).ldelim(); + } + for (const v of message.nonCriticalExtensionOptions) { + any_1.Any.encode(v, writer.uint32(16378).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxBody(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messages.push(any_1.Any.decode(reader, reader.uint32())); + break; + case 2: + message.memo = reader.string(); + break; + case 3: + message.timeoutHeight = reader.uint64(); + break; + case 1023: + message.extensionOptions.push(any_1.Any.decode(reader, reader.uint32())); + break; + case 2047: + message.nonCriticalExtensionOptions.push(any_1.Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + messages: Array.isArray(object?.messages) ? object.messages.map((e) => any_1.Any.fromJSON(e)) : [], + memo: (0, helpers_1.isSet)(object.memo) ? String(object.memo) : "", + timeoutHeight: (0, helpers_1.isSet)(object.timeoutHeight) ? helpers_1.Long.fromValue(object.timeoutHeight) : helpers_1.Long.UZERO, + extensionOptions: Array.isArray(object?.extensionOptions) + ? object.extensionOptions.map((e) => any_1.Any.fromJSON(e)) + : [], + nonCriticalExtensionOptions: Array.isArray(object?.nonCriticalExtensionOptions) + ? object.nonCriticalExtensionOptions.map((e) => any_1.Any.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.messages) { + obj.messages = message.messages.map((e) => (e ? any_1.Any.toJSON(e) : undefined)); + } + else { + obj.messages = []; + } + message.memo !== undefined && (obj.memo = message.memo); + message.timeoutHeight !== undefined && + (obj.timeoutHeight = (message.timeoutHeight || helpers_1.Long.UZERO).toString()); + if (message.extensionOptions) { + obj.extensionOptions = message.extensionOptions.map((e) => (e ? any_1.Any.toJSON(e) : undefined)); + } + else { + obj.extensionOptions = []; + } + if (message.nonCriticalExtensionOptions) { + obj.nonCriticalExtensionOptions = message.nonCriticalExtensionOptions.map((e) => e ? any_1.Any.toJSON(e) : undefined); + } + else { + obj.nonCriticalExtensionOptions = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseTxBody(); + message.messages = object.messages?.map((e) => any_1.Any.fromPartial(e)) || []; + message.memo = object.memo ?? ""; + message.timeoutHeight = + object.timeoutHeight !== undefined && object.timeoutHeight !== null + ? helpers_1.Long.fromValue(object.timeoutHeight) + : helpers_1.Long.UZERO; + message.extensionOptions = object.extensionOptions?.map((e) => any_1.Any.fromPartial(e)) || []; + message.nonCriticalExtensionOptions = + object.nonCriticalExtensionOptions?.map((e) => any_1.Any.fromPartial(e)) || []; + return message; + }, +}; +function createBaseAuthInfo() { + return { + signerInfos: [], + fee: undefined, + }; +} +exports.AuthInfo = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.signerInfos) { + exports.SignerInfo.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.fee !== undefined) { + exports.Fee.encode(message.fee, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signerInfos.push(exports.SignerInfo.decode(reader, reader.uint32())); + break; + case 2: + message.fee = exports.Fee.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + signerInfos: Array.isArray(object?.signerInfos) + ? object.signerInfos.map((e) => exports.SignerInfo.fromJSON(e)) + : [], + fee: (0, helpers_1.isSet)(object.fee) ? exports.Fee.fromJSON(object.fee) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.signerInfos) { + obj.signerInfos = message.signerInfos.map((e) => (e ? exports.SignerInfo.toJSON(e) : undefined)); + } + else { + obj.signerInfos = []; + } + message.fee !== undefined && (obj.fee = message.fee ? exports.Fee.toJSON(message.fee) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseAuthInfo(); + message.signerInfos = object.signerInfos?.map((e) => exports.SignerInfo.fromPartial(e)) || []; + message.fee = object.fee !== undefined && object.fee !== null ? exports.Fee.fromPartial(object.fee) : undefined; + return message; + }, +}; +function createBaseSignerInfo() { + return { + publicKey: undefined, + modeInfo: undefined, + sequence: helpers_1.Long.UZERO, + }; +} +exports.SignerInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.publicKey !== undefined) { + any_1.Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); + } + if (message.modeInfo !== undefined) { + exports.ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).ldelim(); + } + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.publicKey = any_1.Any.decode(reader, reader.uint32()); + break; + case 2: + message.modeInfo = exports.ModeInfo.decode(reader, reader.uint32()); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + publicKey: (0, helpers_1.isSet)(object.publicKey) ? any_1.Any.fromJSON(object.publicKey) : undefined, + modeInfo: (0, helpers_1.isSet)(object.modeInfo) ? exports.ModeInfo.fromJSON(object.modeInfo) : undefined, + sequence: (0, helpers_1.isSet)(object.sequence) ? helpers_1.Long.fromValue(object.sequence) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.publicKey !== undefined && + (obj.publicKey = message.publicKey ? any_1.Any.toJSON(message.publicKey) : undefined); + message.modeInfo !== undefined && + (obj.modeInfo = message.modeInfo ? exports.ModeInfo.toJSON(message.modeInfo) : undefined); + message.sequence !== undefined && (obj.sequence = (message.sequence || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseSignerInfo(); + message.publicKey = + object.publicKey !== undefined && object.publicKey !== null + ? any_1.Any.fromPartial(object.publicKey) + : undefined; + message.modeInfo = + object.modeInfo !== undefined && object.modeInfo !== null + ? exports.ModeInfo.fromPartial(object.modeInfo) + : undefined; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? helpers_1.Long.fromValue(object.sequence) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseModeInfo() { + return { + single: undefined, + multi: undefined, + }; +} +exports.ModeInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.single !== undefined) { + exports.ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); + } + if (message.multi !== undefined) { + exports.ModeInfo_Multi.encode(message.multi, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.single = exports.ModeInfo_Single.decode(reader, reader.uint32()); + break; + case 2: + message.multi = exports.ModeInfo_Multi.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + single: (0, helpers_1.isSet)(object.single) ? exports.ModeInfo_Single.fromJSON(object.single) : undefined, + multi: (0, helpers_1.isSet)(object.multi) ? exports.ModeInfo_Multi.fromJSON(object.multi) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.single !== undefined && + (obj.single = message.single ? exports.ModeInfo_Single.toJSON(message.single) : undefined); + message.multi !== undefined && + (obj.multi = message.multi ? exports.ModeInfo_Multi.toJSON(message.multi) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseModeInfo(); + message.single = + object.single !== undefined && object.single !== null + ? exports.ModeInfo_Single.fromPartial(object.single) + : undefined; + message.multi = + object.multi !== undefined && object.multi !== null + ? exports.ModeInfo_Multi.fromPartial(object.multi) + : undefined; + return message; + }, +}; +function createBaseModeInfo_Single() { + return { + mode: 0, + }; +} +exports.ModeInfo_Single = { + encode(message, writer = _m0.Writer.create()) { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + mode: (0, helpers_1.isSet)(object.mode) ? (0, signing_1.signModeFromJSON)(object.mode) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.mode !== undefined && (obj.mode = (0, signing_1.signModeToJSON)(message.mode)); + return obj; + }, + fromPartial(object) { + const message = createBaseModeInfo_Single(); + message.mode = object.mode ?? 0; + return message; + }, +}; +function createBaseModeInfo_Multi() { + return { + bitarray: undefined, + modeInfos: [], + }; +} +exports.ModeInfo_Multi = { + encode(message, writer = _m0.Writer.create()) { + if (message.bitarray !== undefined) { + multisig_1.CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.modeInfos) { + exports.ModeInfo.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bitarray = multisig_1.CompactBitArray.decode(reader, reader.uint32()); + break; + case 2: + message.modeInfos.push(exports.ModeInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + bitarray: (0, helpers_1.isSet)(object.bitarray) ? multisig_1.CompactBitArray.fromJSON(object.bitarray) : undefined, + modeInfos: Array.isArray(object?.modeInfos) + ? object.modeInfos.map((e) => exports.ModeInfo.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.bitarray !== undefined && + (obj.bitarray = message.bitarray ? multisig_1.CompactBitArray.toJSON(message.bitarray) : undefined); + if (message.modeInfos) { + obj.modeInfos = message.modeInfos.map((e) => (e ? exports.ModeInfo.toJSON(e) : undefined)); + } + else { + obj.modeInfos = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseModeInfo_Multi(); + message.bitarray = + object.bitarray !== undefined && object.bitarray !== null + ? multisig_1.CompactBitArray.fromPartial(object.bitarray) + : undefined; + message.modeInfos = object.modeInfos?.map((e) => exports.ModeInfo.fromPartial(e)) || []; + return message; + }, +}; +function createBaseFee() { + return { + amount: [], + gasLimit: helpers_1.Long.UZERO, + payer: "", + granter: "", + }; +} +exports.Fee = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.amount) { + coin_1.Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (!message.gasLimit.isZero()) { + writer.uint32(16).uint64(message.gasLimit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFee(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 2: + message.gasLimit = reader.uint64(); + break; + case 3: + message.payer = reader.string(); + break; + case 4: + message.granter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + amount: Array.isArray(object?.amount) ? object.amount.map((e) => coin_1.Coin.fromJSON(e)) : [], + gasLimit: (0, helpers_1.isSet)(object.gasLimit) ? helpers_1.Long.fromValue(object.gasLimit) : helpers_1.Long.UZERO, + payer: (0, helpers_1.isSet)(object.payer) ? String(object.payer) : "", + granter: (0, helpers_1.isSet)(object.granter) ? String(object.granter) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.amount = []; + } + message.gasLimit !== undefined && (obj.gasLimit = (message.gasLimit || helpers_1.Long.UZERO).toString()); + message.payer !== undefined && (obj.payer = message.payer); + message.granter !== undefined && (obj.granter = message.granter); + return obj; + }, + fromPartial(object) { + const message = createBaseFee(); + message.amount = object.amount?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.gasLimit = + object.gasLimit !== undefined && object.gasLimit !== null + ? helpers_1.Long.fromValue(object.gasLimit) + : helpers_1.Long.UZERO; + message.payer = object.payer ?? ""; + message.granter = object.granter ?? ""; + return message; + }, +}; +//# sourceMappingURL=tx.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/upgrade/v1beta1/upgrade.js": +/*!*********************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/upgrade/v1beta1/upgrade.js ***! + \*********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ModuleVersion = exports.CancelSoftwareUpgradeProposal = exports.SoftwareUpgradeProposal = exports.Plan = exports.protobufPackage = void 0; +/* eslint-disable */ +const timestamp_1 = __webpack_require__(/*! ../../../google/protobuf/timestamp */ "./node_modules/cosmjs-types/google/protobuf/timestamp.js"); +const any_1 = __webpack_require__(/*! ../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "cosmos.upgrade.v1beta1"; +function createBasePlan() { + return { + name: "", + time: undefined, + height: helpers_1.Long.ZERO, + info: "", + upgradedClientState: undefined, + }; +} +exports.Plan = { + encode(message, writer = _m0.Writer.create()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.time !== undefined) { + timestamp_1.Timestamp.encode(message.time, writer.uint32(18).fork()).ldelim(); + } + if (!message.height.isZero()) { + writer.uint32(24).int64(message.height); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.upgradedClientState !== undefined) { + any_1.Any.encode(message.upgradedClientState, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.time = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.upgradedClientState = any_1.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + name: (0, helpers_1.isSet)(object.name) ? String(object.name) : "", + time: (0, helpers_1.isSet)(object.time) ? (0, helpers_1.fromJsonTimestamp)(object.time) : undefined, + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + info: (0, helpers_1.isSet)(object.info) ? String(object.info) : "", + upgradedClientState: (0, helpers_1.isSet)(object.upgradedClientState) + ? any_1.Any.fromJSON(object.upgradedClientState) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + message.time !== undefined && (obj.time = (0, helpers_1.fromTimestamp)(message.time).toISOString()); + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + message.info !== undefined && (obj.info = message.info); + message.upgradedClientState !== undefined && + (obj.upgradedClientState = message.upgradedClientState + ? any_1.Any.toJSON(message.upgradedClientState) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBasePlan(); + message.name = object.name ?? ""; + message.time = + object.time !== undefined && object.time !== null ? timestamp_1.Timestamp.fromPartial(object.time) : undefined; + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + message.info = object.info ?? ""; + message.upgradedClientState = + object.upgradedClientState !== undefined && object.upgradedClientState !== null + ? any_1.Any.fromPartial(object.upgradedClientState) + : undefined; + return message; + }, +}; +function createBaseSoftwareUpgradeProposal() { + return { + title: "", + description: "", + plan: undefined, + }; +} +exports.SoftwareUpgradeProposal = { + encode(message, writer = _m0.Writer.create()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.plan !== undefined) { + exports.Plan.encode(message.plan, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.plan = exports.Plan.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + title: (0, helpers_1.isSet)(object.title) ? String(object.title) : "", + description: (0, helpers_1.isSet)(object.description) ? String(object.description) : "", + plan: (0, helpers_1.isSet)(object.plan) ? exports.Plan.fromJSON(object.plan) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.plan !== undefined && (obj.plan = message.plan ? exports.Plan.toJSON(message.plan) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseSoftwareUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.plan = + object.plan !== undefined && object.plan !== null ? exports.Plan.fromPartial(object.plan) : undefined; + return message; + }, +}; +function createBaseCancelSoftwareUpgradeProposal() { + return { + title: "", + description: "", + }; +} +exports.CancelSoftwareUpgradeProposal = { + encode(message, writer = _m0.Writer.create()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCancelSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + title: (0, helpers_1.isSet)(object.title) ? String(object.title) : "", + description: (0, helpers_1.isSet)(object.description) ? String(object.description) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + return obj; + }, + fromPartial(object) { + const message = createBaseCancelSoftwareUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; +function createBaseModuleVersion() { + return { + name: "", + version: helpers_1.Long.UZERO, + }; +} +exports.ModuleVersion = { + encode(message, writer = _m0.Writer.create()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (!message.version.isZero()) { + writer.uint32(16).uint64(message.version); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.version = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + name: (0, helpers_1.isSet)(object.name) ? String(object.name) : "", + version: (0, helpers_1.isSet)(object.version) ? helpers_1.Long.fromValue(object.version) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + message.version !== undefined && (obj.version = (message.version || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseModuleVersion(); + message.name = object.name ?? ""; + message.version = + object.version !== undefined && object.version !== null ? helpers_1.Long.fromValue(object.version) : helpers_1.Long.UZERO; + return message; + }, +}; +//# sourceMappingURL=upgrade.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/vesting/v1beta1/tx.js": +/*!****************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/vesting/v1beta1/tx.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MsgClientImpl = exports.MsgCreateVestingAccountResponse = exports.MsgCreateVestingAccount = exports.protobufPackage = void 0; +/* eslint-disable */ +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "cosmos.vesting.v1beta1"; +function createBaseMsgCreateVestingAccount() { + return { + fromAddress: "", + toAddress: "", + amount: [], + endTime: helpers_1.Long.ZERO, + delayed: false, + }; +} +exports.MsgCreateVestingAccount = { + encode(message, writer = _m0.Writer.create()) { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + coin_1.Coin.encode(v, writer.uint32(26).fork()).ldelim(); + } + if (!message.endTime.isZero()) { + writer.uint32(32).int64(message.endTime); + } + if (message.delayed === true) { + writer.uint32(40).bool(message.delayed); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fromAddress = reader.string(); + break; + case 2: + message.toAddress = reader.string(); + break; + case 3: + message.amount.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 4: + message.endTime = reader.int64(); + break; + case 5: + message.delayed = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + fromAddress: (0, helpers_1.isSet)(object.fromAddress) ? String(object.fromAddress) : "", + toAddress: (0, helpers_1.isSet)(object.toAddress) ? String(object.toAddress) : "", + amount: Array.isArray(object?.amount) ? object.amount.map((e) => coin_1.Coin.fromJSON(e)) : [], + endTime: (0, helpers_1.isSet)(object.endTime) ? helpers_1.Long.fromValue(object.endTime) : helpers_1.Long.ZERO, + delayed: (0, helpers_1.isSet)(object.delayed) ? Boolean(object.delayed) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); + message.toAddress !== undefined && (obj.toAddress = message.toAddress); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.amount = []; + } + message.endTime !== undefined && (obj.endTime = (message.endTime || helpers_1.Long.ZERO).toString()); + message.delayed !== undefined && (obj.delayed = message.delayed); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgCreateVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.endTime = + object.endTime !== undefined && object.endTime !== null ? helpers_1.Long.fromValue(object.endTime) : helpers_1.Long.ZERO; + message.delayed = object.delayed ?? false; + return message; + }, +}; +function createBaseMsgCreateVestingAccountResponse() { + return {}; +} +exports.MsgCreateVestingAccountResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, +}; +class MsgClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.CreateVestingAccount = this.CreateVestingAccount.bind(this); + } + CreateVestingAccount(request) { + const data = exports.MsgCreateVestingAccount.encode(request).finish(); + const promise = this.rpc.request("cosmos.vesting.v1beta1.Msg", "CreateVestingAccount", data); + return promise.then((data) => exports.MsgCreateVestingAccountResponse.decode(new _m0.Reader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +//# sourceMappingURL=tx.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/cosmos/vesting/v1beta1/vesting.js": +/*!*********************************************************************!*\ + !*** ./node_modules/cosmjs-types/cosmos/vesting/v1beta1/vesting.js ***! + \*********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PermanentLockedAccount = exports.PeriodicVestingAccount = exports.Period = exports.DelayedVestingAccount = exports.ContinuousVestingAccount = exports.BaseVestingAccount = exports.protobufPackage = void 0; +/* eslint-disable */ +const auth_1 = __webpack_require__(/*! ../../auth/v1beta1/auth */ "./node_modules/cosmjs-types/cosmos/auth/v1beta1/auth.js"); +const coin_1 = __webpack_require__(/*! ../../base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const helpers_1 = __webpack_require__(/*! ../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "cosmos.vesting.v1beta1"; +function createBaseBaseVestingAccount() { + return { + baseAccount: undefined, + originalVesting: [], + delegatedFree: [], + delegatedVesting: [], + endTime: helpers_1.Long.ZERO, + }; +} +exports.BaseVestingAccount = { + encode(message, writer = _m0.Writer.create()) { + if (message.baseAccount !== undefined) { + auth_1.BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.originalVesting) { + coin_1.Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatedFree) { + coin_1.Coin.encode(v, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.delegatedVesting) { + coin_1.Coin.encode(v, writer.uint32(34).fork()).ldelim(); + } + if (!message.endTime.isZero()) { + writer.uint32(40).int64(message.endTime); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseAccount = auth_1.BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + message.originalVesting.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 3: + message.delegatedFree.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 4: + message.delegatedVesting.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + case 5: + message.endTime = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + baseAccount: (0, helpers_1.isSet)(object.baseAccount) ? auth_1.BaseAccount.fromJSON(object.baseAccount) : undefined, + originalVesting: Array.isArray(object?.originalVesting) + ? object.originalVesting.map((e) => coin_1.Coin.fromJSON(e)) + : [], + delegatedFree: Array.isArray(object?.delegatedFree) + ? object.delegatedFree.map((e) => coin_1.Coin.fromJSON(e)) + : [], + delegatedVesting: Array.isArray(object?.delegatedVesting) + ? object.delegatedVesting.map((e) => coin_1.Coin.fromJSON(e)) + : [], + endTime: (0, helpers_1.isSet)(object.endTime) ? helpers_1.Long.fromValue(object.endTime) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.baseAccount !== undefined && + (obj.baseAccount = message.baseAccount ? auth_1.BaseAccount.toJSON(message.baseAccount) : undefined); + if (message.originalVesting) { + obj.originalVesting = message.originalVesting.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.originalVesting = []; + } + if (message.delegatedFree) { + obj.delegatedFree = message.delegatedFree.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.delegatedFree = []; + } + if (message.delegatedVesting) { + obj.delegatedVesting = message.delegatedVesting.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.delegatedVesting = []; + } + message.endTime !== undefined && (obj.endTime = (message.endTime || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseBaseVestingAccount(); + message.baseAccount = + object.baseAccount !== undefined && object.baseAccount !== null + ? auth_1.BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.originalVesting = object.originalVesting?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.delegatedFree = object.delegatedFree?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.delegatedVesting = object.delegatedVesting?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.endTime = + object.endTime !== undefined && object.endTime !== null ? helpers_1.Long.fromValue(object.endTime) : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseContinuousVestingAccount() { + return { + baseVestingAccount: undefined, + startTime: helpers_1.Long.ZERO, + }; +} +exports.ContinuousVestingAccount = { + encode(message, writer = _m0.Writer.create()) { + if (message.baseVestingAccount !== undefined) { + exports.BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); + } + if (!message.startTime.isZero()) { + writer.uint32(16).int64(message.startTime); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContinuousVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVestingAccount = exports.BaseVestingAccount.decode(reader, reader.uint32()); + break; + case 2: + message.startTime = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + baseVestingAccount: (0, helpers_1.isSet)(object.baseVestingAccount) + ? exports.BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + startTime: (0, helpers_1.isSet)(object.startTime) ? helpers_1.Long.fromValue(object.startTime) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.baseVestingAccount !== undefined && + (obj.baseVestingAccount = message.baseVestingAccount + ? exports.BaseVestingAccount.toJSON(message.baseVestingAccount) + : undefined); + message.startTime !== undefined && (obj.startTime = (message.startTime || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseContinuousVestingAccount(); + message.baseVestingAccount = + object.baseVestingAccount !== undefined && object.baseVestingAccount !== null + ? exports.BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + message.startTime = + object.startTime !== undefined && object.startTime !== null + ? helpers_1.Long.fromValue(object.startTime) + : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseDelayedVestingAccount() { + return { + baseVestingAccount: undefined, + }; +} +exports.DelayedVestingAccount = { + encode(message, writer = _m0.Writer.create()) { + if (message.baseVestingAccount !== undefined) { + exports.BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelayedVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVestingAccount = exports.BaseVestingAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + baseVestingAccount: (0, helpers_1.isSet)(object.baseVestingAccount) + ? exports.BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.baseVestingAccount !== undefined && + (obj.baseVestingAccount = message.baseVestingAccount + ? exports.BaseVestingAccount.toJSON(message.baseVestingAccount) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseDelayedVestingAccount(); + message.baseVestingAccount = + object.baseVestingAccount !== undefined && object.baseVestingAccount !== null + ? exports.BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + return message; + }, +}; +function createBasePeriod() { + return { + length: helpers_1.Long.ZERO, + amount: [], + }; +} +exports.Period = { + encode(message, writer = _m0.Writer.create()) { + if (!message.length.isZero()) { + writer.uint32(8).int64(message.length); + } + for (const v of message.amount) { + coin_1.Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.length = reader.int64(); + break; + case 2: + message.amount.push(coin_1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + length: (0, helpers_1.isSet)(object.length) ? helpers_1.Long.fromValue(object.length) : helpers_1.Long.ZERO, + amount: Array.isArray(object?.amount) ? object.amount.map((e) => coin_1.Coin.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.length !== undefined && (obj.length = (message.length || helpers_1.Long.ZERO).toString()); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined)); + } + else { + obj.amount = []; + } + return obj; + }, + fromPartial(object) { + const message = createBasePeriod(); + message.length = + object.length !== undefined && object.length !== null ? helpers_1.Long.fromValue(object.length) : helpers_1.Long.ZERO; + message.amount = object.amount?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBasePeriodicVestingAccount() { + return { + baseVestingAccount: undefined, + startTime: helpers_1.Long.ZERO, + vestingPeriods: [], + }; +} +exports.PeriodicVestingAccount = { + encode(message, writer = _m0.Writer.create()) { + if (message.baseVestingAccount !== undefined) { + exports.BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); + } + if (!message.startTime.isZero()) { + writer.uint32(16).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + exports.Period.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVestingAccount = exports.BaseVestingAccount.decode(reader, reader.uint32()); + break; + case 2: + message.startTime = reader.int64(); + break; + case 3: + message.vestingPeriods.push(exports.Period.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + baseVestingAccount: (0, helpers_1.isSet)(object.baseVestingAccount) + ? exports.BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + startTime: (0, helpers_1.isSet)(object.startTime) ? helpers_1.Long.fromValue(object.startTime) : helpers_1.Long.ZERO, + vestingPeriods: Array.isArray(object?.vestingPeriods) + ? object.vestingPeriods.map((e) => exports.Period.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.baseVestingAccount !== undefined && + (obj.baseVestingAccount = message.baseVestingAccount + ? exports.BaseVestingAccount.toJSON(message.baseVestingAccount) + : undefined); + message.startTime !== undefined && (obj.startTime = (message.startTime || helpers_1.Long.ZERO).toString()); + if (message.vestingPeriods) { + obj.vestingPeriods = message.vestingPeriods.map((e) => (e ? exports.Period.toJSON(e) : undefined)); + } + else { + obj.vestingPeriods = []; + } + return obj; + }, + fromPartial(object) { + const message = createBasePeriodicVestingAccount(); + message.baseVestingAccount = + object.baseVestingAccount !== undefined && object.baseVestingAccount !== null + ? exports.BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + message.startTime = + object.startTime !== undefined && object.startTime !== null + ? helpers_1.Long.fromValue(object.startTime) + : helpers_1.Long.ZERO; + message.vestingPeriods = object.vestingPeriods?.map((e) => exports.Period.fromPartial(e)) || []; + return message; + }, +}; +function createBasePermanentLockedAccount() { + return { + baseVestingAccount: undefined, + }; +} +exports.PermanentLockedAccount = { + encode(message, writer = _m0.Writer.create()) { + if (message.baseVestingAccount !== undefined) { + exports.BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVestingAccount = exports.BaseVestingAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + baseVestingAccount: (0, helpers_1.isSet)(object.baseVestingAccount) + ? exports.BaseVestingAccount.fromJSON(object.baseVestingAccount) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.baseVestingAccount !== undefined && + (obj.baseVestingAccount = message.baseVestingAccount + ? exports.BaseVestingAccount.toJSON(message.baseVestingAccount) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBasePermanentLockedAccount(); + message.baseVestingAccount = + object.baseVestingAccount !== undefined && object.baseVestingAccount !== null + ? exports.BaseVestingAccount.fromPartial(object.baseVestingAccount) + : undefined; + return message; + }, +}; +//# sourceMappingURL=vesting.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/google/protobuf/any.js": +/*!**********************************************************!*\ + !*** ./node_modules/cosmjs-types/google/protobuf/any.js ***! + \**********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Any = exports.protobufPackage = void 0; +/* eslint-disable */ +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "google.protobuf"; +function createBaseAny() { + return { + typeUrl: "", + value: new Uint8Array(), + }; +} +exports.Any = { + encode(message, writer = _m0.Writer.create()) { + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAny(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.typeUrl = reader.string(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + typeUrl: (0, helpers_1.isSet)(object.typeUrl) ? String(object.typeUrl) : "", + value: (0, helpers_1.isSet)(object.value) ? (0, helpers_1.bytesFromBase64)(object.value) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); + message.value !== undefined && + (obj.value = (0, helpers_1.base64FromBytes)(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseAny(); + message.typeUrl = object.typeUrl ?? ""; + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; +//# sourceMappingURL=any.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/google/protobuf/duration.js": +/*!***************************************************************!*\ + !*** ./node_modules/cosmjs-types/google/protobuf/duration.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Duration = exports.protobufPackage = void 0; +/* eslint-disable */ +const helpers_1 = __webpack_require__(/*! ../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "google.protobuf"; +function createBaseDuration() { + return { + seconds: helpers_1.Long.ZERO, + nanos: 0, + }; +} +exports.Duration = { + encode(message, writer = _m0.Writer.create()) { + if (!message.seconds.isZero()) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + seconds: (0, helpers_1.isSet)(object.seconds) ? helpers_1.Long.fromValue(object.seconds) : helpers_1.Long.ZERO, + nanos: (0, helpers_1.isSet)(object.nanos) ? Number(object.nanos) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.seconds !== undefined && (obj.seconds = (message.seconds || helpers_1.Long.ZERO).toString()); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + fromPartial(object) { + const message = createBaseDuration(); + message.seconds = + object.seconds !== undefined && object.seconds !== null ? helpers_1.Long.fromValue(object.seconds) : helpers_1.Long.ZERO; + message.nanos = object.nanos ?? 0; + return message; + }, +}; +//# sourceMappingURL=duration.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/google/protobuf/timestamp.js": +/*!****************************************************************!*\ + !*** ./node_modules/cosmjs-types/google/protobuf/timestamp.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Timestamp = exports.protobufPackage = void 0; +/* eslint-disable */ +const helpers_1 = __webpack_require__(/*! ../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "google.protobuf"; +function createBaseTimestamp() { + return { + seconds: helpers_1.Long.ZERO, + nanos: 0, + }; +} +exports.Timestamp = { + encode(message, writer = _m0.Writer.create()) { + if (!message.seconds.isZero()) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + seconds: (0, helpers_1.isSet)(object.seconds) ? helpers_1.Long.fromValue(object.seconds) : helpers_1.Long.ZERO, + nanos: (0, helpers_1.isSet)(object.nanos) ? Number(object.nanos) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.seconds !== undefined && (obj.seconds = (message.seconds || helpers_1.Long.ZERO).toString()); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + fromPartial(object) { + const message = createBaseTimestamp(); + message.seconds = + object.seconds !== undefined && object.seconds !== null ? helpers_1.Long.fromValue(object.seconds) : helpers_1.Long.ZERO; + message.nanos = object.nanos ?? 0; + return message; + }, +}; +//# sourceMappingURL=timestamp.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/helpers.js": +/*!**********************************************!*\ + !*** ./node_modules/cosmjs-types/helpers.js ***! + \**********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; + +/* eslint-disable */ +/** + * This file and any referenced files were automatically generated by @osmonauts/telescope@0.88.2 + * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain + * and run the transpile command or yarn proto command to regenerate this bundle. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromJsonTimestamp = exports.fromTimestamp = exports.toTimestamp = exports.setPaginationParams = exports.isObject = exports.isSet = exports.fromDuration = exports.toDuration = exports.omitDefault = exports.base64FromBytes = exports.bytesFromBase64 = exports.Long = void 0; +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const long_1 = __importDefault(__webpack_require__(/*! long */ "./node_modules/long/src/long.js")); +exports.Long = long_1.default; +// @ts-ignore +if (_m0.util.Long !== long_1.default) { + _m0.util.Long = long_1.default; + _m0.configure(); +} +var globalThis = (() => { + if (typeof globalThis !== "undefined") + return globalThis; + if (typeof self !== "undefined") + return self; + if (typeof window !== "undefined") + return window; + if (typeof __webpack_require__.g !== "undefined") + return __webpack_require__.g; + throw "Unable to locate global object"; +})(); +const atob = globalThis.atob || ((b64) => globalThis.Buffer.from(b64, "base64").toString("binary")); +function bytesFromBase64(b64) { + const bin = atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} +exports.bytesFromBase64 = bytesFromBase64; +const btoa = globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64")); +function base64FromBytes(arr) { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return btoa(bin.join("")); +} +exports.base64FromBytes = base64FromBytes; +function omitDefault(input) { + if (typeof input === "string") { + return input === "" ? undefined : input; + } + if (typeof input === "number") { + return input === 0 ? undefined : input; + } + if (long_1.default.isLong(input)) { + return input.isZero() ? undefined : input; + } + throw new Error(`Got unsupported type ${typeof input}`); +} +exports.omitDefault = omitDefault; +function toDuration(duration) { + return { + seconds: long_1.default.fromNumber(Math.floor(parseInt(duration) / 1000000000)), + nanos: parseInt(duration) % 1000000000, + }; +} +exports.toDuration = toDuration; +function fromDuration(duration) { + return (parseInt(duration.seconds.toString()) * 1000000000 + duration.nanos).toString(); +} +exports.fromDuration = fromDuration; +function isSet(value) { + return value !== null && value !== undefined; +} +exports.isSet = isSet; +function isObject(value) { + return typeof value === "object" && value !== null; +} +exports.isObject = isObject; +const setPaginationParams = (options, pagination) => { + if (!pagination) { + return options; + } + if (typeof pagination?.countTotal !== "undefined") { + options.params["pagination.count_total"] = pagination.countTotal; + } + if (typeof pagination?.key !== "undefined") { + // String to Uint8Array + // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); + // Uint8Array to String + options.params["pagination.key"] = Buffer.from(pagination.key).toString("base64"); + } + if (typeof pagination?.limit !== "undefined") { + options.params["pagination.limit"] = pagination.limit.toString(); + } + if (typeof pagination?.offset !== "undefined") { + options.params["pagination.offset"] = pagination.offset.toString(); + } + if (typeof pagination?.reverse !== "undefined") { + options.params["pagination.reverse"] = pagination.reverse; + } + return options; +}; +exports.setPaginationParams = setPaginationParams; +function toTimestamp(date) { + const seconds = numberToLong(date.getTime() / 1000); + const nanos = (date.getTime() % 1000) * 1000000; + return { + seconds, + nanos, + }; +} +exports.toTimestamp = toTimestamp; +function fromTimestamp(t) { + let millis = t.seconds.toNumber() * 1000; + millis += t.nanos / 1000000; + return new Date(millis); +} +exports.fromTimestamp = fromTimestamp; +const fromJSON = (object) => { + return { + seconds: isSet(object.seconds) ? long_1.default.fromString(object.seconds) : long_1.default.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; +}; +const timestampFromJSON = (object) => { + return { + seconds: isSet(object.seconds) ? long_1.default.fromValue(object.seconds) : long_1.default.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; +}; +function fromJsonTimestamp(o) { + if (o instanceof Date) { + return toTimestamp(o); + } + else if (typeof o === "string") { + return toTimestamp(new Date(o)); + } + else { + return timestampFromJSON(o); + } +} +exports.fromJsonTimestamp = fromJsonTimestamp; +function numberToLong(number) { + return long_1.default.fromNumber(number); +} +//# sourceMappingURL=helpers.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/applications/transfer/v1/query.js": +/*!*************************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/applications/transfer/v1/query.js ***! + \*************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QueryEscrowAddressResponse = exports.QueryEscrowAddressRequest = exports.QueryDenomHashResponse = exports.QueryDenomHashRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.QueryDenomTracesResponse = exports.QueryDenomTracesRequest = exports.QueryDenomTraceResponse = exports.QueryDenomTraceRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const pagination_1 = __webpack_require__(/*! ../../../../cosmos/base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const transfer_1 = __webpack_require__(/*! ./transfer */ "./node_modules/cosmjs-types/ibc/applications/transfer/v1/transfer.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "ibc.applications.transfer.v1"; +function createBaseQueryDenomTraceRequest() { + return { + hash: "", + }; +} +exports.QueryDenomTraceRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomTraceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + hash: (0, helpers_1.isSet)(object.hash) ? String(object.hash) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.hash !== undefined && (obj.hash = message.hash); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDenomTraceRequest(); + message.hash = object.hash ?? ""; + return message; + }, +}; +function createBaseQueryDenomTraceResponse() { + return { + denomTrace: undefined, + }; +} +exports.QueryDenomTraceResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.denomTrace !== undefined) { + transfer_1.DenomTrace.encode(message.denomTrace, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomTraceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denomTrace = transfer_1.DenomTrace.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + denomTrace: (0, helpers_1.isSet)(object.denomTrace) ? transfer_1.DenomTrace.fromJSON(object.denomTrace) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.denomTrace !== undefined && + (obj.denomTrace = message.denomTrace ? transfer_1.DenomTrace.toJSON(message.denomTrace) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDenomTraceResponse(); + message.denomTrace = + object.denomTrace !== undefined && object.denomTrace !== null + ? transfer_1.DenomTrace.fromPartial(object.denomTrace) + : undefined; + return message; + }, +}; +function createBaseQueryDenomTracesRequest() { + return { + pagination: undefined, + }; +} +exports.QueryDenomTracesRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomTracesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDenomTracesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryDenomTracesResponse() { + return { + denomTraces: [], + pagination: undefined, + }; +} +exports.QueryDenomTracesResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.denomTraces) { + transfer_1.DenomTrace.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomTracesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denomTraces.push(transfer_1.DenomTrace.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + denomTraces: Array.isArray(object?.denomTraces) + ? object.denomTraces.map((e) => transfer_1.DenomTrace.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.denomTraces) { + obj.denomTraces = message.denomTraces.map((e) => (e ? transfer_1.DenomTrace.toJSON(e) : undefined)); + } + else { + obj.denomTraces = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDenomTracesResponse(); + message.denomTraces = object.denomTraces?.map((e) => transfer_1.DenomTrace.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryParamsRequest() { + return {}; +} +exports.QueryParamsRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { + params: undefined, + }; +} +exports.QueryParamsResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.params !== undefined) { + transfer_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = transfer_1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + params: (0, helpers_1.isSet)(object.params) ? transfer_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.params !== undefined && (obj.params = message.params ? transfer_1.Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null ? transfer_1.Params.fromPartial(object.params) : undefined; + return message; + }, +}; +function createBaseQueryDenomHashRequest() { + return { + trace: "", + }; +} +exports.QueryDenomHashRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.trace !== "") { + writer.uint32(10).string(message.trace); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomHashRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.trace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + trace: (0, helpers_1.isSet)(object.trace) ? String(object.trace) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.trace !== undefined && (obj.trace = message.trace); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDenomHashRequest(); + message.trace = object.trace ?? ""; + return message; + }, +}; +function createBaseQueryDenomHashResponse() { + return { + hash: "", + }; +} +exports.QueryDenomHashResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomHashResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + hash: (0, helpers_1.isSet)(object.hash) ? String(object.hash) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.hash !== undefined && (obj.hash = message.hash); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDenomHashResponse(); + message.hash = object.hash ?? ""; + return message; + }, +}; +function createBaseQueryEscrowAddressRequest() { + return { + portId: "", + channelId: "", + }; +} +exports.QueryEscrowAddressRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEscrowAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryEscrowAddressRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; +function createBaseQueryEscrowAddressResponse() { + return { + escrowAddress: "", + }; +} +exports.QueryEscrowAddressResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.escrowAddress !== "") { + writer.uint32(10).string(message.escrowAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEscrowAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.escrowAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + escrowAddress: (0, helpers_1.isSet)(object.escrowAddress) ? String(object.escrowAddress) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.escrowAddress !== undefined && (obj.escrowAddress = message.escrowAddress); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryEscrowAddressResponse(); + message.escrowAddress = object.escrowAddress ?? ""; + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.DenomTrace = this.DenomTrace.bind(this); + this.DenomTraces = this.DenomTraces.bind(this); + this.Params = this.Params.bind(this); + this.DenomHash = this.DenomHash.bind(this); + this.EscrowAddress = this.EscrowAddress.bind(this); + } + DenomTrace(request) { + const data = exports.QueryDenomTraceRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomTrace", data); + return promise.then((data) => exports.QueryDenomTraceResponse.decode(new _m0.Reader(data))); + } + DenomTraces(request = { + pagination: undefined, + }) { + const data = exports.QueryDenomTracesRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomTraces", data); + return promise.then((data) => exports.QueryDenomTracesResponse.decode(new _m0.Reader(data))); + } + Params(request = {}) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new _m0.Reader(data))); + } + DenomHash(request) { + const data = exports.QueryDenomHashRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomHash", data); + return promise.then((data) => exports.QueryDenomHashResponse.decode(new _m0.Reader(data))); + } + EscrowAddress(request) { + const data = exports.QueryEscrowAddressRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "EscrowAddress", data); + return promise.then((data) => exports.QueryEscrowAddressResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/applications/transfer/v1/transfer.js": +/*!****************************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/applications/transfer/v1/transfer.js ***! + \****************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Params = exports.DenomTrace = exports.protobufPackage = void 0; +/* eslint-disable */ +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "ibc.applications.transfer.v1"; +function createBaseDenomTrace() { + return { + path: "", + baseDenom: "", + }; +} +exports.DenomTrace = { + encode(message, writer = _m0.Writer.create()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.baseDenom !== "") { + writer.uint32(18).string(message.baseDenom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomTrace(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.string(); + break; + case 2: + message.baseDenom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + path: (0, helpers_1.isSet)(object.path) ? String(object.path) : "", + baseDenom: (0, helpers_1.isSet)(object.baseDenom) ? String(object.baseDenom) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.path !== undefined && (obj.path = message.path); + message.baseDenom !== undefined && (obj.baseDenom = message.baseDenom); + return obj; + }, + fromPartial(object) { + const message = createBaseDenomTrace(); + message.path = object.path ?? ""; + message.baseDenom = object.baseDenom ?? ""; + return message; + }, +}; +function createBaseParams() { + return { + sendEnabled: false, + receiveEnabled: false, + }; +} +exports.Params = { + encode(message, writer = _m0.Writer.create()) { + if (message.sendEnabled === true) { + writer.uint32(8).bool(message.sendEnabled); + } + if (message.receiveEnabled === true) { + writer.uint32(16).bool(message.receiveEnabled); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sendEnabled = reader.bool(); + break; + case 2: + message.receiveEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + sendEnabled: (0, helpers_1.isSet)(object.sendEnabled) ? Boolean(object.sendEnabled) : false, + receiveEnabled: (0, helpers_1.isSet)(object.receiveEnabled) ? Boolean(object.receiveEnabled) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.sendEnabled !== undefined && (obj.sendEnabled = message.sendEnabled); + message.receiveEnabled !== undefined && (obj.receiveEnabled = message.receiveEnabled); + return obj; + }, + fromPartial(object) { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled ?? false; + message.receiveEnabled = object.receiveEnabled ?? false; + return message; + }, +}; +//# sourceMappingURL=transfer.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/applications/transfer/v1/tx.js": +/*!**********************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/applications/transfer/v1/tx.js ***! + \**********************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MsgClientImpl = exports.MsgTransferResponse = exports.MsgTransfer = exports.protobufPackage = void 0; +/* eslint-disable */ +const coin_1 = __webpack_require__(/*! ../../../../cosmos/base/v1beta1/coin */ "./node_modules/cosmjs-types/cosmos/base/v1beta1/coin.js"); +const client_1 = __webpack_require__(/*! ../../../core/client/v1/client */ "./node_modules/cosmjs-types/ibc/core/client/v1/client.js"); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "ibc.applications.transfer.v1"; +function createBaseMsgTransfer() { + return { + sourcePort: "", + sourceChannel: "", + token: undefined, + sender: "", + receiver: "", + timeoutHeight: undefined, + timeoutTimestamp: helpers_1.Long.UZERO, + memo: "", + }; +} +exports.MsgTransfer = { + encode(message, writer = _m0.Writer.create()) { + if (message.sourcePort !== "") { + writer.uint32(10).string(message.sourcePort); + } + if (message.sourceChannel !== "") { + writer.uint32(18).string(message.sourceChannel); + } + if (message.token !== undefined) { + coin_1.Coin.encode(message.token, writer.uint32(26).fork()).ldelim(); + } + if (message.sender !== "") { + writer.uint32(34).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(42).string(message.receiver); + } + if (message.timeoutHeight !== undefined) { + client_1.Height.encode(message.timeoutHeight, writer.uint32(50).fork()).ldelim(); + } + if (!message.timeoutTimestamp.isZero()) { + writer.uint32(56).uint64(message.timeoutTimestamp); + } + if (message.memo !== "") { + writer.uint32(66).string(message.memo); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTransfer(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sourcePort = reader.string(); + break; + case 2: + message.sourceChannel = reader.string(); + break; + case 3: + message.token = coin_1.Coin.decode(reader, reader.uint32()); + break; + case 4: + message.sender = reader.string(); + break; + case 5: + message.receiver = reader.string(); + break; + case 6: + message.timeoutHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 7: + message.timeoutTimestamp = reader.uint64(); + break; + case 8: + message.memo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + sourcePort: (0, helpers_1.isSet)(object.sourcePort) ? String(object.sourcePort) : "", + sourceChannel: (0, helpers_1.isSet)(object.sourceChannel) ? String(object.sourceChannel) : "", + token: (0, helpers_1.isSet)(object.token) ? coin_1.Coin.fromJSON(object.token) : undefined, + sender: (0, helpers_1.isSet)(object.sender) ? String(object.sender) : "", + receiver: (0, helpers_1.isSet)(object.receiver) ? String(object.receiver) : "", + timeoutHeight: (0, helpers_1.isSet)(object.timeoutHeight) ? client_1.Height.fromJSON(object.timeoutHeight) : undefined, + timeoutTimestamp: (0, helpers_1.isSet)(object.timeoutTimestamp) ? helpers_1.Long.fromValue(object.timeoutTimestamp) : helpers_1.Long.UZERO, + memo: (0, helpers_1.isSet)(object.memo) ? String(object.memo) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.sourcePort !== undefined && (obj.sourcePort = message.sourcePort); + message.sourceChannel !== undefined && (obj.sourceChannel = message.sourceChannel); + message.token !== undefined && (obj.token = message.token ? coin_1.Coin.toJSON(message.token) : undefined); + message.sender !== undefined && (obj.sender = message.sender); + message.receiver !== undefined && (obj.receiver = message.receiver); + message.timeoutHeight !== undefined && + (obj.timeoutHeight = message.timeoutHeight ? client_1.Height.toJSON(message.timeoutHeight) : undefined); + message.timeoutTimestamp !== undefined && + (obj.timeoutTimestamp = (message.timeoutTimestamp || helpers_1.Long.UZERO).toString()); + message.memo !== undefined && (obj.memo = message.memo); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgTransfer(); + message.sourcePort = object.sourcePort ?? ""; + message.sourceChannel = object.sourceChannel ?? ""; + message.token = + object.token !== undefined && object.token !== null ? coin_1.Coin.fromPartial(object.token) : undefined; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + message.timeoutHeight = + object.timeoutHeight !== undefined && object.timeoutHeight !== null + ? client_1.Height.fromPartial(object.timeoutHeight) + : undefined; + message.timeoutTimestamp = + object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null + ? helpers_1.Long.fromValue(object.timeoutTimestamp) + : helpers_1.Long.UZERO; + message.memo = object.memo ?? ""; + return message; + }, +}; +function createBaseMsgTransferResponse() { + return { + sequence: helpers_1.Long.UZERO, + }; +} +exports.MsgTransferResponse = { + encode(message, writer = _m0.Writer.create()) { + if (!message.sequence.isZero()) { + writer.uint32(8).uint64(message.sequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTransferResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + sequence: (0, helpers_1.isSet)(object.sequence) ? helpers_1.Long.fromValue(object.sequence) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.sequence !== undefined && (obj.sequence = (message.sequence || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgTransferResponse(); + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? helpers_1.Long.fromValue(object.sequence) + : helpers_1.Long.UZERO; + return message; + }, +}; +class MsgClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Transfer = this.Transfer.bind(this); + } + Transfer(request) { + const data = exports.MsgTransfer.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Msg", "Transfer", data); + return promise.then((data) => exports.MsgTransferResponse.decode(new _m0.Reader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +//# sourceMappingURL=tx.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/core/channel/v1/channel.js": +/*!******************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/core/channel/v1/channel.js ***! + \******************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Acknowledgement = exports.PacketId = exports.PacketState = exports.Packet = exports.Counterparty = exports.IdentifiedChannel = exports.Channel = exports.orderToJSON = exports.orderFromJSON = exports.Order = exports.stateToJSON = exports.stateFromJSON = exports.State = exports.protobufPackage = void 0; +/* eslint-disable */ +const client_1 = __webpack_require__(/*! ../../client/v1/client */ "./node_modules/cosmjs-types/ibc/core/client/v1/client.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "ibc.core.channel.v1"; +/** + * State defines if a channel is in one of the following states: + * CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + */ +var State; +(function (State) { + /** STATE_UNINITIALIZED_UNSPECIFIED - Default State */ + State[State["STATE_UNINITIALIZED_UNSPECIFIED"] = 0] = "STATE_UNINITIALIZED_UNSPECIFIED"; + /** STATE_INIT - A channel has just started the opening handshake. */ + State[State["STATE_INIT"] = 1] = "STATE_INIT"; + /** STATE_TRYOPEN - A channel has acknowledged the handshake step on the counterparty chain. */ + State[State["STATE_TRYOPEN"] = 2] = "STATE_TRYOPEN"; + /** + * STATE_OPEN - A channel has completed the handshake. Open channels are + * ready to send and receive packets. + */ + State[State["STATE_OPEN"] = 3] = "STATE_OPEN"; + /** + * STATE_CLOSED - A channel has been closed and can no longer be used to send or receive + * packets. + */ + State[State["STATE_CLOSED"] = 4] = "STATE_CLOSED"; + State[State["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(State = exports.State || (exports.State = {})); +function stateFromJSON(object) { + switch (object) { + case 0: + case "STATE_UNINITIALIZED_UNSPECIFIED": + return State.STATE_UNINITIALIZED_UNSPECIFIED; + case 1: + case "STATE_INIT": + return State.STATE_INIT; + case 2: + case "STATE_TRYOPEN": + return State.STATE_TRYOPEN; + case 3: + case "STATE_OPEN": + return State.STATE_OPEN; + case 4: + case "STATE_CLOSED": + return State.STATE_CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return State.UNRECOGNIZED; + } +} +exports.stateFromJSON = stateFromJSON; +function stateToJSON(object) { + switch (object) { + case State.STATE_UNINITIALIZED_UNSPECIFIED: + return "STATE_UNINITIALIZED_UNSPECIFIED"; + case State.STATE_INIT: + return "STATE_INIT"; + case State.STATE_TRYOPEN: + return "STATE_TRYOPEN"; + case State.STATE_OPEN: + return "STATE_OPEN"; + case State.STATE_CLOSED: + return "STATE_CLOSED"; + case State.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.stateToJSON = stateToJSON; +/** Order defines if a channel is ORDERED or UNORDERED */ +var Order; +(function (Order) { + /** ORDER_NONE_UNSPECIFIED - zero-value for channel ordering */ + Order[Order["ORDER_NONE_UNSPECIFIED"] = 0] = "ORDER_NONE_UNSPECIFIED"; + /** + * ORDER_UNORDERED - packets can be delivered in any order, which may differ from the order in + * which they were sent. + */ + Order[Order["ORDER_UNORDERED"] = 1] = "ORDER_UNORDERED"; + /** ORDER_ORDERED - packets are delivered exactly in the order which they were sent */ + Order[Order["ORDER_ORDERED"] = 2] = "ORDER_ORDERED"; + Order[Order["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(Order = exports.Order || (exports.Order = {})); +function orderFromJSON(object) { + switch (object) { + case 0: + case "ORDER_NONE_UNSPECIFIED": + return Order.ORDER_NONE_UNSPECIFIED; + case 1: + case "ORDER_UNORDERED": + return Order.ORDER_UNORDERED; + case 2: + case "ORDER_ORDERED": + return Order.ORDER_ORDERED; + case -1: + case "UNRECOGNIZED": + default: + return Order.UNRECOGNIZED; + } +} +exports.orderFromJSON = orderFromJSON; +function orderToJSON(object) { + switch (object) { + case Order.ORDER_NONE_UNSPECIFIED: + return "ORDER_NONE_UNSPECIFIED"; + case Order.ORDER_UNORDERED: + return "ORDER_UNORDERED"; + case Order.ORDER_ORDERED: + return "ORDER_ORDERED"; + case Order.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.orderToJSON = orderToJSON; +function createBaseChannel() { + return { + state: 0, + ordering: 0, + counterparty: undefined, + connectionHops: [], + version: "", + }; +} +exports.Channel = { + encode(message, writer = _m0.Writer.create()) { + if (message.state !== 0) { + writer.uint32(8).int32(message.state); + } + if (message.ordering !== 0) { + writer.uint32(16).int32(message.ordering); + } + if (message.counterparty !== undefined) { + exports.Counterparty.encode(message.counterparty, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.connectionHops) { + writer.uint32(34).string(v); + } + if (message.version !== "") { + writer.uint32(42).string(message.version); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChannel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.ordering = reader.int32(); + break; + case 3: + message.counterparty = exports.Counterparty.decode(reader, reader.uint32()); + break; + case 4: + message.connectionHops.push(reader.string()); + break; + case 5: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + state: (0, helpers_1.isSet)(object.state) ? stateFromJSON(object.state) : 0, + ordering: (0, helpers_1.isSet)(object.ordering) ? orderFromJSON(object.ordering) : 0, + counterparty: (0, helpers_1.isSet)(object.counterparty) ? exports.Counterparty.fromJSON(object.counterparty) : undefined, + connectionHops: Array.isArray(object?.connectionHops) + ? object.connectionHops.map((e) => String(e)) + : [], + version: (0, helpers_1.isSet)(object.version) ? String(object.version) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.state !== undefined && (obj.state = stateToJSON(message.state)); + message.ordering !== undefined && (obj.ordering = orderToJSON(message.ordering)); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty ? exports.Counterparty.toJSON(message.counterparty) : undefined); + if (message.connectionHops) { + obj.connectionHops = message.connectionHops.map((e) => e); + } + else { + obj.connectionHops = []; + } + message.version !== undefined && (obj.version = message.version); + return obj; + }, + fromPartial(object) { + const message = createBaseChannel(); + message.state = object.state ?? 0; + message.ordering = object.ordering ?? 0; + message.counterparty = + object.counterparty !== undefined && object.counterparty !== null + ? exports.Counterparty.fromPartial(object.counterparty) + : undefined; + message.connectionHops = object.connectionHops?.map((e) => e) || []; + message.version = object.version ?? ""; + return message; + }, +}; +function createBaseIdentifiedChannel() { + return { + state: 0, + ordering: 0, + counterparty: undefined, + connectionHops: [], + version: "", + portId: "", + channelId: "", + }; +} +exports.IdentifiedChannel = { + encode(message, writer = _m0.Writer.create()) { + if (message.state !== 0) { + writer.uint32(8).int32(message.state); + } + if (message.ordering !== 0) { + writer.uint32(16).int32(message.ordering); + } + if (message.counterparty !== undefined) { + exports.Counterparty.encode(message.counterparty, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.connectionHops) { + writer.uint32(34).string(v); + } + if (message.version !== "") { + writer.uint32(42).string(message.version); + } + if (message.portId !== "") { + writer.uint32(50).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(58).string(message.channelId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentifiedChannel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.ordering = reader.int32(); + break; + case 3: + message.counterparty = exports.Counterparty.decode(reader, reader.uint32()); + break; + case 4: + message.connectionHops.push(reader.string()); + break; + case 5: + message.version = reader.string(); + break; + case 6: + message.portId = reader.string(); + break; + case 7: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + state: (0, helpers_1.isSet)(object.state) ? stateFromJSON(object.state) : 0, + ordering: (0, helpers_1.isSet)(object.ordering) ? orderFromJSON(object.ordering) : 0, + counterparty: (0, helpers_1.isSet)(object.counterparty) ? exports.Counterparty.fromJSON(object.counterparty) : undefined, + connectionHops: Array.isArray(object?.connectionHops) + ? object.connectionHops.map((e) => String(e)) + : [], + version: (0, helpers_1.isSet)(object.version) ? String(object.version) : "", + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.state !== undefined && (obj.state = stateToJSON(message.state)); + message.ordering !== undefined && (obj.ordering = orderToJSON(message.ordering)); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty ? exports.Counterparty.toJSON(message.counterparty) : undefined); + if (message.connectionHops) { + obj.connectionHops = message.connectionHops.map((e) => e); + } + else { + obj.connectionHops = []; + } + message.version !== undefined && (obj.version = message.version); + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object) { + const message = createBaseIdentifiedChannel(); + message.state = object.state ?? 0; + message.ordering = object.ordering ?? 0; + message.counterparty = + object.counterparty !== undefined && object.counterparty !== null + ? exports.Counterparty.fromPartial(object.counterparty) + : undefined; + message.connectionHops = object.connectionHops?.map((e) => e) || []; + message.version = object.version ?? ""; + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; +function createBaseCounterparty() { + return { + portId: "", + channelId: "", + }; +} +exports.Counterparty = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterparty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object) { + const message = createBaseCounterparty(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; +function createBasePacket() { + return { + sequence: helpers_1.Long.UZERO, + sourcePort: "", + sourceChannel: "", + destinationPort: "", + destinationChannel: "", + data: new Uint8Array(), + timeoutHeight: undefined, + timeoutTimestamp: helpers_1.Long.UZERO, + }; +} +exports.Packet = { + encode(message, writer = _m0.Writer.create()) { + if (!message.sequence.isZero()) { + writer.uint32(8).uint64(message.sequence); + } + if (message.sourcePort !== "") { + writer.uint32(18).string(message.sourcePort); + } + if (message.sourceChannel !== "") { + writer.uint32(26).string(message.sourceChannel); + } + if (message.destinationPort !== "") { + writer.uint32(34).string(message.destinationPort); + } + if (message.destinationChannel !== "") { + writer.uint32(42).string(message.destinationChannel); + } + if (message.data.length !== 0) { + writer.uint32(50).bytes(message.data); + } + if (message.timeoutHeight !== undefined) { + client_1.Height.encode(message.timeoutHeight, writer.uint32(58).fork()).ldelim(); + } + if (!message.timeoutTimestamp.isZero()) { + writer.uint32(64).uint64(message.timeoutTimestamp); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacket(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.sourcePort = reader.string(); + break; + case 3: + message.sourceChannel = reader.string(); + break; + case 4: + message.destinationPort = reader.string(); + break; + case 5: + message.destinationChannel = reader.string(); + break; + case 6: + message.data = reader.bytes(); + break; + case 7: + message.timeoutHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 8: + message.timeoutTimestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + sequence: (0, helpers_1.isSet)(object.sequence) ? helpers_1.Long.fromValue(object.sequence) : helpers_1.Long.UZERO, + sourcePort: (0, helpers_1.isSet)(object.sourcePort) ? String(object.sourcePort) : "", + sourceChannel: (0, helpers_1.isSet)(object.sourceChannel) ? String(object.sourceChannel) : "", + destinationPort: (0, helpers_1.isSet)(object.destinationPort) ? String(object.destinationPort) : "", + destinationChannel: (0, helpers_1.isSet)(object.destinationChannel) ? String(object.destinationChannel) : "", + data: (0, helpers_1.isSet)(object.data) ? (0, helpers_1.bytesFromBase64)(object.data) : new Uint8Array(), + timeoutHeight: (0, helpers_1.isSet)(object.timeoutHeight) ? client_1.Height.fromJSON(object.timeoutHeight) : undefined, + timeoutTimestamp: (0, helpers_1.isSet)(object.timeoutTimestamp) ? helpers_1.Long.fromValue(object.timeoutTimestamp) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.sequence !== undefined && (obj.sequence = (message.sequence || helpers_1.Long.UZERO).toString()); + message.sourcePort !== undefined && (obj.sourcePort = message.sourcePort); + message.sourceChannel !== undefined && (obj.sourceChannel = message.sourceChannel); + message.destinationPort !== undefined && (obj.destinationPort = message.destinationPort); + message.destinationChannel !== undefined && (obj.destinationChannel = message.destinationChannel); + message.data !== undefined && + (obj.data = (0, helpers_1.base64FromBytes)(message.data !== undefined ? message.data : new Uint8Array())); + message.timeoutHeight !== undefined && + (obj.timeoutHeight = message.timeoutHeight ? client_1.Height.toJSON(message.timeoutHeight) : undefined); + message.timeoutTimestamp !== undefined && + (obj.timeoutTimestamp = (message.timeoutTimestamp || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBasePacket(); + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? helpers_1.Long.fromValue(object.sequence) + : helpers_1.Long.UZERO; + message.sourcePort = object.sourcePort ?? ""; + message.sourceChannel = object.sourceChannel ?? ""; + message.destinationPort = object.destinationPort ?? ""; + message.destinationChannel = object.destinationChannel ?? ""; + message.data = object.data ?? new Uint8Array(); + message.timeoutHeight = + object.timeoutHeight !== undefined && object.timeoutHeight !== null + ? client_1.Height.fromPartial(object.timeoutHeight) + : undefined; + message.timeoutTimestamp = + object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null + ? helpers_1.Long.fromValue(object.timeoutTimestamp) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBasePacketState() { + return { + portId: "", + channelId: "", + sequence: helpers_1.Long.UZERO, + data: new Uint8Array(), + }; +} +exports.PacketState = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } + if (message.data.length !== 0) { + writer.uint32(34).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + case 4: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + sequence: (0, helpers_1.isSet)(object.sequence) ? helpers_1.Long.fromValue(object.sequence) : helpers_1.Long.UZERO, + data: (0, helpers_1.isSet)(object.data) ? (0, helpers_1.bytesFromBase64)(object.data) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && (obj.sequence = (message.sequence || helpers_1.Long.UZERO).toString()); + message.data !== undefined && + (obj.data = (0, helpers_1.base64FromBytes)(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBasePacketState(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? helpers_1.Long.fromValue(object.sequence) + : helpers_1.Long.UZERO; + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; +function createBasePacketId() { + return { + portId: "", + channelId: "", + sequence: helpers_1.Long.UZERO, + }; +} +exports.PacketId = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + sequence: (0, helpers_1.isSet)(object.sequence) ? helpers_1.Long.fromValue(object.sequence) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && (obj.sequence = (message.sequence || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBasePacketId(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? helpers_1.Long.fromValue(object.sequence) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseAcknowledgement() { + return { + result: undefined, + error: undefined, + }; +} +exports.Acknowledgement = { + encode(message, writer = _m0.Writer.create()) { + if (message.result !== undefined) { + writer.uint32(170).bytes(message.result); + } + if (message.error !== undefined) { + writer.uint32(178).string(message.error); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAcknowledgement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 21: + message.result = reader.bytes(); + break; + case 22: + message.error = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + result: (0, helpers_1.isSet)(object.result) ? (0, helpers_1.bytesFromBase64)(object.result) : undefined, + error: (0, helpers_1.isSet)(object.error) ? String(object.error) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.result !== undefined && + (obj.result = message.result !== undefined ? (0, helpers_1.base64FromBytes)(message.result) : undefined); + message.error !== undefined && (obj.error = message.error); + return obj; + }, + fromPartial(object) { + const message = createBaseAcknowledgement(); + message.result = object.result ?? undefined; + message.error = object.error ?? undefined; + return message; + }, +}; +//# sourceMappingURL=channel.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/core/channel/v1/query.js": +/*!****************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/core/channel/v1/query.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QueryNextSequenceReceiveResponse = exports.QueryNextSequenceReceiveRequest = exports.QueryUnreceivedAcksResponse = exports.QueryUnreceivedAcksRequest = exports.QueryUnreceivedPacketsResponse = exports.QueryUnreceivedPacketsRequest = exports.QueryPacketAcknowledgementsResponse = exports.QueryPacketAcknowledgementsRequest = exports.QueryPacketAcknowledgementResponse = exports.QueryPacketAcknowledgementRequest = exports.QueryPacketReceiptResponse = exports.QueryPacketReceiptRequest = exports.QueryPacketCommitmentsResponse = exports.QueryPacketCommitmentsRequest = exports.QueryPacketCommitmentResponse = exports.QueryPacketCommitmentRequest = exports.QueryChannelConsensusStateResponse = exports.QueryChannelConsensusStateRequest = exports.QueryChannelClientStateResponse = exports.QueryChannelClientStateRequest = exports.QueryConnectionChannelsResponse = exports.QueryConnectionChannelsRequest = exports.QueryChannelsResponse = exports.QueryChannelsRequest = exports.QueryChannelResponse = exports.QueryChannelRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const pagination_1 = __webpack_require__(/*! ../../../../cosmos/base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const channel_1 = __webpack_require__(/*! ./channel */ "./node_modules/cosmjs-types/ibc/core/channel/v1/channel.js"); +const client_1 = __webpack_require__(/*! ../../client/v1/client */ "./node_modules/cosmjs-types/ibc/core/client/v1/client.js"); +const any_1 = __webpack_require__(/*! ../../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "ibc.core.channel.v1"; +function createBaseQueryChannelRequest() { + return { + portId: "", + channelId: "", + }; +} +exports.QueryChannelRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryChannelRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; +function createBaseQueryChannelResponse() { + return { + channel: undefined, + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryChannelResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.channel !== undefined) { + channel_1.Channel.encode(message.channel, writer.uint32(10).fork()).ldelim(); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channel = channel_1.Channel.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + channel: (0, helpers_1.isSet)(object.channel) ? channel_1.Channel.fromJSON(object.channel) : undefined, + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.channel !== undefined && + (obj.channel = message.channel ? channel_1.Channel.toJSON(message.channel) : undefined); + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryChannelResponse(); + message.channel = + object.channel !== undefined && object.channel !== null + ? channel_1.Channel.fromPartial(object.channel) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +function createBaseQueryChannelsRequest() { + return { + pagination: undefined, + }; +} +exports.QueryChannelsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryChannelsRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryChannelsResponse() { + return { + channels: [], + pagination: undefined, + height: undefined, + }; +} +exports.QueryChannelsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.channels) { + channel_1.IdentifiedChannel.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== undefined) { + client_1.Height.encode(message.height, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channels.push(channel_1.IdentifiedChannel.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + channels: Array.isArray(object?.channels) + ? object.channels.map((e) => channel_1.IdentifiedChannel.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + height: (0, helpers_1.isSet)(object.height) ? client_1.Height.fromJSON(object.height) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.channels) { + obj.channels = message.channels.map((e) => (e ? channel_1.IdentifiedChannel.toJSON(e) : undefined)); + } + else { + obj.channels = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + message.height !== undefined && (obj.height = message.height ? client_1.Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryChannelsResponse(); + message.channels = object.channels?.map((e) => channel_1.IdentifiedChannel.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.height = + object.height !== undefined && object.height !== null ? client_1.Height.fromPartial(object.height) : undefined; + return message; + }, +}; +function createBaseQueryConnectionChannelsRequest() { + return { + connection: "", + pagination: undefined, + }; +} +exports.QueryConnectionChannelsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.connection !== "") { + writer.uint32(10).string(message.connection); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionChannelsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + connection: (0, helpers_1.isSet)(object.connection) ? String(object.connection) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.connection !== undefined && (obj.connection = message.connection); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConnectionChannelsRequest(); + message.connection = object.connection ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryConnectionChannelsResponse() { + return { + channels: [], + pagination: undefined, + height: undefined, + }; +} +exports.QueryConnectionChannelsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.channels) { + channel_1.IdentifiedChannel.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== undefined) { + client_1.Height.encode(message.height, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionChannelsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channels.push(channel_1.IdentifiedChannel.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + channels: Array.isArray(object?.channels) + ? object.channels.map((e) => channel_1.IdentifiedChannel.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + height: (0, helpers_1.isSet)(object.height) ? client_1.Height.fromJSON(object.height) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.channels) { + obj.channels = message.channels.map((e) => (e ? channel_1.IdentifiedChannel.toJSON(e) : undefined)); + } + else { + obj.channels = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + message.height !== undefined && (obj.height = message.height ? client_1.Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConnectionChannelsResponse(); + message.channels = object.channels?.map((e) => channel_1.IdentifiedChannel.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.height = + object.height !== undefined && object.height !== null ? client_1.Height.fromPartial(object.height) : undefined; + return message; + }, +}; +function createBaseQueryChannelClientStateRequest() { + return { + portId: "", + channelId: "", + }; +} +exports.QueryChannelClientStateRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelClientStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryChannelClientStateRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; +function createBaseQueryChannelClientStateResponse() { + return { + identifiedClientState: undefined, + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryChannelClientStateResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.identifiedClientState !== undefined) { + client_1.IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim(); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelClientStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifiedClientState = client_1.IdentifiedClientState.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + identifiedClientState: (0, helpers_1.isSet)(object.identifiedClientState) + ? client_1.IdentifiedClientState.fromJSON(object.identifiedClientState) + : undefined, + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.identifiedClientState !== undefined && + (obj.identifiedClientState = message.identifiedClientState + ? client_1.IdentifiedClientState.toJSON(message.identifiedClientState) + : undefined); + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryChannelClientStateResponse(); + message.identifiedClientState = + object.identifiedClientState !== undefined && object.identifiedClientState !== null + ? client_1.IdentifiedClientState.fromPartial(object.identifiedClientState) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +function createBaseQueryChannelConsensusStateRequest() { + return { + portId: "", + channelId: "", + revisionNumber: helpers_1.Long.UZERO, + revisionHeight: helpers_1.Long.UZERO, + }; +} +exports.QueryChannelConsensusStateRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (!message.revisionNumber.isZero()) { + writer.uint32(24).uint64(message.revisionNumber); + } + if (!message.revisionHeight.isZero()) { + writer.uint32(32).uint64(message.revisionHeight); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.revisionNumber = reader.uint64(); + break; + case 4: + message.revisionHeight = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + revisionNumber: (0, helpers_1.isSet)(object.revisionNumber) ? helpers_1.Long.fromValue(object.revisionNumber) : helpers_1.Long.UZERO, + revisionHeight: (0, helpers_1.isSet)(object.revisionHeight) ? helpers_1.Long.fromValue(object.revisionHeight) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.revisionNumber !== undefined && + (obj.revisionNumber = (message.revisionNumber || helpers_1.Long.UZERO).toString()); + message.revisionHeight !== undefined && + (obj.revisionHeight = (message.revisionHeight || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryChannelConsensusStateRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.revisionNumber = + object.revisionNumber !== undefined && object.revisionNumber !== null + ? helpers_1.Long.fromValue(object.revisionNumber) + : helpers_1.Long.UZERO; + message.revisionHeight = + object.revisionHeight !== undefined && object.revisionHeight !== null + ? helpers_1.Long.fromValue(object.revisionHeight) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseQueryChannelConsensusStateResponse() { + return { + consensusState: undefined, + clientId: "", + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryChannelConsensusStateResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.consensusState !== undefined) { + any_1.Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); + } + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + if (message.proof.length !== 0) { + writer.uint32(26).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusState = any_1.Any.decode(reader, reader.uint32()); + break; + case 2: + message.clientId = reader.string(); + break; + case 3: + message.proof = reader.bytes(); + break; + case 4: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + consensusState: (0, helpers_1.isSet)(object.consensusState) ? any_1.Any.fromJSON(object.consensusState) : undefined, + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.consensusState !== undefined && + (obj.consensusState = message.consensusState ? any_1.Any.toJSON(message.consensusState) : undefined); + message.clientId !== undefined && (obj.clientId = message.clientId); + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryChannelConsensusStateResponse(); + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? any_1.Any.fromPartial(object.consensusState) + : undefined; + message.clientId = object.clientId ?? ""; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +function createBaseQueryPacketCommitmentRequest() { + return { + portId: "", + channelId: "", + sequence: helpers_1.Long.UZERO, + }; +} +exports.QueryPacketCommitmentRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketCommitmentRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + sequence: (0, helpers_1.isSet)(object.sequence) ? helpers_1.Long.fromValue(object.sequence) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && (obj.sequence = (message.sequence || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryPacketCommitmentRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? helpers_1.Long.fromValue(object.sequence) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseQueryPacketCommitmentResponse() { + return { + commitment: new Uint8Array(), + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryPacketCommitmentResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.commitment.length !== 0) { + writer.uint32(10).bytes(message.commitment); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketCommitmentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commitment = reader.bytes(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + commitment: (0, helpers_1.isSet)(object.commitment) ? (0, helpers_1.bytesFromBase64)(object.commitment) : new Uint8Array(), + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.commitment !== undefined && + (obj.commitment = (0, helpers_1.base64FromBytes)(message.commitment !== undefined ? message.commitment : new Uint8Array())); + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryPacketCommitmentResponse(); + message.commitment = object.commitment ?? new Uint8Array(); + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +function createBaseQueryPacketCommitmentsRequest() { + return { + portId: "", + channelId: "", + pagination: undefined, + }; +} +exports.QueryPacketCommitmentsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryPacketCommitmentsRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryPacketCommitmentsResponse() { + return { + commitments: [], + pagination: undefined, + height: undefined, + }; +} +exports.QueryPacketCommitmentsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.commitments) { + channel_1.PacketState.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== undefined) { + client_1.Height.encode(message.height, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commitments.push(channel_1.PacketState.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + commitments: Array.isArray(object?.commitments) + ? object.commitments.map((e) => channel_1.PacketState.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + height: (0, helpers_1.isSet)(object.height) ? client_1.Height.fromJSON(object.height) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.commitments) { + obj.commitments = message.commitments.map((e) => (e ? channel_1.PacketState.toJSON(e) : undefined)); + } + else { + obj.commitments = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + message.height !== undefined && (obj.height = message.height ? client_1.Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryPacketCommitmentsResponse(); + message.commitments = object.commitments?.map((e) => channel_1.PacketState.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.height = + object.height !== undefined && object.height !== null ? client_1.Height.fromPartial(object.height) : undefined; + return message; + }, +}; +function createBaseQueryPacketReceiptRequest() { + return { + portId: "", + channelId: "", + sequence: helpers_1.Long.UZERO, + }; +} +exports.QueryPacketReceiptRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketReceiptRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + sequence: (0, helpers_1.isSet)(object.sequence) ? helpers_1.Long.fromValue(object.sequence) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && (obj.sequence = (message.sequence || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryPacketReceiptRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? helpers_1.Long.fromValue(object.sequence) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseQueryPacketReceiptResponse() { + return { + received: false, + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryPacketReceiptResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.received === true) { + writer.uint32(16).bool(message.received); + } + if (message.proof.length !== 0) { + writer.uint32(26).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketReceiptResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.received = reader.bool(); + break; + case 3: + message.proof = reader.bytes(); + break; + case 4: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + received: (0, helpers_1.isSet)(object.received) ? Boolean(object.received) : false, + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.received !== undefined && (obj.received = message.received); + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryPacketReceiptResponse(); + message.received = object.received ?? false; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +function createBaseQueryPacketAcknowledgementRequest() { + return { + portId: "", + channelId: "", + sequence: helpers_1.Long.UZERO, + }; +} +exports.QueryPacketAcknowledgementRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketAcknowledgementRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + sequence: (0, helpers_1.isSet)(object.sequence) ? helpers_1.Long.fromValue(object.sequence) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && (obj.sequence = (message.sequence || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryPacketAcknowledgementRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? helpers_1.Long.fromValue(object.sequence) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseQueryPacketAcknowledgementResponse() { + return { + acknowledgement: new Uint8Array(), + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryPacketAcknowledgementResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.acknowledgement.length !== 0) { + writer.uint32(10).bytes(message.acknowledgement); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketAcknowledgementResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.acknowledgement = reader.bytes(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + acknowledgement: (0, helpers_1.isSet)(object.acknowledgement) + ? (0, helpers_1.bytesFromBase64)(object.acknowledgement) + : new Uint8Array(), + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.acknowledgement !== undefined && + (obj.acknowledgement = (0, helpers_1.base64FromBytes)(message.acknowledgement !== undefined ? message.acknowledgement : new Uint8Array())); + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryPacketAcknowledgementResponse(); + message.acknowledgement = object.acknowledgement ?? new Uint8Array(); + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +function createBaseQueryPacketAcknowledgementsRequest() { + return { + portId: "", + channelId: "", + pagination: undefined, + packetCommitmentSequences: [], + }; +} +exports.QueryPacketAcknowledgementsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + writer.uint32(34).fork(); + for (const v of message.packetCommitmentSequences) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketAcknowledgementsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + case 4: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.packetCommitmentSequences.push(reader.uint64()); + } + } + else { + message.packetCommitmentSequences.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + packetCommitmentSequences: Array.isArray(object?.packetCommitmentSequences) + ? object.packetCommitmentSequences.map((e) => helpers_1.Long.fromValue(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + if (message.packetCommitmentSequences) { + obj.packetCommitmentSequences = message.packetCommitmentSequences.map((e) => (e || helpers_1.Long.UZERO).toString()); + } + else { + obj.packetCommitmentSequences = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseQueryPacketAcknowledgementsRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + message.packetCommitmentSequences = object.packetCommitmentSequences?.map((e) => helpers_1.Long.fromValue(e)) || []; + return message; + }, +}; +function createBaseQueryPacketAcknowledgementsResponse() { + return { + acknowledgements: [], + pagination: undefined, + height: undefined, + }; +} +exports.QueryPacketAcknowledgementsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.acknowledgements) { + channel_1.PacketState.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== undefined) { + client_1.Height.encode(message.height, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketAcknowledgementsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.acknowledgements.push(channel_1.PacketState.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + acknowledgements: Array.isArray(object?.acknowledgements) + ? object.acknowledgements.map((e) => channel_1.PacketState.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + height: (0, helpers_1.isSet)(object.height) ? client_1.Height.fromJSON(object.height) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.acknowledgements) { + obj.acknowledgements = message.acknowledgements.map((e) => (e ? channel_1.PacketState.toJSON(e) : undefined)); + } + else { + obj.acknowledgements = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + message.height !== undefined && (obj.height = message.height ? client_1.Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryPacketAcknowledgementsResponse(); + message.acknowledgements = object.acknowledgements?.map((e) => channel_1.PacketState.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.height = + object.height !== undefined && object.height !== null ? client_1.Height.fromPartial(object.height) : undefined; + return message; + }, +}; +function createBaseQueryUnreceivedPacketsRequest() { + return { + portId: "", + channelId: "", + packetCommitmentSequences: [], + }; +} +exports.QueryUnreceivedPacketsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + writer.uint32(26).fork(); + for (const v of message.packetCommitmentSequences) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnreceivedPacketsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.packetCommitmentSequences.push(reader.uint64()); + } + } + else { + message.packetCommitmentSequences.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + packetCommitmentSequences: Array.isArray(object?.packetCommitmentSequences) + ? object.packetCommitmentSequences.map((e) => helpers_1.Long.fromValue(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + if (message.packetCommitmentSequences) { + obj.packetCommitmentSequences = message.packetCommitmentSequences.map((e) => (e || helpers_1.Long.UZERO).toString()); + } + else { + obj.packetCommitmentSequences = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseQueryUnreceivedPacketsRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.packetCommitmentSequences = object.packetCommitmentSequences?.map((e) => helpers_1.Long.fromValue(e)) || []; + return message; + }, +}; +function createBaseQueryUnreceivedPacketsResponse() { + return { + sequences: [], + height: undefined, + }; +} +exports.QueryUnreceivedPacketsResponse = { + encode(message, writer = _m0.Writer.create()) { + writer.uint32(10).fork(); + for (const v of message.sequences) { + writer.uint64(v); + } + writer.ldelim(); + if (message.height !== undefined) { + client_1.Height.encode(message.height, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnreceivedPacketsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.sequences.push(reader.uint64()); + } + } + else { + message.sequences.push(reader.uint64()); + } + break; + case 2: + message.height = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + sequences: Array.isArray(object?.sequences) ? object.sequences.map((e) => helpers_1.Long.fromValue(e)) : [], + height: (0, helpers_1.isSet)(object.height) ? client_1.Height.fromJSON(object.height) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sequences) { + obj.sequences = message.sequences.map((e) => (e || helpers_1.Long.UZERO).toString()); + } + else { + obj.sequences = []; + } + message.height !== undefined && (obj.height = message.height ? client_1.Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryUnreceivedPacketsResponse(); + message.sequences = object.sequences?.map((e) => helpers_1.Long.fromValue(e)) || []; + message.height = + object.height !== undefined && object.height !== null ? client_1.Height.fromPartial(object.height) : undefined; + return message; + }, +}; +function createBaseQueryUnreceivedAcksRequest() { + return { + portId: "", + channelId: "", + packetAckSequences: [], + }; +} +exports.QueryUnreceivedAcksRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + writer.uint32(26).fork(); + for (const v of message.packetAckSequences) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnreceivedAcksRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.packetAckSequences.push(reader.uint64()); + } + } + else { + message.packetAckSequences.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + packetAckSequences: Array.isArray(object?.packetAckSequences) + ? object.packetAckSequences.map((e) => helpers_1.Long.fromValue(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + if (message.packetAckSequences) { + obj.packetAckSequences = message.packetAckSequences.map((e) => (e || helpers_1.Long.UZERO).toString()); + } + else { + obj.packetAckSequences = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseQueryUnreceivedAcksRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.packetAckSequences = object.packetAckSequences?.map((e) => helpers_1.Long.fromValue(e)) || []; + return message; + }, +}; +function createBaseQueryUnreceivedAcksResponse() { + return { + sequences: [], + height: undefined, + }; +} +exports.QueryUnreceivedAcksResponse = { + encode(message, writer = _m0.Writer.create()) { + writer.uint32(10).fork(); + for (const v of message.sequences) { + writer.uint64(v); + } + writer.ldelim(); + if (message.height !== undefined) { + client_1.Height.encode(message.height, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnreceivedAcksResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.sequences.push(reader.uint64()); + } + } + else { + message.sequences.push(reader.uint64()); + } + break; + case 2: + message.height = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + sequences: Array.isArray(object?.sequences) ? object.sequences.map((e) => helpers_1.Long.fromValue(e)) : [], + height: (0, helpers_1.isSet)(object.height) ? client_1.Height.fromJSON(object.height) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sequences) { + obj.sequences = message.sequences.map((e) => (e || helpers_1.Long.UZERO).toString()); + } + else { + obj.sequences = []; + } + message.height !== undefined && (obj.height = message.height ? client_1.Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryUnreceivedAcksResponse(); + message.sequences = object.sequences?.map((e) => helpers_1.Long.fromValue(e)) || []; + message.height = + object.height !== undefined && object.height !== null ? client_1.Height.fromPartial(object.height) : undefined; + return message; + }, +}; +function createBaseQueryNextSequenceReceiveRequest() { + return { + portId: "", + channelId: "", + }; +} +exports.QueryNextSequenceReceiveRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNextSequenceReceiveRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryNextSequenceReceiveRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; +function createBaseQueryNextSequenceReceiveResponse() { + return { + nextSequenceReceive: helpers_1.Long.UZERO, + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryNextSequenceReceiveResponse = { + encode(message, writer = _m0.Writer.create()) { + if (!message.nextSequenceReceive.isZero()) { + writer.uint32(8).uint64(message.nextSequenceReceive); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNextSequenceReceiveResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nextSequenceReceive = reader.uint64(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + nextSequenceReceive: (0, helpers_1.isSet)(object.nextSequenceReceive) + ? helpers_1.Long.fromValue(object.nextSequenceReceive) + : helpers_1.Long.UZERO, + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.nextSequenceReceive !== undefined && + (obj.nextSequenceReceive = (message.nextSequenceReceive || helpers_1.Long.UZERO).toString()); + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryNextSequenceReceiveResponse(); + message.nextSequenceReceive = + object.nextSequenceReceive !== undefined && object.nextSequenceReceive !== null + ? helpers_1.Long.fromValue(object.nextSequenceReceive) + : helpers_1.Long.UZERO; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Channel = this.Channel.bind(this); + this.Channels = this.Channels.bind(this); + this.ConnectionChannels = this.ConnectionChannels.bind(this); + this.ChannelClientState = this.ChannelClientState.bind(this); + this.ChannelConsensusState = this.ChannelConsensusState.bind(this); + this.PacketCommitment = this.PacketCommitment.bind(this); + this.PacketCommitments = this.PacketCommitments.bind(this); + this.PacketReceipt = this.PacketReceipt.bind(this); + this.PacketAcknowledgement = this.PacketAcknowledgement.bind(this); + this.PacketAcknowledgements = this.PacketAcknowledgements.bind(this); + this.UnreceivedPackets = this.UnreceivedPackets.bind(this); + this.UnreceivedAcks = this.UnreceivedAcks.bind(this); + this.NextSequenceReceive = this.NextSequenceReceive.bind(this); + } + Channel(request) { + const data = exports.QueryChannelRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "Channel", data); + return promise.then((data) => exports.QueryChannelResponse.decode(new _m0.Reader(data))); + } + Channels(request = { + pagination: undefined, + }) { + const data = exports.QueryChannelsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "Channels", data); + return promise.then((data) => exports.QueryChannelsResponse.decode(new _m0.Reader(data))); + } + ConnectionChannels(request) { + const data = exports.QueryConnectionChannelsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "ConnectionChannels", data); + return promise.then((data) => exports.QueryConnectionChannelsResponse.decode(new _m0.Reader(data))); + } + ChannelClientState(request) { + const data = exports.QueryChannelClientStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "ChannelClientState", data); + return promise.then((data) => exports.QueryChannelClientStateResponse.decode(new _m0.Reader(data))); + } + ChannelConsensusState(request) { + const data = exports.QueryChannelConsensusStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "ChannelConsensusState", data); + return promise.then((data) => exports.QueryChannelConsensusStateResponse.decode(new _m0.Reader(data))); + } + PacketCommitment(request) { + const data = exports.QueryPacketCommitmentRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketCommitment", data); + return promise.then((data) => exports.QueryPacketCommitmentResponse.decode(new _m0.Reader(data))); + } + PacketCommitments(request) { + const data = exports.QueryPacketCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketCommitments", data); + return promise.then((data) => exports.QueryPacketCommitmentsResponse.decode(new _m0.Reader(data))); + } + PacketReceipt(request) { + const data = exports.QueryPacketReceiptRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketReceipt", data); + return promise.then((data) => exports.QueryPacketReceiptResponse.decode(new _m0.Reader(data))); + } + PacketAcknowledgement(request) { + const data = exports.QueryPacketAcknowledgementRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketAcknowledgement", data); + return promise.then((data) => exports.QueryPacketAcknowledgementResponse.decode(new _m0.Reader(data))); + } + PacketAcknowledgements(request) { + const data = exports.QueryPacketAcknowledgementsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketAcknowledgements", data); + return promise.then((data) => exports.QueryPacketAcknowledgementsResponse.decode(new _m0.Reader(data))); + } + UnreceivedPackets(request) { + const data = exports.QueryUnreceivedPacketsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "UnreceivedPackets", data); + return promise.then((data) => exports.QueryUnreceivedPacketsResponse.decode(new _m0.Reader(data))); + } + UnreceivedAcks(request) { + const data = exports.QueryUnreceivedAcksRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "UnreceivedAcks", data); + return promise.then((data) => exports.QueryUnreceivedAcksResponse.decode(new _m0.Reader(data))); + } + NextSequenceReceive(request) { + const data = exports.QueryNextSequenceReceiveRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "NextSequenceReceive", data); + return promise.then((data) => exports.QueryNextSequenceReceiveResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/core/channel/v1/tx.js": +/*!*************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/core/channel/v1/tx.js ***! + \*************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MsgClientImpl = exports.MsgAcknowledgementResponse = exports.MsgAcknowledgement = exports.MsgTimeoutOnCloseResponse = exports.MsgTimeoutOnClose = exports.MsgTimeoutResponse = exports.MsgTimeout = exports.MsgRecvPacketResponse = exports.MsgRecvPacket = exports.MsgChannelCloseConfirmResponse = exports.MsgChannelCloseConfirm = exports.MsgChannelCloseInitResponse = exports.MsgChannelCloseInit = exports.MsgChannelOpenConfirmResponse = exports.MsgChannelOpenConfirm = exports.MsgChannelOpenAckResponse = exports.MsgChannelOpenAck = exports.MsgChannelOpenTryResponse = exports.MsgChannelOpenTry = exports.MsgChannelOpenInitResponse = exports.MsgChannelOpenInit = exports.responseResultTypeToJSON = exports.responseResultTypeFromJSON = exports.ResponseResultType = exports.protobufPackage = void 0; +/* eslint-disable */ +const channel_1 = __webpack_require__(/*! ./channel */ "./node_modules/cosmjs-types/ibc/core/channel/v1/channel.js"); +const client_1 = __webpack_require__(/*! ../../client/v1/client */ "./node_modules/cosmjs-types/ibc/core/client/v1/client.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "ibc.core.channel.v1"; +/** ResponseResultType defines the possible outcomes of the execution of a message */ +var ResponseResultType; +(function (ResponseResultType) { + /** RESPONSE_RESULT_TYPE_UNSPECIFIED - Default zero value enumeration */ + ResponseResultType[ResponseResultType["RESPONSE_RESULT_TYPE_UNSPECIFIED"] = 0] = "RESPONSE_RESULT_TYPE_UNSPECIFIED"; + /** RESPONSE_RESULT_TYPE_NOOP - The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) */ + ResponseResultType[ResponseResultType["RESPONSE_RESULT_TYPE_NOOP"] = 1] = "RESPONSE_RESULT_TYPE_NOOP"; + /** RESPONSE_RESULT_TYPE_SUCCESS - The message was executed successfully */ + ResponseResultType[ResponseResultType["RESPONSE_RESULT_TYPE_SUCCESS"] = 2] = "RESPONSE_RESULT_TYPE_SUCCESS"; + ResponseResultType[ResponseResultType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ResponseResultType = exports.ResponseResultType || (exports.ResponseResultType = {})); +function responseResultTypeFromJSON(object) { + switch (object) { + case 0: + case "RESPONSE_RESULT_TYPE_UNSPECIFIED": + return ResponseResultType.RESPONSE_RESULT_TYPE_UNSPECIFIED; + case 1: + case "RESPONSE_RESULT_TYPE_NOOP": + return ResponseResultType.RESPONSE_RESULT_TYPE_NOOP; + case 2: + case "RESPONSE_RESULT_TYPE_SUCCESS": + return ResponseResultType.RESPONSE_RESULT_TYPE_SUCCESS; + case -1: + case "UNRECOGNIZED": + default: + return ResponseResultType.UNRECOGNIZED; + } +} +exports.responseResultTypeFromJSON = responseResultTypeFromJSON; +function responseResultTypeToJSON(object) { + switch (object) { + case ResponseResultType.RESPONSE_RESULT_TYPE_UNSPECIFIED: + return "RESPONSE_RESULT_TYPE_UNSPECIFIED"; + case ResponseResultType.RESPONSE_RESULT_TYPE_NOOP: + return "RESPONSE_RESULT_TYPE_NOOP"; + case ResponseResultType.RESPONSE_RESULT_TYPE_SUCCESS: + return "RESPONSE_RESULT_TYPE_SUCCESS"; + case ResponseResultType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.responseResultTypeToJSON = responseResultTypeToJSON; +function createBaseMsgChannelOpenInit() { + return { + portId: "", + channel: undefined, + signer: "", + }; +} +exports.MsgChannelOpenInit = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channel !== undefined) { + channel_1.Channel.encode(message.channel, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenInit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channel = channel_1.Channel.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channel: (0, helpers_1.isSet)(object.channel) ? channel_1.Channel.fromJSON(object.channel) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channel !== undefined && + (obj.channel = message.channel ? channel_1.Channel.toJSON(message.channel) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgChannelOpenInit(); + message.portId = object.portId ?? ""; + message.channel = + object.channel !== undefined && object.channel !== null + ? channel_1.Channel.fromPartial(object.channel) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgChannelOpenInitResponse() { + return { + channelId: "", + version: "", + }; +} +exports.MsgChannelOpenInitResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.channelId !== "") { + writer.uint32(10).string(message.channelId); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channelId = reader.string(); + break; + case 2: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + version: (0, helpers_1.isSet)(object.version) ? String(object.version) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.channelId !== undefined && (obj.channelId = message.channelId); + message.version !== undefined && (obj.version = message.version); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgChannelOpenInitResponse(); + message.channelId = object.channelId ?? ""; + message.version = object.version ?? ""; + return message; + }, +}; +function createBaseMsgChannelOpenTry() { + return { + portId: "", + previousChannelId: "", + channel: undefined, + counterpartyVersion: "", + proofInit: new Uint8Array(), + proofHeight: undefined, + signer: "", + }; +} +exports.MsgChannelOpenTry = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.previousChannelId !== "") { + writer.uint32(18).string(message.previousChannelId); + } + if (message.channel !== undefined) { + channel_1.Channel.encode(message.channel, writer.uint32(26).fork()).ldelim(); + } + if (message.counterpartyVersion !== "") { + writer.uint32(34).string(message.counterpartyVersion); + } + if (message.proofInit.length !== 0) { + writer.uint32(42).bytes(message.proofInit); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(58).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenTry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.previousChannelId = reader.string(); + break; + case 3: + message.channel = channel_1.Channel.decode(reader, reader.uint32()); + break; + case 4: + message.counterpartyVersion = reader.string(); + break; + case 5: + message.proofInit = reader.bytes(); + break; + case 6: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 7: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + previousChannelId: (0, helpers_1.isSet)(object.previousChannelId) ? String(object.previousChannelId) : "", + channel: (0, helpers_1.isSet)(object.channel) ? channel_1.Channel.fromJSON(object.channel) : undefined, + counterpartyVersion: (0, helpers_1.isSet)(object.counterpartyVersion) ? String(object.counterpartyVersion) : "", + proofInit: (0, helpers_1.isSet)(object.proofInit) ? (0, helpers_1.bytesFromBase64)(object.proofInit) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.previousChannelId !== undefined && (obj.previousChannelId = message.previousChannelId); + message.channel !== undefined && + (obj.channel = message.channel ? channel_1.Channel.toJSON(message.channel) : undefined); + message.counterpartyVersion !== undefined && (obj.counterpartyVersion = message.counterpartyVersion); + message.proofInit !== undefined && + (obj.proofInit = (0, helpers_1.base64FromBytes)(message.proofInit !== undefined ? message.proofInit : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgChannelOpenTry(); + message.portId = object.portId ?? ""; + message.previousChannelId = object.previousChannelId ?? ""; + message.channel = + object.channel !== undefined && object.channel !== null + ? channel_1.Channel.fromPartial(object.channel) + : undefined; + message.counterpartyVersion = object.counterpartyVersion ?? ""; + message.proofInit = object.proofInit ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgChannelOpenTryResponse() { + return { + version: "", + }; +} +exports.MsgChannelOpenTryResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenTryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + version: (0, helpers_1.isSet)(object.version) ? String(object.version) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.version !== undefined && (obj.version = message.version); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgChannelOpenTryResponse(); + message.version = object.version ?? ""; + return message; + }, +}; +function createBaseMsgChannelOpenAck() { + return { + portId: "", + channelId: "", + counterpartyChannelId: "", + counterpartyVersion: "", + proofTry: new Uint8Array(), + proofHeight: undefined, + signer: "", + }; +} +exports.MsgChannelOpenAck = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.counterpartyChannelId !== "") { + writer.uint32(26).string(message.counterpartyChannelId); + } + if (message.counterpartyVersion !== "") { + writer.uint32(34).string(message.counterpartyVersion); + } + if (message.proofTry.length !== 0) { + writer.uint32(42).bytes(message.proofTry); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(58).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.counterpartyChannelId = reader.string(); + break; + case 4: + message.counterpartyVersion = reader.string(); + break; + case 5: + message.proofTry = reader.bytes(); + break; + case 6: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 7: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + counterpartyChannelId: (0, helpers_1.isSet)(object.counterpartyChannelId) ? String(object.counterpartyChannelId) : "", + counterpartyVersion: (0, helpers_1.isSet)(object.counterpartyVersion) ? String(object.counterpartyVersion) : "", + proofTry: (0, helpers_1.isSet)(object.proofTry) ? (0, helpers_1.bytesFromBase64)(object.proofTry) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.counterpartyChannelId !== undefined && + (obj.counterpartyChannelId = message.counterpartyChannelId); + message.counterpartyVersion !== undefined && (obj.counterpartyVersion = message.counterpartyVersion); + message.proofTry !== undefined && + (obj.proofTry = (0, helpers_1.base64FromBytes)(message.proofTry !== undefined ? message.proofTry : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgChannelOpenAck(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.counterpartyChannelId = object.counterpartyChannelId ?? ""; + message.counterpartyVersion = object.counterpartyVersion ?? ""; + message.proofTry = object.proofTry ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgChannelOpenAckResponse() { + return {}; +} +exports.MsgChannelOpenAckResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenAckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgChannelOpenAckResponse(); + return message; + }, +}; +function createBaseMsgChannelOpenConfirm() { + return { + portId: "", + channelId: "", + proofAck: new Uint8Array(), + proofHeight: undefined, + signer: "", + }; +} +exports.MsgChannelOpenConfirm = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.proofAck.length !== 0) { + writer.uint32(26).bytes(message.proofAck); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenConfirm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.proofAck = reader.bytes(); + break; + case 4: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + proofAck: (0, helpers_1.isSet)(object.proofAck) ? (0, helpers_1.bytesFromBase64)(object.proofAck) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.proofAck !== undefined && + (obj.proofAck = (0, helpers_1.base64FromBytes)(message.proofAck !== undefined ? message.proofAck : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgChannelOpenConfirm(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.proofAck = object.proofAck ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgChannelOpenConfirmResponse() { + return {}; +} +exports.MsgChannelOpenConfirmResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgChannelOpenConfirmResponse(); + return message; + }, +}; +function createBaseMsgChannelCloseInit() { + return { + portId: "", + channelId: "", + signer: "", + }; +} +exports.MsgChannelCloseInit = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseInit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgChannelCloseInit(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgChannelCloseInitResponse() { + return {}; +} +exports.MsgChannelCloseInitResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgChannelCloseInitResponse(); + return message; + }, +}; +function createBaseMsgChannelCloseConfirm() { + return { + portId: "", + channelId: "", + proofInit: new Uint8Array(), + proofHeight: undefined, + signer: "", + }; +} +exports.MsgChannelCloseConfirm = { + encode(message, writer = _m0.Writer.create()) { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.proofInit.length !== 0) { + writer.uint32(26).bytes(message.proofInit); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseConfirm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.proofInit = reader.bytes(); + break; + case 4: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + portId: (0, helpers_1.isSet)(object.portId) ? String(object.portId) : "", + channelId: (0, helpers_1.isSet)(object.channelId) ? String(object.channelId) : "", + proofInit: (0, helpers_1.isSet)(object.proofInit) ? (0, helpers_1.bytesFromBase64)(object.proofInit) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.proofInit !== undefined && + (obj.proofInit = (0, helpers_1.base64FromBytes)(message.proofInit !== undefined ? message.proofInit : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgChannelCloseConfirm(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.proofInit = object.proofInit ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgChannelCloseConfirmResponse() { + return {}; +} +exports.MsgChannelCloseConfirmResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgChannelCloseConfirmResponse(); + return message; + }, +}; +function createBaseMsgRecvPacket() { + return { + packet: undefined, + proofCommitment: new Uint8Array(), + proofHeight: undefined, + signer: "", + }; +} +exports.MsgRecvPacket = { + encode(message, writer = _m0.Writer.create()) { + if (message.packet !== undefined) { + channel_1.Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.proofCommitment.length !== 0) { + writer.uint32(18).bytes(message.proofCommitment); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(34).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecvPacket(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = channel_1.Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proofCommitment = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + packet: (0, helpers_1.isSet)(object.packet) ? channel_1.Packet.fromJSON(object.packet) : undefined, + proofCommitment: (0, helpers_1.isSet)(object.proofCommitment) + ? (0, helpers_1.bytesFromBase64)(object.proofCommitment) + : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.packet !== undefined && (obj.packet = message.packet ? channel_1.Packet.toJSON(message.packet) : undefined); + message.proofCommitment !== undefined && + (obj.proofCommitment = (0, helpers_1.base64FromBytes)(message.proofCommitment !== undefined ? message.proofCommitment : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgRecvPacket(); + message.packet = + object.packet !== undefined && object.packet !== null ? channel_1.Packet.fromPartial(object.packet) : undefined; + message.proofCommitment = object.proofCommitment ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgRecvPacketResponse() { + return { + result: 0, + }; +} +exports.MsgRecvPacketResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecvPacketResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + result: (0, helpers_1.isSet)(object.result) ? responseResultTypeFromJSON(object.result) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.result !== undefined && (obj.result = responseResultTypeToJSON(message.result)); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgRecvPacketResponse(); + message.result = object.result ?? 0; + return message; + }, +}; +function createBaseMsgTimeout() { + return { + packet: undefined, + proofUnreceived: new Uint8Array(), + proofHeight: undefined, + nextSequenceRecv: helpers_1.Long.UZERO, + signer: "", + }; +} +exports.MsgTimeout = { + encode(message, writer = _m0.Writer.create()) { + if (message.packet !== undefined) { + channel_1.Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.proofUnreceived.length !== 0) { + writer.uint32(18).bytes(message.proofUnreceived); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (!message.nextSequenceRecv.isZero()) { + writer.uint32(32).uint64(message.nextSequenceRecv); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeout(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = channel_1.Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proofUnreceived = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 4: + message.nextSequenceRecv = reader.uint64(); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + packet: (0, helpers_1.isSet)(object.packet) ? channel_1.Packet.fromJSON(object.packet) : undefined, + proofUnreceived: (0, helpers_1.isSet)(object.proofUnreceived) + ? (0, helpers_1.bytesFromBase64)(object.proofUnreceived) + : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + nextSequenceRecv: (0, helpers_1.isSet)(object.nextSequenceRecv) ? helpers_1.Long.fromValue(object.nextSequenceRecv) : helpers_1.Long.UZERO, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.packet !== undefined && (obj.packet = message.packet ? channel_1.Packet.toJSON(message.packet) : undefined); + message.proofUnreceived !== undefined && + (obj.proofUnreceived = (0, helpers_1.base64FromBytes)(message.proofUnreceived !== undefined ? message.proofUnreceived : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + message.nextSequenceRecv !== undefined && + (obj.nextSequenceRecv = (message.nextSequenceRecv || helpers_1.Long.UZERO).toString()); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgTimeout(); + message.packet = + object.packet !== undefined && object.packet !== null ? channel_1.Packet.fromPartial(object.packet) : undefined; + message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + message.nextSequenceRecv = + object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null + ? helpers_1.Long.fromValue(object.nextSequenceRecv) + : helpers_1.Long.UZERO; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgTimeoutResponse() { + return { + result: 0, + }; +} +exports.MsgTimeoutResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeoutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + result: (0, helpers_1.isSet)(object.result) ? responseResultTypeFromJSON(object.result) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.result !== undefined && (obj.result = responseResultTypeToJSON(message.result)); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgTimeoutResponse(); + message.result = object.result ?? 0; + return message; + }, +}; +function createBaseMsgTimeoutOnClose() { + return { + packet: undefined, + proofUnreceived: new Uint8Array(), + proofClose: new Uint8Array(), + proofHeight: undefined, + nextSequenceRecv: helpers_1.Long.UZERO, + signer: "", + }; +} +exports.MsgTimeoutOnClose = { + encode(message, writer = _m0.Writer.create()) { + if (message.packet !== undefined) { + channel_1.Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.proofUnreceived.length !== 0) { + writer.uint32(18).bytes(message.proofUnreceived); + } + if (message.proofClose.length !== 0) { + writer.uint32(26).bytes(message.proofClose); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (!message.nextSequenceRecv.isZero()) { + writer.uint32(40).uint64(message.nextSequenceRecv); + } + if (message.signer !== "") { + writer.uint32(50).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeoutOnClose(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = channel_1.Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proofUnreceived = reader.bytes(); + break; + case 3: + message.proofClose = reader.bytes(); + break; + case 4: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 5: + message.nextSequenceRecv = reader.uint64(); + break; + case 6: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + packet: (0, helpers_1.isSet)(object.packet) ? channel_1.Packet.fromJSON(object.packet) : undefined, + proofUnreceived: (0, helpers_1.isSet)(object.proofUnreceived) + ? (0, helpers_1.bytesFromBase64)(object.proofUnreceived) + : new Uint8Array(), + proofClose: (0, helpers_1.isSet)(object.proofClose) ? (0, helpers_1.bytesFromBase64)(object.proofClose) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + nextSequenceRecv: (0, helpers_1.isSet)(object.nextSequenceRecv) ? helpers_1.Long.fromValue(object.nextSequenceRecv) : helpers_1.Long.UZERO, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.packet !== undefined && (obj.packet = message.packet ? channel_1.Packet.toJSON(message.packet) : undefined); + message.proofUnreceived !== undefined && + (obj.proofUnreceived = (0, helpers_1.base64FromBytes)(message.proofUnreceived !== undefined ? message.proofUnreceived : new Uint8Array())); + message.proofClose !== undefined && + (obj.proofClose = (0, helpers_1.base64FromBytes)(message.proofClose !== undefined ? message.proofClose : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + message.nextSequenceRecv !== undefined && + (obj.nextSequenceRecv = (message.nextSequenceRecv || helpers_1.Long.UZERO).toString()); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgTimeoutOnClose(); + message.packet = + object.packet !== undefined && object.packet !== null ? channel_1.Packet.fromPartial(object.packet) : undefined; + message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); + message.proofClose = object.proofClose ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + message.nextSequenceRecv = + object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null + ? helpers_1.Long.fromValue(object.nextSequenceRecv) + : helpers_1.Long.UZERO; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgTimeoutOnCloseResponse() { + return { + result: 0, + }; +} +exports.MsgTimeoutOnCloseResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeoutOnCloseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + result: (0, helpers_1.isSet)(object.result) ? responseResultTypeFromJSON(object.result) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.result !== undefined && (obj.result = responseResultTypeToJSON(message.result)); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgTimeoutOnCloseResponse(); + message.result = object.result ?? 0; + return message; + }, +}; +function createBaseMsgAcknowledgement() { + return { + packet: undefined, + acknowledgement: new Uint8Array(), + proofAcked: new Uint8Array(), + proofHeight: undefined, + signer: "", + }; +} +exports.MsgAcknowledgement = { + encode(message, writer = _m0.Writer.create()) { + if (message.packet !== undefined) { + channel_1.Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.acknowledgement.length !== 0) { + writer.uint32(18).bytes(message.acknowledgement); + } + if (message.proofAcked.length !== 0) { + writer.uint32(26).bytes(message.proofAcked); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAcknowledgement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = channel_1.Packet.decode(reader, reader.uint32()); + break; + case 2: + message.acknowledgement = reader.bytes(); + break; + case 3: + message.proofAcked = reader.bytes(); + break; + case 4: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + packet: (0, helpers_1.isSet)(object.packet) ? channel_1.Packet.fromJSON(object.packet) : undefined, + acknowledgement: (0, helpers_1.isSet)(object.acknowledgement) + ? (0, helpers_1.bytesFromBase64)(object.acknowledgement) + : new Uint8Array(), + proofAcked: (0, helpers_1.isSet)(object.proofAcked) ? (0, helpers_1.bytesFromBase64)(object.proofAcked) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.packet !== undefined && (obj.packet = message.packet ? channel_1.Packet.toJSON(message.packet) : undefined); + message.acknowledgement !== undefined && + (obj.acknowledgement = (0, helpers_1.base64FromBytes)(message.acknowledgement !== undefined ? message.acknowledgement : new Uint8Array())); + message.proofAcked !== undefined && + (obj.proofAcked = (0, helpers_1.base64FromBytes)(message.proofAcked !== undefined ? message.proofAcked : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgAcknowledgement(); + message.packet = + object.packet !== undefined && object.packet !== null ? channel_1.Packet.fromPartial(object.packet) : undefined; + message.acknowledgement = object.acknowledgement ?? new Uint8Array(); + message.proofAcked = object.proofAcked ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgAcknowledgementResponse() { + return { + result: 0, + }; +} +exports.MsgAcknowledgementResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAcknowledgementResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + result: (0, helpers_1.isSet)(object.result) ? responseResultTypeFromJSON(object.result) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.result !== undefined && (obj.result = responseResultTypeToJSON(message.result)); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgAcknowledgementResponse(); + message.result = object.result ?? 0; + return message; + }, +}; +class MsgClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.ChannelOpenInit = this.ChannelOpenInit.bind(this); + this.ChannelOpenTry = this.ChannelOpenTry.bind(this); + this.ChannelOpenAck = this.ChannelOpenAck.bind(this); + this.ChannelOpenConfirm = this.ChannelOpenConfirm.bind(this); + this.ChannelCloseInit = this.ChannelCloseInit.bind(this); + this.ChannelCloseConfirm = this.ChannelCloseConfirm.bind(this); + this.RecvPacket = this.RecvPacket.bind(this); + this.Timeout = this.Timeout.bind(this); + this.TimeoutOnClose = this.TimeoutOnClose.bind(this); + this.Acknowledgement = this.Acknowledgement.bind(this); + } + ChannelOpenInit(request) { + const data = exports.MsgChannelOpenInit.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelOpenInit", data); + return promise.then((data) => exports.MsgChannelOpenInitResponse.decode(new _m0.Reader(data))); + } + ChannelOpenTry(request) { + const data = exports.MsgChannelOpenTry.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelOpenTry", data); + return promise.then((data) => exports.MsgChannelOpenTryResponse.decode(new _m0.Reader(data))); + } + ChannelOpenAck(request) { + const data = exports.MsgChannelOpenAck.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelOpenAck", data); + return promise.then((data) => exports.MsgChannelOpenAckResponse.decode(new _m0.Reader(data))); + } + ChannelOpenConfirm(request) { + const data = exports.MsgChannelOpenConfirm.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelOpenConfirm", data); + return promise.then((data) => exports.MsgChannelOpenConfirmResponse.decode(new _m0.Reader(data))); + } + ChannelCloseInit(request) { + const data = exports.MsgChannelCloseInit.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelCloseInit", data); + return promise.then((data) => exports.MsgChannelCloseInitResponse.decode(new _m0.Reader(data))); + } + ChannelCloseConfirm(request) { + const data = exports.MsgChannelCloseConfirm.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelCloseConfirm", data); + return promise.then((data) => exports.MsgChannelCloseConfirmResponse.decode(new _m0.Reader(data))); + } + RecvPacket(request) { + const data = exports.MsgRecvPacket.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "RecvPacket", data); + return promise.then((data) => exports.MsgRecvPacketResponse.decode(new _m0.Reader(data))); + } + Timeout(request) { + const data = exports.MsgTimeout.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "Timeout", data); + return promise.then((data) => exports.MsgTimeoutResponse.decode(new _m0.Reader(data))); + } + TimeoutOnClose(request) { + const data = exports.MsgTimeoutOnClose.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "TimeoutOnClose", data); + return promise.then((data) => exports.MsgTimeoutOnCloseResponse.decode(new _m0.Reader(data))); + } + Acknowledgement(request) { + const data = exports.MsgAcknowledgement.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "Acknowledgement", data); + return promise.then((data) => exports.MsgAcknowledgementResponse.decode(new _m0.Reader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +//# sourceMappingURL=tx.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/core/client/v1/client.js": +/*!****************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/core/client/v1/client.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Params = exports.Height = exports.UpgradeProposal = exports.ClientUpdateProposal = exports.ClientConsensusStates = exports.ConsensusStateWithHeight = exports.IdentifiedClientState = exports.protobufPackage = void 0; +/* eslint-disable */ +const any_1 = __webpack_require__(/*! ../../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const upgrade_1 = __webpack_require__(/*! ../../../../cosmos/upgrade/v1beta1/upgrade */ "./node_modules/cosmjs-types/cosmos/upgrade/v1beta1/upgrade.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "ibc.core.client.v1"; +function createBaseIdentifiedClientState() { + return { + clientId: "", + clientState: undefined, + }; +} +exports.IdentifiedClientState = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.clientState !== undefined) { + any_1.Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentifiedClientState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.clientState = any_1.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + clientState: (0, helpers_1.isSet)(object.clientState) ? any_1.Any.fromJSON(object.clientState) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.clientState !== undefined && + (obj.clientState = message.clientState ? any_1.Any.toJSON(message.clientState) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseIdentifiedClientState(); + message.clientId = object.clientId ?? ""; + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? any_1.Any.fromPartial(object.clientState) + : undefined; + return message; + }, +}; +function createBaseConsensusStateWithHeight() { + return { + height: undefined, + consensusState: undefined, + }; +} +exports.ConsensusStateWithHeight = { + encode(message, writer = _m0.Writer.create()) { + if (message.height !== undefined) { + exports.Height.encode(message.height, writer.uint32(10).fork()).ldelim(); + } + if (message.consensusState !== undefined) { + any_1.Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusStateWithHeight(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = exports.Height.decode(reader, reader.uint32()); + break; + case 2: + message.consensusState = any_1.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + height: (0, helpers_1.isSet)(object.height) ? exports.Height.fromJSON(object.height) : undefined, + consensusState: (0, helpers_1.isSet)(object.consensusState) ? any_1.Any.fromJSON(object.consensusState) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = message.height ? exports.Height.toJSON(message.height) : undefined); + message.consensusState !== undefined && + (obj.consensusState = message.consensusState ? any_1.Any.toJSON(message.consensusState) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseConsensusStateWithHeight(); + message.height = + object.height !== undefined && object.height !== null ? exports.Height.fromPartial(object.height) : undefined; + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? any_1.Any.fromPartial(object.consensusState) + : undefined; + return message; + }, +}; +function createBaseClientConsensusStates() { + return { + clientId: "", + consensusStates: [], + }; +} +exports.ClientConsensusStates = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + for (const v of message.consensusStates) { + exports.ConsensusStateWithHeight.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientConsensusStates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.consensusStates.push(exports.ConsensusStateWithHeight.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + consensusStates: Array.isArray(object?.consensusStates) + ? object.consensusStates.map((e) => exports.ConsensusStateWithHeight.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.consensusStates) { + obj.consensusStates = message.consensusStates.map((e) => e ? exports.ConsensusStateWithHeight.toJSON(e) : undefined); + } + else { + obj.consensusStates = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseClientConsensusStates(); + message.clientId = object.clientId ?? ""; + message.consensusStates = + object.consensusStates?.map((e) => exports.ConsensusStateWithHeight.fromPartial(e)) || []; + return message; + }, +}; +function createBaseClientUpdateProposal() { + return { + title: "", + description: "", + subjectClientId: "", + substituteClientId: "", + }; +} +exports.ClientUpdateProposal = { + encode(message, writer = _m0.Writer.create()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.subjectClientId !== "") { + writer.uint32(26).string(message.subjectClientId); + } + if (message.substituteClientId !== "") { + writer.uint32(34).string(message.substituteClientId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientUpdateProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.subjectClientId = reader.string(); + break; + case 4: + message.substituteClientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + title: (0, helpers_1.isSet)(object.title) ? String(object.title) : "", + description: (0, helpers_1.isSet)(object.description) ? String(object.description) : "", + subjectClientId: (0, helpers_1.isSet)(object.subjectClientId) ? String(object.subjectClientId) : "", + substituteClientId: (0, helpers_1.isSet)(object.substituteClientId) ? String(object.substituteClientId) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.subjectClientId !== undefined && (obj.subjectClientId = message.subjectClientId); + message.substituteClientId !== undefined && (obj.substituteClientId = message.substituteClientId); + return obj; + }, + fromPartial(object) { + const message = createBaseClientUpdateProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.subjectClientId = object.subjectClientId ?? ""; + message.substituteClientId = object.substituteClientId ?? ""; + return message; + }, +}; +function createBaseUpgradeProposal() { + return { + title: "", + description: "", + plan: undefined, + upgradedClientState: undefined, + }; +} +exports.UpgradeProposal = { + encode(message, writer = _m0.Writer.create()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.plan !== undefined) { + upgrade_1.Plan.encode(message.plan, writer.uint32(26).fork()).ldelim(); + } + if (message.upgradedClientState !== undefined) { + any_1.Any.encode(message.upgradedClientState, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.plan = upgrade_1.Plan.decode(reader, reader.uint32()); + break; + case 4: + message.upgradedClientState = any_1.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + title: (0, helpers_1.isSet)(object.title) ? String(object.title) : "", + description: (0, helpers_1.isSet)(object.description) ? String(object.description) : "", + plan: (0, helpers_1.isSet)(object.plan) ? upgrade_1.Plan.fromJSON(object.plan) : undefined, + upgradedClientState: (0, helpers_1.isSet)(object.upgradedClientState) + ? any_1.Any.fromJSON(object.upgradedClientState) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.plan !== undefined && (obj.plan = message.plan ? upgrade_1.Plan.toJSON(message.plan) : undefined); + message.upgradedClientState !== undefined && + (obj.upgradedClientState = message.upgradedClientState + ? any_1.Any.toJSON(message.upgradedClientState) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.plan = + object.plan !== undefined && object.plan !== null ? upgrade_1.Plan.fromPartial(object.plan) : undefined; + message.upgradedClientState = + object.upgradedClientState !== undefined && object.upgradedClientState !== null + ? any_1.Any.fromPartial(object.upgradedClientState) + : undefined; + return message; + }, +}; +function createBaseHeight() { + return { + revisionNumber: helpers_1.Long.UZERO, + revisionHeight: helpers_1.Long.UZERO, + }; +} +exports.Height = { + encode(message, writer = _m0.Writer.create()) { + if (!message.revisionNumber.isZero()) { + writer.uint32(8).uint64(message.revisionNumber); + } + if (!message.revisionHeight.isZero()) { + writer.uint32(16).uint64(message.revisionHeight); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeight(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.revisionNumber = reader.uint64(); + break; + case 2: + message.revisionHeight = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + revisionNumber: (0, helpers_1.isSet)(object.revisionNumber) ? helpers_1.Long.fromValue(object.revisionNumber) : helpers_1.Long.UZERO, + revisionHeight: (0, helpers_1.isSet)(object.revisionHeight) ? helpers_1.Long.fromValue(object.revisionHeight) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.revisionNumber !== undefined && + (obj.revisionNumber = (message.revisionNumber || helpers_1.Long.UZERO).toString()); + message.revisionHeight !== undefined && + (obj.revisionHeight = (message.revisionHeight || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseHeight(); + message.revisionNumber = + object.revisionNumber !== undefined && object.revisionNumber !== null + ? helpers_1.Long.fromValue(object.revisionNumber) + : helpers_1.Long.UZERO; + message.revisionHeight = + object.revisionHeight !== undefined && object.revisionHeight !== null + ? helpers_1.Long.fromValue(object.revisionHeight) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseParams() { + return { + allowedClients: [], + }; +} +exports.Params = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.allowedClients) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowedClients.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + allowedClients: Array.isArray(object?.allowedClients) + ? object.allowedClients.map((e) => String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.allowedClients) { + obj.allowedClients = message.allowedClients.map((e) => e); + } + else { + obj.allowedClients = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseParams(); + message.allowedClients = object.allowedClients?.map((e) => e) || []; + return message; + }, +}; +//# sourceMappingURL=client.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/core/client/v1/query.js": +/*!***************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/core/client/v1/query.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QueryUpgradedConsensusStateResponse = exports.QueryUpgradedConsensusStateRequest = exports.QueryUpgradedClientStateResponse = exports.QueryUpgradedClientStateRequest = exports.QueryClientParamsResponse = exports.QueryClientParamsRequest = exports.QueryClientStatusResponse = exports.QueryClientStatusRequest = exports.QueryConsensusStateHeightsResponse = exports.QueryConsensusStateHeightsRequest = exports.QueryConsensusStatesResponse = exports.QueryConsensusStatesRequest = exports.QueryConsensusStateResponse = exports.QueryConsensusStateRequest = exports.QueryClientStatesResponse = exports.QueryClientStatesRequest = exports.QueryClientStateResponse = exports.QueryClientStateRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const pagination_1 = __webpack_require__(/*! ../../../../cosmos/base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const any_1 = __webpack_require__(/*! ../../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const client_1 = __webpack_require__(/*! ./client */ "./node_modules/cosmjs-types/ibc/core/client/v1/client.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "ibc.core.client.v1"; +function createBaseQueryClientStateRequest() { + return { + clientId: "", + }; +} +exports.QueryClientStateRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryClientStateRequest(); + message.clientId = object.clientId ?? ""; + return message; + }, +}; +function createBaseQueryClientStateResponse() { + return { + clientState: undefined, + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryClientStateResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientState !== undefined) { + any_1.Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientState = any_1.Any.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientState: (0, helpers_1.isSet)(object.clientState) ? any_1.Any.fromJSON(object.clientState) : undefined, + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.clientState !== undefined && + (obj.clientState = message.clientState ? any_1.Any.toJSON(message.clientState) : undefined); + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryClientStateResponse(); + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? any_1.Any.fromPartial(object.clientState) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +function createBaseQueryClientStatesRequest() { + return { + pagination: undefined, + }; +} +exports.QueryClientStatesRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStatesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryClientStatesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryClientStatesResponse() { + return { + clientStates: [], + pagination: undefined, + }; +} +exports.QueryClientStatesResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.clientStates) { + client_1.IdentifiedClientState.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientStates.push(client_1.IdentifiedClientState.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientStates: Array.isArray(object?.clientStates) + ? object.clientStates.map((e) => client_1.IdentifiedClientState.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.clientStates) { + obj.clientStates = message.clientStates.map((e) => (e ? client_1.IdentifiedClientState.toJSON(e) : undefined)); + } + else { + obj.clientStates = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryClientStatesResponse(); + message.clientStates = object.clientStates?.map((e) => client_1.IdentifiedClientState.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryConsensusStateRequest() { + return { + clientId: "", + revisionNumber: helpers_1.Long.UZERO, + revisionHeight: helpers_1.Long.UZERO, + latestHeight: false, + }; +} +exports.QueryConsensusStateRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (!message.revisionNumber.isZero()) { + writer.uint32(16).uint64(message.revisionNumber); + } + if (!message.revisionHeight.isZero()) { + writer.uint32(24).uint64(message.revisionHeight); + } + if (message.latestHeight === true) { + writer.uint32(32).bool(message.latestHeight); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.revisionNumber = reader.uint64(); + break; + case 3: + message.revisionHeight = reader.uint64(); + break; + case 4: + message.latestHeight = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + revisionNumber: (0, helpers_1.isSet)(object.revisionNumber) ? helpers_1.Long.fromValue(object.revisionNumber) : helpers_1.Long.UZERO, + revisionHeight: (0, helpers_1.isSet)(object.revisionHeight) ? helpers_1.Long.fromValue(object.revisionHeight) : helpers_1.Long.UZERO, + latestHeight: (0, helpers_1.isSet)(object.latestHeight) ? Boolean(object.latestHeight) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.revisionNumber !== undefined && + (obj.revisionNumber = (message.revisionNumber || helpers_1.Long.UZERO).toString()); + message.revisionHeight !== undefined && + (obj.revisionHeight = (message.revisionHeight || helpers_1.Long.UZERO).toString()); + message.latestHeight !== undefined && (obj.latestHeight = message.latestHeight); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConsensusStateRequest(); + message.clientId = object.clientId ?? ""; + message.revisionNumber = + object.revisionNumber !== undefined && object.revisionNumber !== null + ? helpers_1.Long.fromValue(object.revisionNumber) + : helpers_1.Long.UZERO; + message.revisionHeight = + object.revisionHeight !== undefined && object.revisionHeight !== null + ? helpers_1.Long.fromValue(object.revisionHeight) + : helpers_1.Long.UZERO; + message.latestHeight = object.latestHeight ?? false; + return message; + }, +}; +function createBaseQueryConsensusStateResponse() { + return { + consensusState: undefined, + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryConsensusStateResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.consensusState !== undefined) { + any_1.Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusState = any_1.Any.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + consensusState: (0, helpers_1.isSet)(object.consensusState) ? any_1.Any.fromJSON(object.consensusState) : undefined, + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.consensusState !== undefined && + (obj.consensusState = message.consensusState ? any_1.Any.toJSON(message.consensusState) : undefined); + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConsensusStateResponse(); + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? any_1.Any.fromPartial(object.consensusState) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +function createBaseQueryConsensusStatesRequest() { + return { + clientId: "", + pagination: undefined, + }; +} +exports.QueryConsensusStatesRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStatesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConsensusStatesRequest(); + message.clientId = object.clientId ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryConsensusStatesResponse() { + return { + consensusStates: [], + pagination: undefined, + }; +} +exports.QueryConsensusStatesResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.consensusStates) { + client_1.ConsensusStateWithHeight.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusStates.push(client_1.ConsensusStateWithHeight.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + consensusStates: Array.isArray(object?.consensusStates) + ? object.consensusStates.map((e) => client_1.ConsensusStateWithHeight.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.consensusStates) { + obj.consensusStates = message.consensusStates.map((e) => e ? client_1.ConsensusStateWithHeight.toJSON(e) : undefined); + } + else { + obj.consensusStates = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConsensusStatesResponse(); + message.consensusStates = + object.consensusStates?.map((e) => client_1.ConsensusStateWithHeight.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryConsensusStateHeightsRequest() { + return { + clientId: "", + pagination: undefined, + }; +} +exports.QueryConsensusStateHeightsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStateHeightsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConsensusStateHeightsRequest(); + message.clientId = object.clientId ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryConsensusStateHeightsResponse() { + return { + consensusStateHeights: [], + pagination: undefined, + }; +} +exports.QueryConsensusStateHeightsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.consensusStateHeights) { + client_1.Height.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStateHeightsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusStateHeights.push(client_1.Height.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + consensusStateHeights: Array.isArray(object?.consensusStateHeights) + ? object.consensusStateHeights.map((e) => client_1.Height.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.consensusStateHeights) { + obj.consensusStateHeights = message.consensusStateHeights.map((e) => e ? client_1.Height.toJSON(e) : undefined); + } + else { + obj.consensusStateHeights = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConsensusStateHeightsResponse(); + message.consensusStateHeights = object.consensusStateHeights?.map((e) => client_1.Height.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryClientStatusRequest() { + return { + clientId: "", + }; +} +exports.QueryClientStatusRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryClientStatusRequest(); + message.clientId = object.clientId ?? ""; + return message; + }, +}; +function createBaseQueryClientStatusResponse() { + return { + status: "", + }; +} +exports.QueryClientStatusResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + status: (0, helpers_1.isSet)(object.status) ? String(object.status) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.status !== undefined && (obj.status = message.status); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryClientStatusResponse(); + message.status = object.status ?? ""; + return message; + }, +}; +function createBaseQueryClientParamsRequest() { + return {}; +} +exports.QueryClientParamsRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryClientParamsRequest(); + return message; + }, +}; +function createBaseQueryClientParamsResponse() { + return { + params: undefined, + }; +} +exports.QueryClientParamsResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.params !== undefined) { + client_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = client_1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + params: (0, helpers_1.isSet)(object.params) ? client_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.params !== undefined && (obj.params = message.params ? client_1.Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryClientParamsResponse(); + message.params = + object.params !== undefined && object.params !== null ? client_1.Params.fromPartial(object.params) : undefined; + return message; + }, +}; +function createBaseQueryUpgradedClientStateRequest() { + return {}; +} +exports.QueryUpgradedClientStateRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedClientStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryUpgradedClientStateRequest(); + return message; + }, +}; +function createBaseQueryUpgradedClientStateResponse() { + return { + upgradedClientState: undefined, + }; +} +exports.QueryUpgradedClientStateResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.upgradedClientState !== undefined) { + any_1.Any.encode(message.upgradedClientState, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedClientStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.upgradedClientState = any_1.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + upgradedClientState: (0, helpers_1.isSet)(object.upgradedClientState) + ? any_1.Any.fromJSON(object.upgradedClientState) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.upgradedClientState !== undefined && + (obj.upgradedClientState = message.upgradedClientState + ? any_1.Any.toJSON(message.upgradedClientState) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryUpgradedClientStateResponse(); + message.upgradedClientState = + object.upgradedClientState !== undefined && object.upgradedClientState !== null + ? any_1.Any.fromPartial(object.upgradedClientState) + : undefined; + return message; + }, +}; +function createBaseQueryUpgradedConsensusStateRequest() { + return {}; +} +exports.QueryUpgradedConsensusStateRequest = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseQueryUpgradedConsensusStateRequest(); + return message; + }, +}; +function createBaseQueryUpgradedConsensusStateResponse() { + return { + upgradedConsensusState: undefined, + }; +} +exports.QueryUpgradedConsensusStateResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.upgradedConsensusState !== undefined) { + any_1.Any.encode(message.upgradedConsensusState, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.upgradedConsensusState = any_1.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + upgradedConsensusState: (0, helpers_1.isSet)(object.upgradedConsensusState) + ? any_1.Any.fromJSON(object.upgradedConsensusState) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.upgradedConsensusState !== undefined && + (obj.upgradedConsensusState = message.upgradedConsensusState + ? any_1.Any.toJSON(message.upgradedConsensusState) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryUpgradedConsensusStateResponse(); + message.upgradedConsensusState = + object.upgradedConsensusState !== undefined && object.upgradedConsensusState !== null + ? any_1.Any.fromPartial(object.upgradedConsensusState) + : undefined; + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.ClientState = this.ClientState.bind(this); + this.ClientStates = this.ClientStates.bind(this); + this.ConsensusState = this.ConsensusState.bind(this); + this.ConsensusStates = this.ConsensusStates.bind(this); + this.ConsensusStateHeights = this.ConsensusStateHeights.bind(this); + this.ClientStatus = this.ClientStatus.bind(this); + this.ClientParams = this.ClientParams.bind(this); + this.UpgradedClientState = this.UpgradedClientState.bind(this); + this.UpgradedConsensusState = this.UpgradedConsensusState.bind(this); + } + ClientState(request) { + const data = exports.QueryClientStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientState", data); + return promise.then((data) => exports.QueryClientStateResponse.decode(new _m0.Reader(data))); + } + ClientStates(request = { + pagination: undefined, + }) { + const data = exports.QueryClientStatesRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientStates", data); + return promise.then((data) => exports.QueryClientStatesResponse.decode(new _m0.Reader(data))); + } + ConsensusState(request) { + const data = exports.QueryConsensusStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ConsensusState", data); + return promise.then((data) => exports.QueryConsensusStateResponse.decode(new _m0.Reader(data))); + } + ConsensusStates(request) { + const data = exports.QueryConsensusStatesRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ConsensusStates", data); + return promise.then((data) => exports.QueryConsensusStatesResponse.decode(new _m0.Reader(data))); + } + ConsensusStateHeights(request) { + const data = exports.QueryConsensusStateHeightsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ConsensusStateHeights", data); + return promise.then((data) => exports.QueryConsensusStateHeightsResponse.decode(new _m0.Reader(data))); + } + ClientStatus(request) { + const data = exports.QueryClientStatusRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientStatus", data); + return promise.then((data) => exports.QueryClientStatusResponse.decode(new _m0.Reader(data))); + } + ClientParams(request = {}) { + const data = exports.QueryClientParamsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientParams", data); + return promise.then((data) => exports.QueryClientParamsResponse.decode(new _m0.Reader(data))); + } + UpgradedClientState(request = {}) { + const data = exports.QueryUpgradedClientStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "UpgradedClientState", data); + return promise.then((data) => exports.QueryUpgradedClientStateResponse.decode(new _m0.Reader(data))); + } + UpgradedConsensusState(request = {}) { + const data = exports.QueryUpgradedConsensusStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "UpgradedConsensusState", data); + return promise.then((data) => exports.QueryUpgradedConsensusStateResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/core/client/v1/tx.js": +/*!************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/core/client/v1/tx.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MsgClientImpl = exports.MsgSubmitMisbehaviourResponse = exports.MsgSubmitMisbehaviour = exports.MsgUpgradeClientResponse = exports.MsgUpgradeClient = exports.MsgUpdateClientResponse = exports.MsgUpdateClient = exports.MsgCreateClientResponse = exports.MsgCreateClient = exports.protobufPackage = void 0; +/* eslint-disable */ +const any_1 = __webpack_require__(/*! ../../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "ibc.core.client.v1"; +function createBaseMsgCreateClient() { + return { + clientState: undefined, + consensusState: undefined, + signer: "", + }; +} +exports.MsgCreateClient = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientState !== undefined) { + any_1.Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); + } + if (message.consensusState !== undefined) { + any_1.Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientState = any_1.Any.decode(reader, reader.uint32()); + break; + case 2: + message.consensusState = any_1.Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientState: (0, helpers_1.isSet)(object.clientState) ? any_1.Any.fromJSON(object.clientState) : undefined, + consensusState: (0, helpers_1.isSet)(object.consensusState) ? any_1.Any.fromJSON(object.consensusState) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.clientState !== undefined && + (obj.clientState = message.clientState ? any_1.Any.toJSON(message.clientState) : undefined); + message.consensusState !== undefined && + (obj.consensusState = message.consensusState ? any_1.Any.toJSON(message.consensusState) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgCreateClient(); + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? any_1.Any.fromPartial(object.clientState) + : undefined; + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? any_1.Any.fromPartial(object.consensusState) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgCreateClientResponse() { + return {}; +} +exports.MsgCreateClientResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgCreateClientResponse(); + return message; + }, +}; +function createBaseMsgUpdateClient() { + return { + clientId: "", + header: undefined, + signer: "", + }; +} +exports.MsgUpdateClient = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.header !== undefined) { + any_1.Any.encode(message.header, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.header = any_1.Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + header: (0, helpers_1.isSet)(object.header) ? any_1.Any.fromJSON(object.header) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.header !== undefined && (obj.header = message.header ? any_1.Any.toJSON(message.header) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgUpdateClient(); + message.clientId = object.clientId ?? ""; + message.header = + object.header !== undefined && object.header !== null ? any_1.Any.fromPartial(object.header) : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgUpdateClientResponse() { + return {}; +} +exports.MsgUpdateClientResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgUpdateClientResponse(); + return message; + }, +}; +function createBaseMsgUpgradeClient() { + return { + clientId: "", + clientState: undefined, + consensusState: undefined, + proofUpgradeClient: new Uint8Array(), + proofUpgradeConsensusState: new Uint8Array(), + signer: "", + }; +} +exports.MsgUpgradeClient = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.clientState !== undefined) { + any_1.Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); + } + if (message.consensusState !== undefined) { + any_1.Any.encode(message.consensusState, writer.uint32(26).fork()).ldelim(); + } + if (message.proofUpgradeClient.length !== 0) { + writer.uint32(34).bytes(message.proofUpgradeClient); + } + if (message.proofUpgradeConsensusState.length !== 0) { + writer.uint32(42).bytes(message.proofUpgradeConsensusState); + } + if (message.signer !== "") { + writer.uint32(50).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpgradeClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.clientState = any_1.Any.decode(reader, reader.uint32()); + break; + case 3: + message.consensusState = any_1.Any.decode(reader, reader.uint32()); + break; + case 4: + message.proofUpgradeClient = reader.bytes(); + break; + case 5: + message.proofUpgradeConsensusState = reader.bytes(); + break; + case 6: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + clientState: (0, helpers_1.isSet)(object.clientState) ? any_1.Any.fromJSON(object.clientState) : undefined, + consensusState: (0, helpers_1.isSet)(object.consensusState) ? any_1.Any.fromJSON(object.consensusState) : undefined, + proofUpgradeClient: (0, helpers_1.isSet)(object.proofUpgradeClient) + ? (0, helpers_1.bytesFromBase64)(object.proofUpgradeClient) + : new Uint8Array(), + proofUpgradeConsensusState: (0, helpers_1.isSet)(object.proofUpgradeConsensusState) + ? (0, helpers_1.bytesFromBase64)(object.proofUpgradeConsensusState) + : new Uint8Array(), + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.clientState !== undefined && + (obj.clientState = message.clientState ? any_1.Any.toJSON(message.clientState) : undefined); + message.consensusState !== undefined && + (obj.consensusState = message.consensusState ? any_1.Any.toJSON(message.consensusState) : undefined); + message.proofUpgradeClient !== undefined && + (obj.proofUpgradeClient = (0, helpers_1.base64FromBytes)(message.proofUpgradeClient !== undefined ? message.proofUpgradeClient : new Uint8Array())); + message.proofUpgradeConsensusState !== undefined && + (obj.proofUpgradeConsensusState = (0, helpers_1.base64FromBytes)(message.proofUpgradeConsensusState !== undefined + ? message.proofUpgradeConsensusState + : new Uint8Array())); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgUpgradeClient(); + message.clientId = object.clientId ?? ""; + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? any_1.Any.fromPartial(object.clientState) + : undefined; + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? any_1.Any.fromPartial(object.consensusState) + : undefined; + message.proofUpgradeClient = object.proofUpgradeClient ?? new Uint8Array(); + message.proofUpgradeConsensusState = object.proofUpgradeConsensusState ?? new Uint8Array(); + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgUpgradeClientResponse() { + return {}; +} +exports.MsgUpgradeClientResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpgradeClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgUpgradeClientResponse(); + return message; + }, +}; +function createBaseMsgSubmitMisbehaviour() { + return { + clientId: "", + misbehaviour: undefined, + signer: "", + }; +} +exports.MsgSubmitMisbehaviour = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.misbehaviour !== undefined) { + any_1.Any.encode(message.misbehaviour, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitMisbehaviour(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.misbehaviour = any_1.Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + misbehaviour: (0, helpers_1.isSet)(object.misbehaviour) ? any_1.Any.fromJSON(object.misbehaviour) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.misbehaviour !== undefined && + (obj.misbehaviour = message.misbehaviour ? any_1.Any.toJSON(message.misbehaviour) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgSubmitMisbehaviour(); + message.clientId = object.clientId ?? ""; + message.misbehaviour = + object.misbehaviour !== undefined && object.misbehaviour !== null + ? any_1.Any.fromPartial(object.misbehaviour) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgSubmitMisbehaviourResponse() { + return {}; +} +exports.MsgSubmitMisbehaviourResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitMisbehaviourResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgSubmitMisbehaviourResponse(); + return message; + }, +}; +class MsgClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.CreateClient = this.CreateClient.bind(this); + this.UpdateClient = this.UpdateClient.bind(this); + this.UpgradeClient = this.UpgradeClient.bind(this); + this.SubmitMisbehaviour = this.SubmitMisbehaviour.bind(this); + } + CreateClient(request) { + const data = exports.MsgCreateClient.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "CreateClient", data); + return promise.then((data) => exports.MsgCreateClientResponse.decode(new _m0.Reader(data))); + } + UpdateClient(request) { + const data = exports.MsgUpdateClient.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "UpdateClient", data); + return promise.then((data) => exports.MsgUpdateClientResponse.decode(new _m0.Reader(data))); + } + UpgradeClient(request) { + const data = exports.MsgUpgradeClient.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "UpgradeClient", data); + return promise.then((data) => exports.MsgUpgradeClientResponse.decode(new _m0.Reader(data))); + } + SubmitMisbehaviour(request) { + const data = exports.MsgSubmitMisbehaviour.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "SubmitMisbehaviour", data); + return promise.then((data) => exports.MsgSubmitMisbehaviourResponse.decode(new _m0.Reader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +//# sourceMappingURL=tx.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/core/commitment/v1/commitment.js": +/*!************************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/core/commitment/v1/commitment.js ***! + \************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MerkleProof = exports.MerklePath = exports.MerklePrefix = exports.MerkleRoot = exports.protobufPackage = void 0; +/* eslint-disable */ +const proofs_1 = __webpack_require__(/*! ../../../../proofs */ "./node_modules/cosmjs-types/proofs.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "ibc.core.commitment.v1"; +function createBaseMerkleRoot() { + return { + hash: new Uint8Array(), + }; +} +exports.MerkleRoot = { + encode(message, writer = _m0.Writer.create()) { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerkleRoot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + hash: (0, helpers_1.isSet)(object.hash) ? (0, helpers_1.bytesFromBase64)(object.hash) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.hash !== undefined && + (obj.hash = (0, helpers_1.base64FromBytes)(message.hash !== undefined ? message.hash : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseMerkleRoot(); + message.hash = object.hash ?? new Uint8Array(); + return message; + }, +}; +function createBaseMerklePrefix() { + return { + keyPrefix: new Uint8Array(), + }; +} +exports.MerklePrefix = { + encode(message, writer = _m0.Writer.create()) { + if (message.keyPrefix.length !== 0) { + writer.uint32(10).bytes(message.keyPrefix); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerklePrefix(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyPrefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + keyPrefix: (0, helpers_1.isSet)(object.keyPrefix) ? (0, helpers_1.bytesFromBase64)(object.keyPrefix) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.keyPrefix !== undefined && + (obj.keyPrefix = (0, helpers_1.base64FromBytes)(message.keyPrefix !== undefined ? message.keyPrefix : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseMerklePrefix(); + message.keyPrefix = object.keyPrefix ?? new Uint8Array(); + return message; + }, +}; +function createBaseMerklePath() { + return { + keyPath: [], + }; +} +exports.MerklePath = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.keyPath) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerklePath(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyPath.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + keyPath: Array.isArray(object?.keyPath) ? object.keyPath.map((e) => String(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.keyPath) { + obj.keyPath = message.keyPath.map((e) => e); + } + else { + obj.keyPath = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseMerklePath(); + message.keyPath = object.keyPath?.map((e) => e) || []; + return message; + }, +}; +function createBaseMerkleProof() { + return { + proofs: [], + }; +} +exports.MerkleProof = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.proofs) { + proofs_1.CommitmentProof.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerkleProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proofs.push(proofs_1.CommitmentProof.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + proofs: Array.isArray(object?.proofs) ? object.proofs.map((e) => proofs_1.CommitmentProof.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.proofs) { + obj.proofs = message.proofs.map((e) => (e ? proofs_1.CommitmentProof.toJSON(e) : undefined)); + } + else { + obj.proofs = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseMerkleProof(); + message.proofs = object.proofs?.map((e) => proofs_1.CommitmentProof.fromPartial(e)) || []; + return message; + }, +}; +//# sourceMappingURL=commitment.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/core/connection/v1/connection.js": +/*!************************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/core/connection/v1/connection.js ***! + \************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Params = exports.Version = exports.ConnectionPaths = exports.ClientPaths = exports.Counterparty = exports.IdentifiedConnection = exports.ConnectionEnd = exports.stateToJSON = exports.stateFromJSON = exports.State = exports.protobufPackage = void 0; +/* eslint-disable */ +const commitment_1 = __webpack_require__(/*! ../../commitment/v1/commitment */ "./node_modules/cosmjs-types/ibc/core/commitment/v1/commitment.js"); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "ibc.core.connection.v1"; +/** + * State defines if a connection is in one of the following states: + * INIT, TRYOPEN, OPEN or UNINITIALIZED. + */ +var State; +(function (State) { + /** STATE_UNINITIALIZED_UNSPECIFIED - Default State */ + State[State["STATE_UNINITIALIZED_UNSPECIFIED"] = 0] = "STATE_UNINITIALIZED_UNSPECIFIED"; + /** STATE_INIT - A connection end has just started the opening handshake. */ + State[State["STATE_INIT"] = 1] = "STATE_INIT"; + /** + * STATE_TRYOPEN - A connection end has acknowledged the handshake step on the counterparty + * chain. + */ + State[State["STATE_TRYOPEN"] = 2] = "STATE_TRYOPEN"; + /** STATE_OPEN - A connection end has completed the handshake. */ + State[State["STATE_OPEN"] = 3] = "STATE_OPEN"; + State[State["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(State = exports.State || (exports.State = {})); +function stateFromJSON(object) { + switch (object) { + case 0: + case "STATE_UNINITIALIZED_UNSPECIFIED": + return State.STATE_UNINITIALIZED_UNSPECIFIED; + case 1: + case "STATE_INIT": + return State.STATE_INIT; + case 2: + case "STATE_TRYOPEN": + return State.STATE_TRYOPEN; + case 3: + case "STATE_OPEN": + return State.STATE_OPEN; + case -1: + case "UNRECOGNIZED": + default: + return State.UNRECOGNIZED; + } +} +exports.stateFromJSON = stateFromJSON; +function stateToJSON(object) { + switch (object) { + case State.STATE_UNINITIALIZED_UNSPECIFIED: + return "STATE_UNINITIALIZED_UNSPECIFIED"; + case State.STATE_INIT: + return "STATE_INIT"; + case State.STATE_TRYOPEN: + return "STATE_TRYOPEN"; + case State.STATE_OPEN: + return "STATE_OPEN"; + case State.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.stateToJSON = stateToJSON; +function createBaseConnectionEnd() { + return { + clientId: "", + versions: [], + state: 0, + counterparty: undefined, + delayPeriod: helpers_1.Long.UZERO, + }; +} +exports.ConnectionEnd = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + for (const v of message.versions) { + exports.Version.encode(v, writer.uint32(18).fork()).ldelim(); + } + if (message.state !== 0) { + writer.uint32(24).int32(message.state); + } + if (message.counterparty !== undefined) { + exports.Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); + } + if (!message.delayPeriod.isZero()) { + writer.uint32(40).uint64(message.delayPeriod); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionEnd(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.versions.push(exports.Version.decode(reader, reader.uint32())); + break; + case 3: + message.state = reader.int32(); + break; + case 4: + message.counterparty = exports.Counterparty.decode(reader, reader.uint32()); + break; + case 5: + message.delayPeriod = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + versions: Array.isArray(object?.versions) ? object.versions.map((e) => exports.Version.fromJSON(e)) : [], + state: (0, helpers_1.isSet)(object.state) ? stateFromJSON(object.state) : 0, + counterparty: (0, helpers_1.isSet)(object.counterparty) ? exports.Counterparty.fromJSON(object.counterparty) : undefined, + delayPeriod: (0, helpers_1.isSet)(object.delayPeriod) ? helpers_1.Long.fromValue(object.delayPeriod) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.versions) { + obj.versions = message.versions.map((e) => (e ? exports.Version.toJSON(e) : undefined)); + } + else { + obj.versions = []; + } + message.state !== undefined && (obj.state = stateToJSON(message.state)); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty ? exports.Counterparty.toJSON(message.counterparty) : undefined); + message.delayPeriod !== undefined && (obj.delayPeriod = (message.delayPeriod || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseConnectionEnd(); + message.clientId = object.clientId ?? ""; + message.versions = object.versions?.map((e) => exports.Version.fromPartial(e)) || []; + message.state = object.state ?? 0; + message.counterparty = + object.counterparty !== undefined && object.counterparty !== null + ? exports.Counterparty.fromPartial(object.counterparty) + : undefined; + message.delayPeriod = + object.delayPeriod !== undefined && object.delayPeriod !== null + ? helpers_1.Long.fromValue(object.delayPeriod) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseIdentifiedConnection() { + return { + id: "", + clientId: "", + versions: [], + state: 0, + counterparty: undefined, + delayPeriod: helpers_1.Long.UZERO, + }; +} +exports.IdentifiedConnection = { + encode(message, writer = _m0.Writer.create()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + for (const v of message.versions) { + exports.Version.encode(v, writer.uint32(26).fork()).ldelim(); + } + if (message.state !== 0) { + writer.uint32(32).int32(message.state); + } + if (message.counterparty !== undefined) { + exports.Counterparty.encode(message.counterparty, writer.uint32(42).fork()).ldelim(); + } + if (!message.delayPeriod.isZero()) { + writer.uint32(48).uint64(message.delayPeriod); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentifiedConnection(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.clientId = reader.string(); + break; + case 3: + message.versions.push(exports.Version.decode(reader, reader.uint32())); + break; + case 4: + message.state = reader.int32(); + break; + case 5: + message.counterparty = exports.Counterparty.decode(reader, reader.uint32()); + break; + case 6: + message.delayPeriod = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + id: (0, helpers_1.isSet)(object.id) ? String(object.id) : "", + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + versions: Array.isArray(object?.versions) ? object.versions.map((e) => exports.Version.fromJSON(e)) : [], + state: (0, helpers_1.isSet)(object.state) ? stateFromJSON(object.state) : 0, + counterparty: (0, helpers_1.isSet)(object.counterparty) ? exports.Counterparty.fromJSON(object.counterparty) : undefined, + delayPeriod: (0, helpers_1.isSet)(object.delayPeriod) ? helpers_1.Long.fromValue(object.delayPeriod) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.id !== undefined && (obj.id = message.id); + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.versions) { + obj.versions = message.versions.map((e) => (e ? exports.Version.toJSON(e) : undefined)); + } + else { + obj.versions = []; + } + message.state !== undefined && (obj.state = stateToJSON(message.state)); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty ? exports.Counterparty.toJSON(message.counterparty) : undefined); + message.delayPeriod !== undefined && (obj.delayPeriod = (message.delayPeriod || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseIdentifiedConnection(); + message.id = object.id ?? ""; + message.clientId = object.clientId ?? ""; + message.versions = object.versions?.map((e) => exports.Version.fromPartial(e)) || []; + message.state = object.state ?? 0; + message.counterparty = + object.counterparty !== undefined && object.counterparty !== null + ? exports.Counterparty.fromPartial(object.counterparty) + : undefined; + message.delayPeriod = + object.delayPeriod !== undefined && object.delayPeriod !== null + ? helpers_1.Long.fromValue(object.delayPeriod) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseCounterparty() { + return { + clientId: "", + connectionId: "", + prefix: undefined, + }; +} +exports.Counterparty = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.prefix !== undefined) { + commitment_1.MerklePrefix.encode(message.prefix, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterparty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.connectionId = reader.string(); + break; + case 3: + message.prefix = commitment_1.MerklePrefix.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + connectionId: (0, helpers_1.isSet)(object.connectionId) ? String(object.connectionId) : "", + prefix: (0, helpers_1.isSet)(object.prefix) ? commitment_1.MerklePrefix.fromJSON(object.prefix) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.connectionId !== undefined && (obj.connectionId = message.connectionId); + message.prefix !== undefined && + (obj.prefix = message.prefix ? commitment_1.MerklePrefix.toJSON(message.prefix) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseCounterparty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.prefix = + object.prefix !== undefined && object.prefix !== null + ? commitment_1.MerklePrefix.fromPartial(object.prefix) + : undefined; + return message; + }, +}; +function createBaseClientPaths() { + return { + paths: [], + }; +} +exports.ClientPaths = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.paths) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientPaths(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + paths: Array.isArray(object?.paths) ? object.paths.map((e) => String(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.paths) { + obj.paths = message.paths.map((e) => e); + } + else { + obj.paths = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseClientPaths(); + message.paths = object.paths?.map((e) => e) || []; + return message; + }, +}; +function createBaseConnectionPaths() { + return { + clientId: "", + paths: [], + }; +} +exports.ConnectionPaths = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + for (const v of message.paths) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionPaths(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + paths: Array.isArray(object?.paths) ? object.paths.map((e) => String(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.paths) { + obj.paths = message.paths.map((e) => e); + } + else { + obj.paths = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseConnectionPaths(); + message.clientId = object.clientId ?? ""; + message.paths = object.paths?.map((e) => e) || []; + return message; + }, +}; +function createBaseVersion() { + return { + identifier: "", + features: [], + }; +} +exports.Version = { + encode(message, writer = _m0.Writer.create()) { + if (message.identifier !== "") { + writer.uint32(10).string(message.identifier); + } + for (const v of message.features) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifier = reader.string(); + break; + case 2: + message.features.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + identifier: (0, helpers_1.isSet)(object.identifier) ? String(object.identifier) : "", + features: Array.isArray(object?.features) ? object.features.map((e) => String(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.identifier !== undefined && (obj.identifier = message.identifier); + if (message.features) { + obj.features = message.features.map((e) => e); + } + else { + obj.features = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseVersion(); + message.identifier = object.identifier ?? ""; + message.features = object.features?.map((e) => e) || []; + return message; + }, +}; +function createBaseParams() { + return { + maxExpectedTimePerBlock: helpers_1.Long.UZERO, + }; +} +exports.Params = { + encode(message, writer = _m0.Writer.create()) { + if (!message.maxExpectedTimePerBlock.isZero()) { + writer.uint32(8).uint64(message.maxExpectedTimePerBlock); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxExpectedTimePerBlock = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + maxExpectedTimePerBlock: (0, helpers_1.isSet)(object.maxExpectedTimePerBlock) + ? helpers_1.Long.fromValue(object.maxExpectedTimePerBlock) + : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.maxExpectedTimePerBlock !== undefined && + (obj.maxExpectedTimePerBlock = (message.maxExpectedTimePerBlock || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseParams(); + message.maxExpectedTimePerBlock = + object.maxExpectedTimePerBlock !== undefined && object.maxExpectedTimePerBlock !== null + ? helpers_1.Long.fromValue(object.maxExpectedTimePerBlock) + : helpers_1.Long.UZERO; + return message; + }, +}; +//# sourceMappingURL=connection.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/core/connection/v1/query.js": +/*!*******************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/core/connection/v1/query.js ***! + \*******************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueryClientImpl = exports.QueryConnectionConsensusStateResponse = exports.QueryConnectionConsensusStateRequest = exports.QueryConnectionClientStateResponse = exports.QueryConnectionClientStateRequest = exports.QueryClientConnectionsResponse = exports.QueryClientConnectionsRequest = exports.QueryConnectionsResponse = exports.QueryConnectionsRequest = exports.QueryConnectionResponse = exports.QueryConnectionRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const pagination_1 = __webpack_require__(/*! ../../../../cosmos/base/query/v1beta1/pagination */ "./node_modules/cosmjs-types/cosmos/base/query/v1beta1/pagination.js"); +const connection_1 = __webpack_require__(/*! ./connection */ "./node_modules/cosmjs-types/ibc/core/connection/v1/connection.js"); +const client_1 = __webpack_require__(/*! ../../client/v1/client */ "./node_modules/cosmjs-types/ibc/core/client/v1/client.js"); +const any_1 = __webpack_require__(/*! ../../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "ibc.core.connection.v1"; +function createBaseQueryConnectionRequest() { + return { + connectionId: "", + }; +} +exports.QueryConnectionRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + connectionId: (0, helpers_1.isSet)(object.connectionId) ? String(object.connectionId) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.connectionId !== undefined && (obj.connectionId = message.connectionId); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConnectionRequest(); + message.connectionId = object.connectionId ?? ""; + return message; + }, +}; +function createBaseQueryConnectionResponse() { + return { + connection: undefined, + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryConnectionResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.connection !== undefined) { + connection_1.ConnectionEnd.encode(message.connection, writer.uint32(10).fork()).ldelim(); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection = connection_1.ConnectionEnd.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + connection: (0, helpers_1.isSet)(object.connection) ? connection_1.ConnectionEnd.fromJSON(object.connection) : undefined, + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.connection !== undefined && + (obj.connection = message.connection ? connection_1.ConnectionEnd.toJSON(message.connection) : undefined); + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConnectionResponse(); + message.connection = + object.connection !== undefined && object.connection !== null + ? connection_1.ConnectionEnd.fromPartial(object.connection) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +function createBaseQueryConnectionsRequest() { + return { + pagination: undefined, + }; +} +exports.QueryConnectionsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConnectionsRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryConnectionsResponse() { + return { + connections: [], + pagination: undefined, + height: undefined, + }; +} +exports.QueryConnectionsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.connections) { + connection_1.IdentifiedConnection.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== undefined) { + client_1.Height.encode(message.height, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connections.push(connection_1.IdentifiedConnection.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + connections: Array.isArray(object?.connections) + ? object.connections.map((e) => connection_1.IdentifiedConnection.fromJSON(e)) + : [], + pagination: (0, helpers_1.isSet)(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined, + height: (0, helpers_1.isSet)(object.height) ? client_1.Height.fromJSON(object.height) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.connections) { + obj.connections = message.connections.map((e) => (e ? connection_1.IdentifiedConnection.toJSON(e) : undefined)); + } + else { + obj.connections = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? pagination_1.PageResponse.toJSON(message.pagination) : undefined); + message.height !== undefined && (obj.height = message.height ? client_1.Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConnectionsResponse(); + message.connections = object.connections?.map((e) => connection_1.IdentifiedConnection.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.height = + object.height !== undefined && object.height !== null ? client_1.Height.fromPartial(object.height) : undefined; + return message; + }, +}; +function createBaseQueryClientConnectionsRequest() { + return { + clientId: "", + }; +} +exports.QueryClientConnectionsRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientConnectionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryClientConnectionsRequest(); + message.clientId = object.clientId ?? ""; + return message; + }, +}; +function createBaseQueryClientConnectionsResponse() { + return { + connectionPaths: [], + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryClientConnectionsResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.connectionPaths) { + writer.uint32(10).string(v); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientConnectionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionPaths.push(reader.string()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + connectionPaths: Array.isArray(object?.connectionPaths) + ? object.connectionPaths.map((e) => String(e)) + : [], + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.connectionPaths) { + obj.connectionPaths = message.connectionPaths.map((e) => e); + } + else { + obj.connectionPaths = []; + } + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryClientConnectionsResponse(); + message.connectionPaths = object.connectionPaths?.map((e) => e) || []; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +function createBaseQueryConnectionClientStateRequest() { + return { + connectionId: "", + }; +} +exports.QueryConnectionClientStateRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionClientStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + connectionId: (0, helpers_1.isSet)(object.connectionId) ? String(object.connectionId) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.connectionId !== undefined && (obj.connectionId = message.connectionId); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConnectionClientStateRequest(); + message.connectionId = object.connectionId ?? ""; + return message; + }, +}; +function createBaseQueryConnectionClientStateResponse() { + return { + identifiedClientState: undefined, + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryConnectionClientStateResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.identifiedClientState !== undefined) { + client_1.IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim(); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionClientStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifiedClientState = client_1.IdentifiedClientState.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + identifiedClientState: (0, helpers_1.isSet)(object.identifiedClientState) + ? client_1.IdentifiedClientState.fromJSON(object.identifiedClientState) + : undefined, + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.identifiedClientState !== undefined && + (obj.identifiedClientState = message.identifiedClientState + ? client_1.IdentifiedClientState.toJSON(message.identifiedClientState) + : undefined); + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConnectionClientStateResponse(); + message.identifiedClientState = + object.identifiedClientState !== undefined && object.identifiedClientState !== null + ? client_1.IdentifiedClientState.fromPartial(object.identifiedClientState) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +function createBaseQueryConnectionConsensusStateRequest() { + return { + connectionId: "", + revisionNumber: helpers_1.Long.UZERO, + revisionHeight: helpers_1.Long.UZERO, + }; +} +exports.QueryConnectionConsensusStateRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (!message.revisionNumber.isZero()) { + writer.uint32(16).uint64(message.revisionNumber); + } + if (!message.revisionHeight.isZero()) { + writer.uint32(24).uint64(message.revisionHeight); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.revisionNumber = reader.uint64(); + break; + case 3: + message.revisionHeight = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + connectionId: (0, helpers_1.isSet)(object.connectionId) ? String(object.connectionId) : "", + revisionNumber: (0, helpers_1.isSet)(object.revisionNumber) ? helpers_1.Long.fromValue(object.revisionNumber) : helpers_1.Long.UZERO, + revisionHeight: (0, helpers_1.isSet)(object.revisionHeight) ? helpers_1.Long.fromValue(object.revisionHeight) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.connectionId !== undefined && (obj.connectionId = message.connectionId); + message.revisionNumber !== undefined && + (obj.revisionNumber = (message.revisionNumber || helpers_1.Long.UZERO).toString()); + message.revisionHeight !== undefined && + (obj.revisionHeight = (message.revisionHeight || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConnectionConsensusStateRequest(); + message.connectionId = object.connectionId ?? ""; + message.revisionNumber = + object.revisionNumber !== undefined && object.revisionNumber !== null + ? helpers_1.Long.fromValue(object.revisionNumber) + : helpers_1.Long.UZERO; + message.revisionHeight = + object.revisionHeight !== undefined && object.revisionHeight !== null + ? helpers_1.Long.fromValue(object.revisionHeight) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseQueryConnectionConsensusStateResponse() { + return { + consensusState: undefined, + clientId: "", + proof: new Uint8Array(), + proofHeight: undefined, + }; +} +exports.QueryConnectionConsensusStateResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.consensusState !== undefined) { + any_1.Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); + } + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + if (message.proof.length !== 0) { + writer.uint32(26).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusState = any_1.Any.decode(reader, reader.uint32()); + break; + case 2: + message.clientId = reader.string(); + break; + case 3: + message.proof = reader.bytes(); + break; + case 4: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + consensusState: (0, helpers_1.isSet)(object.consensusState) ? any_1.Any.fromJSON(object.consensusState) : undefined, + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + proof: (0, helpers_1.isSet)(object.proof) ? (0, helpers_1.bytesFromBase64)(object.proof) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.consensusState !== undefined && + (obj.consensusState = message.consensusState ? any_1.Any.toJSON(message.consensusState) : undefined); + message.clientId !== undefined && (obj.clientId = message.clientId); + message.proof !== undefined && + (obj.proof = (0, helpers_1.base64FromBytes)(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryConnectionConsensusStateResponse(); + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? any_1.Any.fromPartial(object.consensusState) + : undefined; + message.clientId = object.clientId ?? ""; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, +}; +class QueryClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Connection = this.Connection.bind(this); + this.Connections = this.Connections.bind(this); + this.ClientConnections = this.ClientConnections.bind(this); + this.ConnectionClientState = this.ConnectionClientState.bind(this); + this.ConnectionConsensusState = this.ConnectionConsensusState.bind(this); + } + Connection(request) { + const data = exports.QueryConnectionRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Query", "Connection", data); + return promise.then((data) => exports.QueryConnectionResponse.decode(new _m0.Reader(data))); + } + Connections(request = { + pagination: undefined, + }) { + const data = exports.QueryConnectionsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Query", "Connections", data); + return promise.then((data) => exports.QueryConnectionsResponse.decode(new _m0.Reader(data))); + } + ClientConnections(request) { + const data = exports.QueryClientConnectionsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Query", "ClientConnections", data); + return promise.then((data) => exports.QueryClientConnectionsResponse.decode(new _m0.Reader(data))); + } + ConnectionClientState(request) { + const data = exports.QueryConnectionClientStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Query", "ConnectionClientState", data); + return promise.then((data) => exports.QueryConnectionClientStateResponse.decode(new _m0.Reader(data))); + } + ConnectionConsensusState(request) { + const data = exports.QueryConnectionConsensusStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Query", "ConnectionConsensusState", data); + return promise.then((data) => exports.QueryConnectionConsensusStateResponse.decode(new _m0.Reader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +//# sourceMappingURL=query.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/core/connection/v1/tx.js": +/*!****************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/core/connection/v1/tx.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MsgClientImpl = exports.MsgConnectionOpenConfirmResponse = exports.MsgConnectionOpenConfirm = exports.MsgConnectionOpenAckResponse = exports.MsgConnectionOpenAck = exports.MsgConnectionOpenTryResponse = exports.MsgConnectionOpenTry = exports.MsgConnectionOpenInitResponse = exports.MsgConnectionOpenInit = exports.protobufPackage = void 0; +/* eslint-disable */ +const connection_1 = __webpack_require__(/*! ./connection */ "./node_modules/cosmjs-types/ibc/core/connection/v1/connection.js"); +const any_1 = __webpack_require__(/*! ../../../../google/protobuf/any */ "./node_modules/cosmjs-types/google/protobuf/any.js"); +const client_1 = __webpack_require__(/*! ../../client/v1/client */ "./node_modules/cosmjs-types/ibc/core/client/v1/client.js"); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "ibc.core.connection.v1"; +function createBaseMsgConnectionOpenInit() { + return { + clientId: "", + counterparty: undefined, + version: undefined, + delayPeriod: helpers_1.Long.UZERO, + signer: "", + }; +} +exports.MsgConnectionOpenInit = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.counterparty !== undefined) { + connection_1.Counterparty.encode(message.counterparty, writer.uint32(18).fork()).ldelim(); + } + if (message.version !== undefined) { + connection_1.Version.encode(message.version, writer.uint32(26).fork()).ldelim(); + } + if (!message.delayPeriod.isZero()) { + writer.uint32(32).uint64(message.delayPeriod); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenInit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.counterparty = connection_1.Counterparty.decode(reader, reader.uint32()); + break; + case 3: + message.version = connection_1.Version.decode(reader, reader.uint32()); + break; + case 4: + message.delayPeriod = reader.uint64(); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + counterparty: (0, helpers_1.isSet)(object.counterparty) ? connection_1.Counterparty.fromJSON(object.counterparty) : undefined, + version: (0, helpers_1.isSet)(object.version) ? connection_1.Version.fromJSON(object.version) : undefined, + delayPeriod: (0, helpers_1.isSet)(object.delayPeriod) ? helpers_1.Long.fromValue(object.delayPeriod) : helpers_1.Long.UZERO, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty ? connection_1.Counterparty.toJSON(message.counterparty) : undefined); + message.version !== undefined && + (obj.version = message.version ? connection_1.Version.toJSON(message.version) : undefined); + message.delayPeriod !== undefined && (obj.delayPeriod = (message.delayPeriod || helpers_1.Long.UZERO).toString()); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgConnectionOpenInit(); + message.clientId = object.clientId ?? ""; + message.counterparty = + object.counterparty !== undefined && object.counterparty !== null + ? connection_1.Counterparty.fromPartial(object.counterparty) + : undefined; + message.version = + object.version !== undefined && object.version !== null + ? connection_1.Version.fromPartial(object.version) + : undefined; + message.delayPeriod = + object.delayPeriod !== undefined && object.delayPeriod !== null + ? helpers_1.Long.fromValue(object.delayPeriod) + : helpers_1.Long.UZERO; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgConnectionOpenInitResponse() { + return {}; +} +exports.MsgConnectionOpenInitResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgConnectionOpenInitResponse(); + return message; + }, +}; +function createBaseMsgConnectionOpenTry() { + return { + clientId: "", + previousConnectionId: "", + clientState: undefined, + counterparty: undefined, + delayPeriod: helpers_1.Long.UZERO, + counterpartyVersions: [], + proofHeight: undefined, + proofInit: new Uint8Array(), + proofClient: new Uint8Array(), + proofConsensus: new Uint8Array(), + consensusHeight: undefined, + signer: "", + }; +} +exports.MsgConnectionOpenTry = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.previousConnectionId !== "") { + writer.uint32(18).string(message.previousConnectionId); + } + if (message.clientState !== undefined) { + any_1.Any.encode(message.clientState, writer.uint32(26).fork()).ldelim(); + } + if (message.counterparty !== undefined) { + connection_1.Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); + } + if (!message.delayPeriod.isZero()) { + writer.uint32(40).uint64(message.delayPeriod); + } + for (const v of message.counterpartyVersions) { + connection_1.Version.encode(v, writer.uint32(50).fork()).ldelim(); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(58).fork()).ldelim(); + } + if (message.proofInit.length !== 0) { + writer.uint32(66).bytes(message.proofInit); + } + if (message.proofClient.length !== 0) { + writer.uint32(74).bytes(message.proofClient); + } + if (message.proofConsensus.length !== 0) { + writer.uint32(82).bytes(message.proofConsensus); + } + if (message.consensusHeight !== undefined) { + client_1.Height.encode(message.consensusHeight, writer.uint32(90).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(98).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenTry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.previousConnectionId = reader.string(); + break; + case 3: + message.clientState = any_1.Any.decode(reader, reader.uint32()); + break; + case 4: + message.counterparty = connection_1.Counterparty.decode(reader, reader.uint32()); + break; + case 5: + message.delayPeriod = reader.uint64(); + break; + case 6: + message.counterpartyVersions.push(connection_1.Version.decode(reader, reader.uint32())); + break; + case 7: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 8: + message.proofInit = reader.bytes(); + break; + case 9: + message.proofClient = reader.bytes(); + break; + case 10: + message.proofConsensus = reader.bytes(); + break; + case 11: + message.consensusHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 12: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + previousConnectionId: (0, helpers_1.isSet)(object.previousConnectionId) ? String(object.previousConnectionId) : "", + clientState: (0, helpers_1.isSet)(object.clientState) ? any_1.Any.fromJSON(object.clientState) : undefined, + counterparty: (0, helpers_1.isSet)(object.counterparty) ? connection_1.Counterparty.fromJSON(object.counterparty) : undefined, + delayPeriod: (0, helpers_1.isSet)(object.delayPeriod) ? helpers_1.Long.fromValue(object.delayPeriod) : helpers_1.Long.UZERO, + counterpartyVersions: Array.isArray(object?.counterpartyVersions) + ? object.counterpartyVersions.map((e) => connection_1.Version.fromJSON(e)) + : [], + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + proofInit: (0, helpers_1.isSet)(object.proofInit) ? (0, helpers_1.bytesFromBase64)(object.proofInit) : new Uint8Array(), + proofClient: (0, helpers_1.isSet)(object.proofClient) ? (0, helpers_1.bytesFromBase64)(object.proofClient) : new Uint8Array(), + proofConsensus: (0, helpers_1.isSet)(object.proofConsensus) + ? (0, helpers_1.bytesFromBase64)(object.proofConsensus) + : new Uint8Array(), + consensusHeight: (0, helpers_1.isSet)(object.consensusHeight) ? client_1.Height.fromJSON(object.consensusHeight) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.previousConnectionId !== undefined && (obj.previousConnectionId = message.previousConnectionId); + message.clientState !== undefined && + (obj.clientState = message.clientState ? any_1.Any.toJSON(message.clientState) : undefined); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty ? connection_1.Counterparty.toJSON(message.counterparty) : undefined); + message.delayPeriod !== undefined && (obj.delayPeriod = (message.delayPeriod || helpers_1.Long.UZERO).toString()); + if (message.counterpartyVersions) { + obj.counterpartyVersions = message.counterpartyVersions.map((e) => (e ? connection_1.Version.toJSON(e) : undefined)); + } + else { + obj.counterpartyVersions = []; + } + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + message.proofInit !== undefined && + (obj.proofInit = (0, helpers_1.base64FromBytes)(message.proofInit !== undefined ? message.proofInit : new Uint8Array())); + message.proofClient !== undefined && + (obj.proofClient = (0, helpers_1.base64FromBytes)(message.proofClient !== undefined ? message.proofClient : new Uint8Array())); + message.proofConsensus !== undefined && + (obj.proofConsensus = (0, helpers_1.base64FromBytes)(message.proofConsensus !== undefined ? message.proofConsensus : new Uint8Array())); + message.consensusHeight !== undefined && + (obj.consensusHeight = message.consensusHeight ? client_1.Height.toJSON(message.consensusHeight) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgConnectionOpenTry(); + message.clientId = object.clientId ?? ""; + message.previousConnectionId = object.previousConnectionId ?? ""; + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? any_1.Any.fromPartial(object.clientState) + : undefined; + message.counterparty = + object.counterparty !== undefined && object.counterparty !== null + ? connection_1.Counterparty.fromPartial(object.counterparty) + : undefined; + message.delayPeriod = + object.delayPeriod !== undefined && object.delayPeriod !== null + ? helpers_1.Long.fromValue(object.delayPeriod) + : helpers_1.Long.UZERO; + message.counterpartyVersions = object.counterpartyVersions?.map((e) => connection_1.Version.fromPartial(e)) || []; + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + message.proofInit = object.proofInit ?? new Uint8Array(); + message.proofClient = object.proofClient ?? new Uint8Array(); + message.proofConsensus = object.proofConsensus ?? new Uint8Array(); + message.consensusHeight = + object.consensusHeight !== undefined && object.consensusHeight !== null + ? client_1.Height.fromPartial(object.consensusHeight) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgConnectionOpenTryResponse() { + return {}; +} +exports.MsgConnectionOpenTryResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenTryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgConnectionOpenTryResponse(); + return message; + }, +}; +function createBaseMsgConnectionOpenAck() { + return { + connectionId: "", + counterpartyConnectionId: "", + version: undefined, + clientState: undefined, + proofHeight: undefined, + proofTry: new Uint8Array(), + proofClient: new Uint8Array(), + proofConsensus: new Uint8Array(), + consensusHeight: undefined, + signer: "", + }; +} +exports.MsgConnectionOpenAck = { + encode(message, writer = _m0.Writer.create()) { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (message.counterpartyConnectionId !== "") { + writer.uint32(18).string(message.counterpartyConnectionId); + } + if (message.version !== undefined) { + connection_1.Version.encode(message.version, writer.uint32(26).fork()).ldelim(); + } + if (message.clientState !== undefined) { + any_1.Any.encode(message.clientState, writer.uint32(34).fork()).ldelim(); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(42).fork()).ldelim(); + } + if (message.proofTry.length !== 0) { + writer.uint32(50).bytes(message.proofTry); + } + if (message.proofClient.length !== 0) { + writer.uint32(58).bytes(message.proofClient); + } + if (message.proofConsensus.length !== 0) { + writer.uint32(66).bytes(message.proofConsensus); + } + if (message.consensusHeight !== undefined) { + client_1.Height.encode(message.consensusHeight, writer.uint32(74).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(82).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.counterpartyConnectionId = reader.string(); + break; + case 3: + message.version = connection_1.Version.decode(reader, reader.uint32()); + break; + case 4: + message.clientState = any_1.Any.decode(reader, reader.uint32()); + break; + case 5: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 6: + message.proofTry = reader.bytes(); + break; + case 7: + message.proofClient = reader.bytes(); + break; + case 8: + message.proofConsensus = reader.bytes(); + break; + case 9: + message.consensusHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 10: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + connectionId: (0, helpers_1.isSet)(object.connectionId) ? String(object.connectionId) : "", + counterpartyConnectionId: (0, helpers_1.isSet)(object.counterpartyConnectionId) + ? String(object.counterpartyConnectionId) + : "", + version: (0, helpers_1.isSet)(object.version) ? connection_1.Version.fromJSON(object.version) : undefined, + clientState: (0, helpers_1.isSet)(object.clientState) ? any_1.Any.fromJSON(object.clientState) : undefined, + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + proofTry: (0, helpers_1.isSet)(object.proofTry) ? (0, helpers_1.bytesFromBase64)(object.proofTry) : new Uint8Array(), + proofClient: (0, helpers_1.isSet)(object.proofClient) ? (0, helpers_1.bytesFromBase64)(object.proofClient) : new Uint8Array(), + proofConsensus: (0, helpers_1.isSet)(object.proofConsensus) + ? (0, helpers_1.bytesFromBase64)(object.proofConsensus) + : new Uint8Array(), + consensusHeight: (0, helpers_1.isSet)(object.consensusHeight) ? client_1.Height.fromJSON(object.consensusHeight) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.connectionId !== undefined && (obj.connectionId = message.connectionId); + message.counterpartyConnectionId !== undefined && + (obj.counterpartyConnectionId = message.counterpartyConnectionId); + message.version !== undefined && + (obj.version = message.version ? connection_1.Version.toJSON(message.version) : undefined); + message.clientState !== undefined && + (obj.clientState = message.clientState ? any_1.Any.toJSON(message.clientState) : undefined); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + message.proofTry !== undefined && + (obj.proofTry = (0, helpers_1.base64FromBytes)(message.proofTry !== undefined ? message.proofTry : new Uint8Array())); + message.proofClient !== undefined && + (obj.proofClient = (0, helpers_1.base64FromBytes)(message.proofClient !== undefined ? message.proofClient : new Uint8Array())); + message.proofConsensus !== undefined && + (obj.proofConsensus = (0, helpers_1.base64FromBytes)(message.proofConsensus !== undefined ? message.proofConsensus : new Uint8Array())); + message.consensusHeight !== undefined && + (obj.consensusHeight = message.consensusHeight ? client_1.Height.toJSON(message.consensusHeight) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgConnectionOpenAck(); + message.connectionId = object.connectionId ?? ""; + message.counterpartyConnectionId = object.counterpartyConnectionId ?? ""; + message.version = + object.version !== undefined && object.version !== null + ? connection_1.Version.fromPartial(object.version) + : undefined; + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? any_1.Any.fromPartial(object.clientState) + : undefined; + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + message.proofTry = object.proofTry ?? new Uint8Array(); + message.proofClient = object.proofClient ?? new Uint8Array(); + message.proofConsensus = object.proofConsensus ?? new Uint8Array(); + message.consensusHeight = + object.consensusHeight !== undefined && object.consensusHeight !== null + ? client_1.Height.fromPartial(object.consensusHeight) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgConnectionOpenAckResponse() { + return {}; +} +exports.MsgConnectionOpenAckResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenAckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgConnectionOpenAckResponse(); + return message; + }, +}; +function createBaseMsgConnectionOpenConfirm() { + return { + connectionId: "", + proofAck: new Uint8Array(), + proofHeight: undefined, + signer: "", + }; +} +exports.MsgConnectionOpenConfirm = { + encode(message, writer = _m0.Writer.create()) { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (message.proofAck.length !== 0) { + writer.uint32(18).bytes(message.proofAck); + } + if (message.proofHeight !== undefined) { + client_1.Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(34).string(message.signer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenConfirm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.proofAck = reader.bytes(); + break; + case 3: + message.proofHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + connectionId: (0, helpers_1.isSet)(object.connectionId) ? String(object.connectionId) : "", + proofAck: (0, helpers_1.isSet)(object.proofAck) ? (0, helpers_1.bytesFromBase64)(object.proofAck) : new Uint8Array(), + proofHeight: (0, helpers_1.isSet)(object.proofHeight) ? client_1.Height.fromJSON(object.proofHeight) : undefined, + signer: (0, helpers_1.isSet)(object.signer) ? String(object.signer) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.connectionId !== undefined && (obj.connectionId = message.connectionId); + message.proofAck !== undefined && + (obj.proofAck = (0, helpers_1.base64FromBytes)(message.proofAck !== undefined ? message.proofAck : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? client_1.Height.toJSON(message.proofHeight) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object) { + const message = createBaseMsgConnectionOpenConfirm(); + message.connectionId = object.connectionId ?? ""; + message.proofAck = object.proofAck ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? client_1.Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgConnectionOpenConfirmResponse() { + return {}; +} +exports.MsgConnectionOpenConfirmResponse = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseMsgConnectionOpenConfirmResponse(); + return message; + }, +}; +class MsgClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.ConnectionOpenInit = this.ConnectionOpenInit.bind(this); + this.ConnectionOpenTry = this.ConnectionOpenTry.bind(this); + this.ConnectionOpenAck = this.ConnectionOpenAck.bind(this); + this.ConnectionOpenConfirm = this.ConnectionOpenConfirm.bind(this); + } + ConnectionOpenInit(request) { + const data = exports.MsgConnectionOpenInit.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenInit", data); + return promise.then((data) => exports.MsgConnectionOpenInitResponse.decode(new _m0.Reader(data))); + } + ConnectionOpenTry(request) { + const data = exports.MsgConnectionOpenTry.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenTry", data); + return promise.then((data) => exports.MsgConnectionOpenTryResponse.decode(new _m0.Reader(data))); + } + ConnectionOpenAck(request) { + const data = exports.MsgConnectionOpenAck.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenAck", data); + return promise.then((data) => exports.MsgConnectionOpenAckResponse.decode(new _m0.Reader(data))); + } + ConnectionOpenConfirm(request) { + const data = exports.MsgConnectionOpenConfirm.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenConfirm", data); + return promise.then((data) => exports.MsgConnectionOpenConfirmResponse.decode(new _m0.Reader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +//# sourceMappingURL=tx.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/ibc/lightclients/tendermint/v1/tendermint.js": +/*!********************************************************************************!*\ + !*** ./node_modules/cosmjs-types/ibc/lightclients/tendermint/v1/tendermint.js ***! + \********************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Fraction = exports.Header = exports.Misbehaviour = exports.ConsensusState = exports.ClientState = exports.protobufPackage = void 0; +/* eslint-disable */ +const duration_1 = __webpack_require__(/*! ../../../../google/protobuf/duration */ "./node_modules/cosmjs-types/google/protobuf/duration.js"); +const client_1 = __webpack_require__(/*! ../../../core/client/v1/client */ "./node_modules/cosmjs-types/ibc/core/client/v1/client.js"); +const proofs_1 = __webpack_require__(/*! ../../../../proofs */ "./node_modules/cosmjs-types/proofs.js"); +const timestamp_1 = __webpack_require__(/*! ../../../../google/protobuf/timestamp */ "./node_modules/cosmjs-types/google/protobuf/timestamp.js"); +const commitment_1 = __webpack_require__(/*! ../../../core/commitment/v1/commitment */ "./node_modules/cosmjs-types/ibc/core/commitment/v1/commitment.js"); +const types_1 = __webpack_require__(/*! ../../../../tendermint/types/types */ "./node_modules/cosmjs-types/tendermint/types/types.js"); +const validator_1 = __webpack_require__(/*! ../../../../tendermint/types/validator */ "./node_modules/cosmjs-types/tendermint/types/validator.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "ibc.lightclients.tendermint.v1"; +function createBaseClientState() { + return { + chainId: "", + trustLevel: undefined, + trustingPeriod: undefined, + unbondingPeriod: undefined, + maxClockDrift: undefined, + frozenHeight: undefined, + latestHeight: undefined, + proofSpecs: [], + upgradePath: [], + allowUpdateAfterExpiry: false, + allowUpdateAfterMisbehaviour: false, + }; +} +exports.ClientState = { + encode(message, writer = _m0.Writer.create()) { + if (message.chainId !== "") { + writer.uint32(10).string(message.chainId); + } + if (message.trustLevel !== undefined) { + exports.Fraction.encode(message.trustLevel, writer.uint32(18).fork()).ldelim(); + } + if (message.trustingPeriod !== undefined) { + duration_1.Duration.encode(message.trustingPeriod, writer.uint32(26).fork()).ldelim(); + } + if (message.unbondingPeriod !== undefined) { + duration_1.Duration.encode(message.unbondingPeriod, writer.uint32(34).fork()).ldelim(); + } + if (message.maxClockDrift !== undefined) { + duration_1.Duration.encode(message.maxClockDrift, writer.uint32(42).fork()).ldelim(); + } + if (message.frozenHeight !== undefined) { + client_1.Height.encode(message.frozenHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.latestHeight !== undefined) { + client_1.Height.encode(message.latestHeight, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.proofSpecs) { + proofs_1.ProofSpec.encode(v, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.upgradePath) { + writer.uint32(74).string(v); + } + if (message.allowUpdateAfterExpiry === true) { + writer.uint32(80).bool(message.allowUpdateAfterExpiry); + } + if (message.allowUpdateAfterMisbehaviour === true) { + writer.uint32(88).bool(message.allowUpdateAfterMisbehaviour); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chainId = reader.string(); + break; + case 2: + message.trustLevel = exports.Fraction.decode(reader, reader.uint32()); + break; + case 3: + message.trustingPeriod = duration_1.Duration.decode(reader, reader.uint32()); + break; + case 4: + message.unbondingPeriod = duration_1.Duration.decode(reader, reader.uint32()); + break; + case 5: + message.maxClockDrift = duration_1.Duration.decode(reader, reader.uint32()); + break; + case 6: + message.frozenHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 7: + message.latestHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 8: + message.proofSpecs.push(proofs_1.ProofSpec.decode(reader, reader.uint32())); + break; + case 9: + message.upgradePath.push(reader.string()); + break; + case 10: + message.allowUpdateAfterExpiry = reader.bool(); + break; + case 11: + message.allowUpdateAfterMisbehaviour = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + chainId: (0, helpers_1.isSet)(object.chainId) ? String(object.chainId) : "", + trustLevel: (0, helpers_1.isSet)(object.trustLevel) ? exports.Fraction.fromJSON(object.trustLevel) : undefined, + trustingPeriod: (0, helpers_1.isSet)(object.trustingPeriod) ? duration_1.Duration.fromJSON(object.trustingPeriod) : undefined, + unbondingPeriod: (0, helpers_1.isSet)(object.unbondingPeriod) ? duration_1.Duration.fromJSON(object.unbondingPeriod) : undefined, + maxClockDrift: (0, helpers_1.isSet)(object.maxClockDrift) ? duration_1.Duration.fromJSON(object.maxClockDrift) : undefined, + frozenHeight: (0, helpers_1.isSet)(object.frozenHeight) ? client_1.Height.fromJSON(object.frozenHeight) : undefined, + latestHeight: (0, helpers_1.isSet)(object.latestHeight) ? client_1.Height.fromJSON(object.latestHeight) : undefined, + proofSpecs: Array.isArray(object?.proofSpecs) + ? object.proofSpecs.map((e) => proofs_1.ProofSpec.fromJSON(e)) + : [], + upgradePath: Array.isArray(object?.upgradePath) ? object.upgradePath.map((e) => String(e)) : [], + allowUpdateAfterExpiry: (0, helpers_1.isSet)(object.allowUpdateAfterExpiry) + ? Boolean(object.allowUpdateAfterExpiry) + : false, + allowUpdateAfterMisbehaviour: (0, helpers_1.isSet)(object.allowUpdateAfterMisbehaviour) + ? Boolean(object.allowUpdateAfterMisbehaviour) + : false, + }; + }, + toJSON(message) { + const obj = {}; + message.chainId !== undefined && (obj.chainId = message.chainId); + message.trustLevel !== undefined && + (obj.trustLevel = message.trustLevel ? exports.Fraction.toJSON(message.trustLevel) : undefined); + message.trustingPeriod !== undefined && + (obj.trustingPeriod = message.trustingPeriod ? duration_1.Duration.toJSON(message.trustingPeriod) : undefined); + message.unbondingPeriod !== undefined && + (obj.unbondingPeriod = message.unbondingPeriod ? duration_1.Duration.toJSON(message.unbondingPeriod) : undefined); + message.maxClockDrift !== undefined && + (obj.maxClockDrift = message.maxClockDrift ? duration_1.Duration.toJSON(message.maxClockDrift) : undefined); + message.frozenHeight !== undefined && + (obj.frozenHeight = message.frozenHeight ? client_1.Height.toJSON(message.frozenHeight) : undefined); + message.latestHeight !== undefined && + (obj.latestHeight = message.latestHeight ? client_1.Height.toJSON(message.latestHeight) : undefined); + if (message.proofSpecs) { + obj.proofSpecs = message.proofSpecs.map((e) => (e ? proofs_1.ProofSpec.toJSON(e) : undefined)); + } + else { + obj.proofSpecs = []; + } + if (message.upgradePath) { + obj.upgradePath = message.upgradePath.map((e) => e); + } + else { + obj.upgradePath = []; + } + message.allowUpdateAfterExpiry !== undefined && + (obj.allowUpdateAfterExpiry = message.allowUpdateAfterExpiry); + message.allowUpdateAfterMisbehaviour !== undefined && + (obj.allowUpdateAfterMisbehaviour = message.allowUpdateAfterMisbehaviour); + return obj; + }, + fromPartial(object) { + const message = createBaseClientState(); + message.chainId = object.chainId ?? ""; + message.trustLevel = + object.trustLevel !== undefined && object.trustLevel !== null + ? exports.Fraction.fromPartial(object.trustLevel) + : undefined; + message.trustingPeriod = + object.trustingPeriod !== undefined && object.trustingPeriod !== null + ? duration_1.Duration.fromPartial(object.trustingPeriod) + : undefined; + message.unbondingPeriod = + object.unbondingPeriod !== undefined && object.unbondingPeriod !== null + ? duration_1.Duration.fromPartial(object.unbondingPeriod) + : undefined; + message.maxClockDrift = + object.maxClockDrift !== undefined && object.maxClockDrift !== null + ? duration_1.Duration.fromPartial(object.maxClockDrift) + : undefined; + message.frozenHeight = + object.frozenHeight !== undefined && object.frozenHeight !== null + ? client_1.Height.fromPartial(object.frozenHeight) + : undefined; + message.latestHeight = + object.latestHeight !== undefined && object.latestHeight !== null + ? client_1.Height.fromPartial(object.latestHeight) + : undefined; + message.proofSpecs = object.proofSpecs?.map((e) => proofs_1.ProofSpec.fromPartial(e)) || []; + message.upgradePath = object.upgradePath?.map((e) => e) || []; + message.allowUpdateAfterExpiry = object.allowUpdateAfterExpiry ?? false; + message.allowUpdateAfterMisbehaviour = object.allowUpdateAfterMisbehaviour ?? false; + return message; + }, +}; +function createBaseConsensusState() { + return { + timestamp: undefined, + root: undefined, + nextValidatorsHash: new Uint8Array(), + }; +} +exports.ConsensusState = { + encode(message, writer = _m0.Writer.create()) { + if (message.timestamp !== undefined) { + timestamp_1.Timestamp.encode(message.timestamp, writer.uint32(10).fork()).ldelim(); + } + if (message.root !== undefined) { + commitment_1.MerkleRoot.encode(message.root, writer.uint32(18).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(26).bytes(message.nextValidatorsHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.timestamp = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.root = commitment_1.MerkleRoot.decode(reader, reader.uint32()); + break; + case 3: + message.nextValidatorsHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + timestamp: (0, helpers_1.isSet)(object.timestamp) ? (0, helpers_1.fromJsonTimestamp)(object.timestamp) : undefined, + root: (0, helpers_1.isSet)(object.root) ? commitment_1.MerkleRoot.fromJSON(object.root) : undefined, + nextValidatorsHash: (0, helpers_1.isSet)(object.nextValidatorsHash) + ? (0, helpers_1.bytesFromBase64)(object.nextValidatorsHash) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.timestamp !== undefined && (obj.timestamp = (0, helpers_1.fromTimestamp)(message.timestamp).toISOString()); + message.root !== undefined && (obj.root = message.root ? commitment_1.MerkleRoot.toJSON(message.root) : undefined); + message.nextValidatorsHash !== undefined && + (obj.nextValidatorsHash = (0, helpers_1.base64FromBytes)(message.nextValidatorsHash !== undefined ? message.nextValidatorsHash : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseConsensusState(); + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? timestamp_1.Timestamp.fromPartial(object.timestamp) + : undefined; + message.root = + object.root !== undefined && object.root !== null ? commitment_1.MerkleRoot.fromPartial(object.root) : undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + return message; + }, +}; +function createBaseMisbehaviour() { + return { + clientId: "", + header1: undefined, + header2: undefined, + }; +} +exports.Misbehaviour = { + encode(message, writer = _m0.Writer.create()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.header1 !== undefined) { + exports.Header.encode(message.header1, writer.uint32(18).fork()).ldelim(); + } + if (message.header2 !== undefined) { + exports.Header.encode(message.header2, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehaviour(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.header1 = exports.Header.decode(reader, reader.uint32()); + break; + case 3: + message.header2 = exports.Header.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + clientId: (0, helpers_1.isSet)(object.clientId) ? String(object.clientId) : "", + header1: (0, helpers_1.isSet)(object.header1) ? exports.Header.fromJSON(object.header1) : undefined, + header2: (0, helpers_1.isSet)(object.header2) ? exports.Header.fromJSON(object.header2) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.header1 !== undefined && + (obj.header1 = message.header1 ? exports.Header.toJSON(message.header1) : undefined); + message.header2 !== undefined && + (obj.header2 = message.header2 ? exports.Header.toJSON(message.header2) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseMisbehaviour(); + message.clientId = object.clientId ?? ""; + message.header1 = + object.header1 !== undefined && object.header1 !== null + ? exports.Header.fromPartial(object.header1) + : undefined; + message.header2 = + object.header2 !== undefined && object.header2 !== null + ? exports.Header.fromPartial(object.header2) + : undefined; + return message; + }, +}; +function createBaseHeader() { + return { + signedHeader: undefined, + validatorSet: undefined, + trustedHeight: undefined, + trustedValidators: undefined, + }; +} +exports.Header = { + encode(message, writer = _m0.Writer.create()) { + if (message.signedHeader !== undefined) { + types_1.SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); + } + if (message.validatorSet !== undefined) { + validator_1.ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).ldelim(); + } + if (message.trustedHeight !== undefined) { + client_1.Height.encode(message.trustedHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.trustedValidators !== undefined) { + validator_1.ValidatorSet.encode(message.trustedValidators, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signedHeader = types_1.SignedHeader.decode(reader, reader.uint32()); + break; + case 2: + message.validatorSet = validator_1.ValidatorSet.decode(reader, reader.uint32()); + break; + case 3: + message.trustedHeight = client_1.Height.decode(reader, reader.uint32()); + break; + case 4: + message.trustedValidators = validator_1.ValidatorSet.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + signedHeader: (0, helpers_1.isSet)(object.signedHeader) ? types_1.SignedHeader.fromJSON(object.signedHeader) : undefined, + validatorSet: (0, helpers_1.isSet)(object.validatorSet) ? validator_1.ValidatorSet.fromJSON(object.validatorSet) : undefined, + trustedHeight: (0, helpers_1.isSet)(object.trustedHeight) ? client_1.Height.fromJSON(object.trustedHeight) : undefined, + trustedValidators: (0, helpers_1.isSet)(object.trustedValidators) + ? validator_1.ValidatorSet.fromJSON(object.trustedValidators) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.signedHeader !== undefined && + (obj.signedHeader = message.signedHeader ? types_1.SignedHeader.toJSON(message.signedHeader) : undefined); + message.validatorSet !== undefined && + (obj.validatorSet = message.validatorSet ? validator_1.ValidatorSet.toJSON(message.validatorSet) : undefined); + message.trustedHeight !== undefined && + (obj.trustedHeight = message.trustedHeight ? client_1.Height.toJSON(message.trustedHeight) : undefined); + message.trustedValidators !== undefined && + (obj.trustedValidators = message.trustedValidators + ? validator_1.ValidatorSet.toJSON(message.trustedValidators) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseHeader(); + message.signedHeader = + object.signedHeader !== undefined && object.signedHeader !== null + ? types_1.SignedHeader.fromPartial(object.signedHeader) + : undefined; + message.validatorSet = + object.validatorSet !== undefined && object.validatorSet !== null + ? validator_1.ValidatorSet.fromPartial(object.validatorSet) + : undefined; + message.trustedHeight = + object.trustedHeight !== undefined && object.trustedHeight !== null + ? client_1.Height.fromPartial(object.trustedHeight) + : undefined; + message.trustedValidators = + object.trustedValidators !== undefined && object.trustedValidators !== null + ? validator_1.ValidatorSet.fromPartial(object.trustedValidators) + : undefined; + return message; + }, +}; +function createBaseFraction() { + return { + numerator: helpers_1.Long.UZERO, + denominator: helpers_1.Long.UZERO, + }; +} +exports.Fraction = { + encode(message, writer = _m0.Writer.create()) { + if (!message.numerator.isZero()) { + writer.uint32(8).uint64(message.numerator); + } + if (!message.denominator.isZero()) { + writer.uint32(16).uint64(message.denominator); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFraction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.numerator = reader.uint64(); + break; + case 2: + message.denominator = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + numerator: (0, helpers_1.isSet)(object.numerator) ? helpers_1.Long.fromValue(object.numerator) : helpers_1.Long.UZERO, + denominator: (0, helpers_1.isSet)(object.denominator) ? helpers_1.Long.fromValue(object.denominator) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.numerator !== undefined && (obj.numerator = (message.numerator || helpers_1.Long.UZERO).toString()); + message.denominator !== undefined && (obj.denominator = (message.denominator || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseFraction(); + message.numerator = + object.numerator !== undefined && object.numerator !== null + ? helpers_1.Long.fromValue(object.numerator) + : helpers_1.Long.UZERO; + message.denominator = + object.denominator !== undefined && object.denominator !== null + ? helpers_1.Long.fromValue(object.denominator) + : helpers_1.Long.UZERO; + return message; + }, +}; +//# sourceMappingURL=tendermint.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/proofs.js": +/*!*********************************************!*\ + !*** ./node_modules/cosmjs-types/proofs.js ***! + \*********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CompressedNonExistenceProof = exports.CompressedExistenceProof = exports.CompressedBatchEntry = exports.CompressedBatchProof = exports.BatchEntry = exports.BatchProof = exports.InnerSpec = exports.ProofSpec = exports.InnerOp = exports.LeafOp = exports.CommitmentProof = exports.NonExistenceProof = exports.ExistenceProof = exports.lengthOpToJSON = exports.lengthOpFromJSON = exports.LengthOp = exports.hashOpToJSON = exports.hashOpFromJSON = exports.HashOp = exports.protobufPackage = void 0; +/* eslint-disable */ +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ./helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "ics23"; +var HashOp; +(function (HashOp) { + /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */ + HashOp[HashOp["NO_HASH"] = 0] = "NO_HASH"; + HashOp[HashOp["SHA256"] = 1] = "SHA256"; + HashOp[HashOp["SHA512"] = 2] = "SHA512"; + HashOp[HashOp["KECCAK"] = 3] = "KECCAK"; + HashOp[HashOp["RIPEMD160"] = 4] = "RIPEMD160"; + /** BITCOIN - ripemd160(sha256(x)) */ + HashOp[HashOp["BITCOIN"] = 5] = "BITCOIN"; + HashOp[HashOp["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(HashOp = exports.HashOp || (exports.HashOp = {})); +function hashOpFromJSON(object) { + switch (object) { + case 0: + case "NO_HASH": + return HashOp.NO_HASH; + case 1: + case "SHA256": + return HashOp.SHA256; + case 2: + case "SHA512": + return HashOp.SHA512; + case 3: + case "KECCAK": + return HashOp.KECCAK; + case 4: + case "RIPEMD160": + return HashOp.RIPEMD160; + case 5: + case "BITCOIN": + return HashOp.BITCOIN; + case -1: + case "UNRECOGNIZED": + default: + return HashOp.UNRECOGNIZED; + } +} +exports.hashOpFromJSON = hashOpFromJSON; +function hashOpToJSON(object) { + switch (object) { + case HashOp.NO_HASH: + return "NO_HASH"; + case HashOp.SHA256: + return "SHA256"; + case HashOp.SHA512: + return "SHA512"; + case HashOp.KECCAK: + return "KECCAK"; + case HashOp.RIPEMD160: + return "RIPEMD160"; + case HashOp.BITCOIN: + return "BITCOIN"; + case HashOp.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.hashOpToJSON = hashOpToJSON; +/** + * LengthOp defines how to process the key and value of the LeafOp + * to include length information. After encoding the length with the given + * algorithm, the length will be prepended to the key and value bytes. + * (Each one with it's own encoded length) + */ +var LengthOp; +(function (LengthOp) { + /** NO_PREFIX - NO_PREFIX don't include any length info */ + LengthOp[LengthOp["NO_PREFIX"] = 0] = "NO_PREFIX"; + /** VAR_PROTO - VAR_PROTO uses protobuf (and go-amino) varint encoding of the length */ + LengthOp[LengthOp["VAR_PROTO"] = 1] = "VAR_PROTO"; + /** VAR_RLP - VAR_RLP uses rlp int encoding of the length */ + LengthOp[LengthOp["VAR_RLP"] = 2] = "VAR_RLP"; + /** FIXED32_BIG - FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer */ + LengthOp[LengthOp["FIXED32_BIG"] = 3] = "FIXED32_BIG"; + /** FIXED32_LITTLE - FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer */ + LengthOp[LengthOp["FIXED32_LITTLE"] = 4] = "FIXED32_LITTLE"; + /** FIXED64_BIG - FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer */ + LengthOp[LengthOp["FIXED64_BIG"] = 5] = "FIXED64_BIG"; + /** FIXED64_LITTLE - FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer */ + LengthOp[LengthOp["FIXED64_LITTLE"] = 6] = "FIXED64_LITTLE"; + /** REQUIRE_32_BYTES - REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) */ + LengthOp[LengthOp["REQUIRE_32_BYTES"] = 7] = "REQUIRE_32_BYTES"; + /** REQUIRE_64_BYTES - REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) */ + LengthOp[LengthOp["REQUIRE_64_BYTES"] = 8] = "REQUIRE_64_BYTES"; + LengthOp[LengthOp["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(LengthOp = exports.LengthOp || (exports.LengthOp = {})); +function lengthOpFromJSON(object) { + switch (object) { + case 0: + case "NO_PREFIX": + return LengthOp.NO_PREFIX; + case 1: + case "VAR_PROTO": + return LengthOp.VAR_PROTO; + case 2: + case "VAR_RLP": + return LengthOp.VAR_RLP; + case 3: + case "FIXED32_BIG": + return LengthOp.FIXED32_BIG; + case 4: + case "FIXED32_LITTLE": + return LengthOp.FIXED32_LITTLE; + case 5: + case "FIXED64_BIG": + return LengthOp.FIXED64_BIG; + case 6: + case "FIXED64_LITTLE": + return LengthOp.FIXED64_LITTLE; + case 7: + case "REQUIRE_32_BYTES": + return LengthOp.REQUIRE_32_BYTES; + case 8: + case "REQUIRE_64_BYTES": + return LengthOp.REQUIRE_64_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return LengthOp.UNRECOGNIZED; + } +} +exports.lengthOpFromJSON = lengthOpFromJSON; +function lengthOpToJSON(object) { + switch (object) { + case LengthOp.NO_PREFIX: + return "NO_PREFIX"; + case LengthOp.VAR_PROTO: + return "VAR_PROTO"; + case LengthOp.VAR_RLP: + return "VAR_RLP"; + case LengthOp.FIXED32_BIG: + return "FIXED32_BIG"; + case LengthOp.FIXED32_LITTLE: + return "FIXED32_LITTLE"; + case LengthOp.FIXED64_BIG: + return "FIXED64_BIG"; + case LengthOp.FIXED64_LITTLE: + return "FIXED64_LITTLE"; + case LengthOp.REQUIRE_32_BYTES: + return "REQUIRE_32_BYTES"; + case LengthOp.REQUIRE_64_BYTES: + return "REQUIRE_64_BYTES"; + case LengthOp.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.lengthOpToJSON = lengthOpToJSON; +function createBaseExistenceProof() { + return { + key: new Uint8Array(), + value: new Uint8Array(), + leaf: undefined, + path: [], + }; +} +exports.ExistenceProof = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.leaf !== undefined) { + exports.LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.path) { + exports.InnerOp.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.leaf = exports.LeafOp.decode(reader, reader.uint32()); + break; + case 4: + message.path.push(exports.InnerOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + value: (0, helpers_1.isSet)(object.value) ? (0, helpers_1.bytesFromBase64)(object.value) : new Uint8Array(), + leaf: (0, helpers_1.isSet)(object.leaf) ? exports.LeafOp.fromJSON(object.leaf) : undefined, + path: Array.isArray(object?.path) ? object.path.map((e) => exports.InnerOp.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = (0, helpers_1.base64FromBytes)(message.value !== undefined ? message.value : new Uint8Array())); + message.leaf !== undefined && (obj.leaf = message.leaf ? exports.LeafOp.toJSON(message.leaf) : undefined); + if (message.path) { + obj.path = message.path.map((e) => (e ? exports.InnerOp.toJSON(e) : undefined)); + } + else { + obj.path = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseExistenceProof(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.leaf = + object.leaf !== undefined && object.leaf !== null ? exports.LeafOp.fromPartial(object.leaf) : undefined; + message.path = object.path?.map((e) => exports.InnerOp.fromPartial(e)) || []; + return message; + }, +}; +function createBaseNonExistenceProof() { + return { + key: new Uint8Array(), + left: undefined, + right: undefined, + }; +} +exports.NonExistenceProof = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.left !== undefined) { + exports.ExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim(); + } + if (message.right !== undefined) { + exports.ExistenceProof.encode(message.right, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNonExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.left = exports.ExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.right = exports.ExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + left: (0, helpers_1.isSet)(object.left) ? exports.ExistenceProof.fromJSON(object.left) : undefined, + right: (0, helpers_1.isSet)(object.right) ? exports.ExistenceProof.fromJSON(object.right) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + message.left !== undefined && (obj.left = message.left ? exports.ExistenceProof.toJSON(message.left) : undefined); + message.right !== undefined && + (obj.right = message.right ? exports.ExistenceProof.toJSON(message.right) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseNonExistenceProof(); + message.key = object.key ?? new Uint8Array(); + message.left = + object.left !== undefined && object.left !== null ? exports.ExistenceProof.fromPartial(object.left) : undefined; + message.right = + object.right !== undefined && object.right !== null + ? exports.ExistenceProof.fromPartial(object.right) + : undefined; + return message; + }, +}; +function createBaseCommitmentProof() { + return { + exist: undefined, + nonexist: undefined, + batch: undefined, + compressed: undefined, + }; +} +exports.CommitmentProof = { + encode(message, writer = _m0.Writer.create()) { + if (message.exist !== undefined) { + exports.ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); + } + if (message.nonexist !== undefined) { + exports.NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim(); + } + if (message.batch !== undefined) { + exports.BatchProof.encode(message.batch, writer.uint32(26).fork()).ldelim(); + } + if (message.compressed !== undefined) { + exports.CompressedBatchProof.encode(message.compressed, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitmentProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = exports.ExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = exports.NonExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.batch = exports.BatchProof.decode(reader, reader.uint32()); + break; + case 4: + message.compressed = exports.CompressedBatchProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + exist: (0, helpers_1.isSet)(object.exist) ? exports.ExistenceProof.fromJSON(object.exist) : undefined, + nonexist: (0, helpers_1.isSet)(object.nonexist) ? exports.NonExistenceProof.fromJSON(object.nonexist) : undefined, + batch: (0, helpers_1.isSet)(object.batch) ? exports.BatchProof.fromJSON(object.batch) : undefined, + compressed: (0, helpers_1.isSet)(object.compressed) ? exports.CompressedBatchProof.fromJSON(object.compressed) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.exist !== undefined && + (obj.exist = message.exist ? exports.ExistenceProof.toJSON(message.exist) : undefined); + message.nonexist !== undefined && + (obj.nonexist = message.nonexist ? exports.NonExistenceProof.toJSON(message.nonexist) : undefined); + message.batch !== undefined && (obj.batch = message.batch ? exports.BatchProof.toJSON(message.batch) : undefined); + message.compressed !== undefined && + (obj.compressed = message.compressed ? exports.CompressedBatchProof.toJSON(message.compressed) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseCommitmentProof(); + message.exist = + object.exist !== undefined && object.exist !== null + ? exports.ExistenceProof.fromPartial(object.exist) + : undefined; + message.nonexist = + object.nonexist !== undefined && object.nonexist !== null + ? exports.NonExistenceProof.fromPartial(object.nonexist) + : undefined; + message.batch = + object.batch !== undefined && object.batch !== null ? exports.BatchProof.fromPartial(object.batch) : undefined; + message.compressed = + object.compressed !== undefined && object.compressed !== null + ? exports.CompressedBatchProof.fromPartial(object.compressed) + : undefined; + return message; + }, +}; +function createBaseLeafOp() { + return { + hash: 0, + prehashKey: 0, + prehashValue: 0, + length: 0, + prefix: new Uint8Array(), + }; +} +exports.LeafOp = { + encode(message, writer = _m0.Writer.create()) { + if (message.hash !== 0) { + writer.uint32(8).int32(message.hash); + } + if (message.prehashKey !== 0) { + writer.uint32(16).int32(message.prehashKey); + } + if (message.prehashValue !== 0) { + writer.uint32(24).int32(message.prehashValue); + } + if (message.length !== 0) { + writer.uint32(32).int32(message.length); + } + if (message.prefix.length !== 0) { + writer.uint32(42).bytes(message.prefix); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLeafOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.int32(); + break; + case 2: + message.prehashKey = reader.int32(); + break; + case 3: + message.prehashValue = reader.int32(); + break; + case 4: + message.length = reader.int32(); + break; + case 5: + message.prefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + hash: (0, helpers_1.isSet)(object.hash) ? hashOpFromJSON(object.hash) : 0, + prehashKey: (0, helpers_1.isSet)(object.prehashKey) ? hashOpFromJSON(object.prehashKey) : 0, + prehashValue: (0, helpers_1.isSet)(object.prehashValue) ? hashOpFromJSON(object.prehashValue) : 0, + length: (0, helpers_1.isSet)(object.length) ? lengthOpFromJSON(object.length) : 0, + prefix: (0, helpers_1.isSet)(object.prefix) ? (0, helpers_1.bytesFromBase64)(object.prefix) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); + message.prehashKey !== undefined && (obj.prehashKey = hashOpToJSON(message.prehashKey)); + message.prehashValue !== undefined && (obj.prehashValue = hashOpToJSON(message.prehashValue)); + message.length !== undefined && (obj.length = lengthOpToJSON(message.length)); + message.prefix !== undefined && + (obj.prefix = (0, helpers_1.base64FromBytes)(message.prefix !== undefined ? message.prefix : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseLeafOp(); + message.hash = object.hash ?? 0; + message.prehashKey = object.prehashKey ?? 0; + message.prehashValue = object.prehashValue ?? 0; + message.length = object.length ?? 0; + message.prefix = object.prefix ?? new Uint8Array(); + return message; + }, +}; +function createBaseInnerOp() { + return { + hash: 0, + prefix: new Uint8Array(), + suffix: new Uint8Array(), + }; +} +exports.InnerOp = { + encode(message, writer = _m0.Writer.create()) { + if (message.hash !== 0) { + writer.uint32(8).int32(message.hash); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + if (message.suffix.length !== 0) { + writer.uint32(26).bytes(message.suffix); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.int32(); + break; + case 2: + message.prefix = reader.bytes(); + break; + case 3: + message.suffix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + hash: (0, helpers_1.isSet)(object.hash) ? hashOpFromJSON(object.hash) : 0, + prefix: (0, helpers_1.isSet)(object.prefix) ? (0, helpers_1.bytesFromBase64)(object.prefix) : new Uint8Array(), + suffix: (0, helpers_1.isSet)(object.suffix) ? (0, helpers_1.bytesFromBase64)(object.suffix) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); + message.prefix !== undefined && + (obj.prefix = (0, helpers_1.base64FromBytes)(message.prefix !== undefined ? message.prefix : new Uint8Array())); + message.suffix !== undefined && + (obj.suffix = (0, helpers_1.base64FromBytes)(message.suffix !== undefined ? message.suffix : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseInnerOp(); + message.hash = object.hash ?? 0; + message.prefix = object.prefix ?? new Uint8Array(); + message.suffix = object.suffix ?? new Uint8Array(); + return message; + }, +}; +function createBaseProofSpec() { + return { + leafSpec: undefined, + innerSpec: undefined, + maxDepth: 0, + minDepth: 0, + }; +} +exports.ProofSpec = { + encode(message, writer = _m0.Writer.create()) { + if (message.leafSpec !== undefined) { + exports.LeafOp.encode(message.leafSpec, writer.uint32(10).fork()).ldelim(); + } + if (message.innerSpec !== undefined) { + exports.InnerSpec.encode(message.innerSpec, writer.uint32(18).fork()).ldelim(); + } + if (message.maxDepth !== 0) { + writer.uint32(24).int32(message.maxDepth); + } + if (message.minDepth !== 0) { + writer.uint32(32).int32(message.minDepth); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.leafSpec = exports.LeafOp.decode(reader, reader.uint32()); + break; + case 2: + message.innerSpec = exports.InnerSpec.decode(reader, reader.uint32()); + break; + case 3: + message.maxDepth = reader.int32(); + break; + case 4: + message.minDepth = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + leafSpec: (0, helpers_1.isSet)(object.leafSpec) ? exports.LeafOp.fromJSON(object.leafSpec) : undefined, + innerSpec: (0, helpers_1.isSet)(object.innerSpec) ? exports.InnerSpec.fromJSON(object.innerSpec) : undefined, + maxDepth: (0, helpers_1.isSet)(object.maxDepth) ? Number(object.maxDepth) : 0, + minDepth: (0, helpers_1.isSet)(object.minDepth) ? Number(object.minDepth) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.leafSpec !== undefined && + (obj.leafSpec = message.leafSpec ? exports.LeafOp.toJSON(message.leafSpec) : undefined); + message.innerSpec !== undefined && + (obj.innerSpec = message.innerSpec ? exports.InnerSpec.toJSON(message.innerSpec) : undefined); + message.maxDepth !== undefined && (obj.maxDepth = Math.round(message.maxDepth)); + message.minDepth !== undefined && (obj.minDepth = Math.round(message.minDepth)); + return obj; + }, + fromPartial(object) { + const message = createBaseProofSpec(); + message.leafSpec = + object.leafSpec !== undefined && object.leafSpec !== null + ? exports.LeafOp.fromPartial(object.leafSpec) + : undefined; + message.innerSpec = + object.innerSpec !== undefined && object.innerSpec !== null + ? exports.InnerSpec.fromPartial(object.innerSpec) + : undefined; + message.maxDepth = object.maxDepth ?? 0; + message.minDepth = object.minDepth ?? 0; + return message; + }, +}; +function createBaseInnerSpec() { + return { + childOrder: [], + childSize: 0, + minPrefixLength: 0, + maxPrefixLength: 0, + emptyChild: new Uint8Array(), + hash: 0, + }; +} +exports.InnerSpec = { + encode(message, writer = _m0.Writer.create()) { + writer.uint32(10).fork(); + for (const v of message.childOrder) { + writer.int32(v); + } + writer.ldelim(); + if (message.childSize !== 0) { + writer.uint32(16).int32(message.childSize); + } + if (message.minPrefixLength !== 0) { + writer.uint32(24).int32(message.minPrefixLength); + } + if (message.maxPrefixLength !== 0) { + writer.uint32(32).int32(message.maxPrefixLength); + } + if (message.emptyChild.length !== 0) { + writer.uint32(42).bytes(message.emptyChild); + } + if (message.hash !== 0) { + writer.uint32(48).int32(message.hash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.childOrder.push(reader.int32()); + } + } + else { + message.childOrder.push(reader.int32()); + } + break; + case 2: + message.childSize = reader.int32(); + break; + case 3: + message.minPrefixLength = reader.int32(); + break; + case 4: + message.maxPrefixLength = reader.int32(); + break; + case 5: + message.emptyChild = reader.bytes(); + break; + case 6: + message.hash = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + childOrder: Array.isArray(object?.childOrder) ? object.childOrder.map((e) => Number(e)) : [], + childSize: (0, helpers_1.isSet)(object.childSize) ? Number(object.childSize) : 0, + minPrefixLength: (0, helpers_1.isSet)(object.minPrefixLength) ? Number(object.minPrefixLength) : 0, + maxPrefixLength: (0, helpers_1.isSet)(object.maxPrefixLength) ? Number(object.maxPrefixLength) : 0, + emptyChild: (0, helpers_1.isSet)(object.emptyChild) ? (0, helpers_1.bytesFromBase64)(object.emptyChild) : new Uint8Array(), + hash: (0, helpers_1.isSet)(object.hash) ? hashOpFromJSON(object.hash) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.childOrder) { + obj.childOrder = message.childOrder.map((e) => Math.round(e)); + } + else { + obj.childOrder = []; + } + message.childSize !== undefined && (obj.childSize = Math.round(message.childSize)); + message.minPrefixLength !== undefined && (obj.minPrefixLength = Math.round(message.minPrefixLength)); + message.maxPrefixLength !== undefined && (obj.maxPrefixLength = Math.round(message.maxPrefixLength)); + message.emptyChild !== undefined && + (obj.emptyChild = (0, helpers_1.base64FromBytes)(message.emptyChild !== undefined ? message.emptyChild : new Uint8Array())); + message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); + return obj; + }, + fromPartial(object) { + const message = createBaseInnerSpec(); + message.childOrder = object.childOrder?.map((e) => e) || []; + message.childSize = object.childSize ?? 0; + message.minPrefixLength = object.minPrefixLength ?? 0; + message.maxPrefixLength = object.maxPrefixLength ?? 0; + message.emptyChild = object.emptyChild ?? new Uint8Array(); + message.hash = object.hash ?? 0; + return message; + }, +}; +function createBaseBatchProof() { + return { + entries: [], + }; +} +exports.BatchProof = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.entries) { + exports.BatchEntry.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBatchProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.entries.push(exports.BatchEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + entries: Array.isArray(object?.entries) ? object.entries.map((e) => exports.BatchEntry.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.entries) { + obj.entries = message.entries.map((e) => (e ? exports.BatchEntry.toJSON(e) : undefined)); + } + else { + obj.entries = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseBatchProof(); + message.entries = object.entries?.map((e) => exports.BatchEntry.fromPartial(e)) || []; + return message; + }, +}; +function createBaseBatchEntry() { + return { + exist: undefined, + nonexist: undefined, + }; +} +exports.BatchEntry = { + encode(message, writer = _m0.Writer.create()) { + if (message.exist !== undefined) { + exports.ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); + } + if (message.nonexist !== undefined) { + exports.NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBatchEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = exports.ExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = exports.NonExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + exist: (0, helpers_1.isSet)(object.exist) ? exports.ExistenceProof.fromJSON(object.exist) : undefined, + nonexist: (0, helpers_1.isSet)(object.nonexist) ? exports.NonExistenceProof.fromJSON(object.nonexist) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.exist !== undefined && + (obj.exist = message.exist ? exports.ExistenceProof.toJSON(message.exist) : undefined); + message.nonexist !== undefined && + (obj.nonexist = message.nonexist ? exports.NonExistenceProof.toJSON(message.nonexist) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseBatchEntry(); + message.exist = + object.exist !== undefined && object.exist !== null + ? exports.ExistenceProof.fromPartial(object.exist) + : undefined; + message.nonexist = + object.nonexist !== undefined && object.nonexist !== null + ? exports.NonExistenceProof.fromPartial(object.nonexist) + : undefined; + return message; + }, +}; +function createBaseCompressedBatchProof() { + return { + entries: [], + lookupInners: [], + }; +} +exports.CompressedBatchProof = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.entries) { + exports.CompressedBatchEntry.encode(v, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.lookupInners) { + exports.InnerOp.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedBatchProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.entries.push(exports.CompressedBatchEntry.decode(reader, reader.uint32())); + break; + case 2: + message.lookupInners.push(exports.InnerOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + entries: Array.isArray(object?.entries) + ? object.entries.map((e) => exports.CompressedBatchEntry.fromJSON(e)) + : [], + lookupInners: Array.isArray(object?.lookupInners) + ? object.lookupInners.map((e) => exports.InnerOp.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.entries) { + obj.entries = message.entries.map((e) => (e ? exports.CompressedBatchEntry.toJSON(e) : undefined)); + } + else { + obj.entries = []; + } + if (message.lookupInners) { + obj.lookupInners = message.lookupInners.map((e) => (e ? exports.InnerOp.toJSON(e) : undefined)); + } + else { + obj.lookupInners = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseCompressedBatchProof(); + message.entries = object.entries?.map((e) => exports.CompressedBatchEntry.fromPartial(e)) || []; + message.lookupInners = object.lookupInners?.map((e) => exports.InnerOp.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCompressedBatchEntry() { + return { + exist: undefined, + nonexist: undefined, + }; +} +exports.CompressedBatchEntry = { + encode(message, writer = _m0.Writer.create()) { + if (message.exist !== undefined) { + exports.CompressedExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); + } + if (message.nonexist !== undefined) { + exports.CompressedNonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedBatchEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = exports.CompressedExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = exports.CompressedNonExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + exist: (0, helpers_1.isSet)(object.exist) ? exports.CompressedExistenceProof.fromJSON(object.exist) : undefined, + nonexist: (0, helpers_1.isSet)(object.nonexist) ? exports.CompressedNonExistenceProof.fromJSON(object.nonexist) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.exist !== undefined && + (obj.exist = message.exist ? exports.CompressedExistenceProof.toJSON(message.exist) : undefined); + message.nonexist !== undefined && + (obj.nonexist = message.nonexist ? exports.CompressedNonExistenceProof.toJSON(message.nonexist) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseCompressedBatchEntry(); + message.exist = + object.exist !== undefined && object.exist !== null + ? exports.CompressedExistenceProof.fromPartial(object.exist) + : undefined; + message.nonexist = + object.nonexist !== undefined && object.nonexist !== null + ? exports.CompressedNonExistenceProof.fromPartial(object.nonexist) + : undefined; + return message; + }, +}; +function createBaseCompressedExistenceProof() { + return { + key: new Uint8Array(), + value: new Uint8Array(), + leaf: undefined, + path: [], + }; +} +exports.CompressedExistenceProof = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.leaf !== undefined) { + exports.LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); + } + writer.uint32(34).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.leaf = exports.LeafOp.decode(reader, reader.uint32()); + break; + case 4: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + } + else { + message.path.push(reader.int32()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + value: (0, helpers_1.isSet)(object.value) ? (0, helpers_1.bytesFromBase64)(object.value) : new Uint8Array(), + leaf: (0, helpers_1.isSet)(object.leaf) ? exports.LeafOp.fromJSON(object.leaf) : undefined, + path: Array.isArray(object?.path) ? object.path.map((e) => Number(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = (0, helpers_1.base64FromBytes)(message.value !== undefined ? message.value : new Uint8Array())); + message.leaf !== undefined && (obj.leaf = message.leaf ? exports.LeafOp.toJSON(message.leaf) : undefined); + if (message.path) { + obj.path = message.path.map((e) => Math.round(e)); + } + else { + obj.path = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseCompressedExistenceProof(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.leaf = + object.leaf !== undefined && object.leaf !== null ? exports.LeafOp.fromPartial(object.leaf) : undefined; + message.path = object.path?.map((e) => e) || []; + return message; + }, +}; +function createBaseCompressedNonExistenceProof() { + return { + key: new Uint8Array(), + left: undefined, + right: undefined, + }; +} +exports.CompressedNonExistenceProof = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.left !== undefined) { + exports.CompressedExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim(); + } + if (message.right !== undefined) { + exports.CompressedExistenceProof.encode(message.right, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedNonExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.left = exports.CompressedExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.right = exports.CompressedExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + left: (0, helpers_1.isSet)(object.left) ? exports.CompressedExistenceProof.fromJSON(object.left) : undefined, + right: (0, helpers_1.isSet)(object.right) ? exports.CompressedExistenceProof.fromJSON(object.right) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + message.left !== undefined && + (obj.left = message.left ? exports.CompressedExistenceProof.toJSON(message.left) : undefined); + message.right !== undefined && + (obj.right = message.right ? exports.CompressedExistenceProof.toJSON(message.right) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseCompressedNonExistenceProof(); + message.key = object.key ?? new Uint8Array(); + message.left = + object.left !== undefined && object.left !== null + ? exports.CompressedExistenceProof.fromPartial(object.left) + : undefined; + message.right = + object.right !== undefined && object.right !== null + ? exports.CompressedExistenceProof.fromPartial(object.right) + : undefined; + return message; + }, +}; +//# sourceMappingURL=proofs.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/tendermint/abci/types.js": +/*!************************************************************!*\ + !*** ./node_modules/cosmjs-types/tendermint/abci/types.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Event = exports.LastCommitInfo = exports.BlockParams = exports.ConsensusParams = exports.ResponseApplySnapshotChunk = exports.ResponseLoadSnapshotChunk = exports.ResponseOfferSnapshot = exports.ResponseListSnapshots = exports.ResponseCommit = exports.ResponseEndBlock = exports.ResponseDeliverTx = exports.ResponseCheckTx = exports.ResponseBeginBlock = exports.ResponseQuery = exports.ResponseInitChain = exports.ResponseSetOption = exports.ResponseInfo = exports.ResponseFlush = exports.ResponseEcho = exports.ResponseException = exports.Response = exports.RequestApplySnapshotChunk = exports.RequestLoadSnapshotChunk = exports.RequestOfferSnapshot = exports.RequestListSnapshots = exports.RequestCommit = exports.RequestEndBlock = exports.RequestDeliverTx = exports.RequestCheckTx = exports.RequestBeginBlock = exports.RequestQuery = exports.RequestInitChain = exports.RequestSetOption = exports.RequestInfo = exports.RequestFlush = exports.RequestEcho = exports.Request = exports.evidenceTypeToJSON = exports.evidenceTypeFromJSON = exports.EvidenceType = exports.responseApplySnapshotChunk_ResultToJSON = exports.responseApplySnapshotChunk_ResultFromJSON = exports.ResponseApplySnapshotChunk_Result = exports.responseOfferSnapshot_ResultToJSON = exports.responseOfferSnapshot_ResultFromJSON = exports.ResponseOfferSnapshot_Result = exports.checkTxTypeToJSON = exports.checkTxTypeFromJSON = exports.CheckTxType = exports.protobufPackage = void 0; +exports.ABCIApplicationClientImpl = exports.Snapshot = exports.Evidence = exports.VoteInfo = exports.ValidatorUpdate = exports.Validator = exports.TxResult = exports.EventAttribute = void 0; +/* eslint-disable */ +const timestamp_1 = __webpack_require__(/*! ../../google/protobuf/timestamp */ "./node_modules/cosmjs-types/google/protobuf/timestamp.js"); +const types_1 = __webpack_require__(/*! ../types/types */ "./node_modules/cosmjs-types/tendermint/types/types.js"); +const proof_1 = __webpack_require__(/*! ../crypto/proof */ "./node_modules/cosmjs-types/tendermint/crypto/proof.js"); +const params_1 = __webpack_require__(/*! ../types/params */ "./node_modules/cosmjs-types/tendermint/types/params.js"); +const keys_1 = __webpack_require__(/*! ../crypto/keys */ "./node_modules/cosmjs-types/tendermint/crypto/keys.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "tendermint.abci"; +var CheckTxType; +(function (CheckTxType) { + CheckTxType[CheckTxType["NEW"] = 0] = "NEW"; + CheckTxType[CheckTxType["RECHECK"] = 1] = "RECHECK"; + CheckTxType[CheckTxType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(CheckTxType = exports.CheckTxType || (exports.CheckTxType = {})); +function checkTxTypeFromJSON(object) { + switch (object) { + case 0: + case "NEW": + return CheckTxType.NEW; + case 1: + case "RECHECK": + return CheckTxType.RECHECK; + case -1: + case "UNRECOGNIZED": + default: + return CheckTxType.UNRECOGNIZED; + } +} +exports.checkTxTypeFromJSON = checkTxTypeFromJSON; +function checkTxTypeToJSON(object) { + switch (object) { + case CheckTxType.NEW: + return "NEW"; + case CheckTxType.RECHECK: + return "RECHECK"; + case CheckTxType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.checkTxTypeToJSON = checkTxTypeToJSON; +var ResponseOfferSnapshot_Result; +(function (ResponseOfferSnapshot_Result) { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["UNKNOWN"] = 0] = "UNKNOWN"; + /** ACCEPT - Snapshot accepted, apply chunks */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["ACCEPT"] = 1] = "ACCEPT"; + /** ABORT - Abort all snapshot restoration */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["ABORT"] = 2] = "ABORT"; + /** REJECT - Reject this specific snapshot, try others */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["REJECT"] = 3] = "REJECT"; + /** REJECT_FORMAT - Reject all snapshots of this format, try others */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["REJECT_FORMAT"] = 4] = "REJECT_FORMAT"; + /** REJECT_SENDER - Reject all snapshots from the sender(s), try others */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["REJECT_SENDER"] = 5] = "REJECT_SENDER"; + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ResponseOfferSnapshot_Result = exports.ResponseOfferSnapshot_Result || (exports.ResponseOfferSnapshot_Result = {})); +function responseOfferSnapshot_ResultFromJSON(object) { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseOfferSnapshot_Result.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseOfferSnapshot_Result.ACCEPT; + case 2: + case "ABORT": + return ResponseOfferSnapshot_Result.ABORT; + case 3: + case "REJECT": + return ResponseOfferSnapshot_Result.REJECT; + case 4: + case "REJECT_FORMAT": + return ResponseOfferSnapshot_Result.REJECT_FORMAT; + case 5: + case "REJECT_SENDER": + return ResponseOfferSnapshot_Result.REJECT_SENDER; + case -1: + case "UNRECOGNIZED": + default: + return ResponseOfferSnapshot_Result.UNRECOGNIZED; + } +} +exports.responseOfferSnapshot_ResultFromJSON = responseOfferSnapshot_ResultFromJSON; +function responseOfferSnapshot_ResultToJSON(object) { + switch (object) { + case ResponseOfferSnapshot_Result.UNKNOWN: + return "UNKNOWN"; + case ResponseOfferSnapshot_Result.ACCEPT: + return "ACCEPT"; + case ResponseOfferSnapshot_Result.ABORT: + return "ABORT"; + case ResponseOfferSnapshot_Result.REJECT: + return "REJECT"; + case ResponseOfferSnapshot_Result.REJECT_FORMAT: + return "REJECT_FORMAT"; + case ResponseOfferSnapshot_Result.REJECT_SENDER: + return "REJECT_SENDER"; + case ResponseOfferSnapshot_Result.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.responseOfferSnapshot_ResultToJSON = responseOfferSnapshot_ResultToJSON; +var ResponseApplySnapshotChunk_Result; +(function (ResponseApplySnapshotChunk_Result) { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["UNKNOWN"] = 0] = "UNKNOWN"; + /** ACCEPT - Chunk successfully accepted */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["ACCEPT"] = 1] = "ACCEPT"; + /** ABORT - Abort all snapshot restoration */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["ABORT"] = 2] = "ABORT"; + /** RETRY - Retry chunk (combine with refetch and reject) */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["RETRY"] = 3] = "RETRY"; + /** RETRY_SNAPSHOT - Retry snapshot (combine with refetch and reject) */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["RETRY_SNAPSHOT"] = 4] = "RETRY_SNAPSHOT"; + /** REJECT_SNAPSHOT - Reject this snapshot, try others */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["REJECT_SNAPSHOT"] = 5] = "REJECT_SNAPSHOT"; + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ResponseApplySnapshotChunk_Result = exports.ResponseApplySnapshotChunk_Result || (exports.ResponseApplySnapshotChunk_Result = {})); +function responseApplySnapshotChunk_ResultFromJSON(object) { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseApplySnapshotChunk_Result.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseApplySnapshotChunk_Result.ACCEPT; + case 2: + case "ABORT": + return ResponseApplySnapshotChunk_Result.ABORT; + case 3: + case "RETRY": + return ResponseApplySnapshotChunk_Result.RETRY; + case 4: + case "RETRY_SNAPSHOT": + return ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT; + case 5: + case "REJECT_SNAPSHOT": + return ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseApplySnapshotChunk_Result.UNRECOGNIZED; + } +} +exports.responseApplySnapshotChunk_ResultFromJSON = responseApplySnapshotChunk_ResultFromJSON; +function responseApplySnapshotChunk_ResultToJSON(object) { + switch (object) { + case ResponseApplySnapshotChunk_Result.UNKNOWN: + return "UNKNOWN"; + case ResponseApplySnapshotChunk_Result.ACCEPT: + return "ACCEPT"; + case ResponseApplySnapshotChunk_Result.ABORT: + return "ABORT"; + case ResponseApplySnapshotChunk_Result.RETRY: + return "RETRY"; + case ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT: + return "RETRY_SNAPSHOT"; + case ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT: + return "REJECT_SNAPSHOT"; + case ResponseApplySnapshotChunk_Result.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.responseApplySnapshotChunk_ResultToJSON = responseApplySnapshotChunk_ResultToJSON; +var EvidenceType; +(function (EvidenceType) { + EvidenceType[EvidenceType["UNKNOWN"] = 0] = "UNKNOWN"; + EvidenceType[EvidenceType["DUPLICATE_VOTE"] = 1] = "DUPLICATE_VOTE"; + EvidenceType[EvidenceType["LIGHT_CLIENT_ATTACK"] = 2] = "LIGHT_CLIENT_ATTACK"; + EvidenceType[EvidenceType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(EvidenceType = exports.EvidenceType || (exports.EvidenceType = {})); +function evidenceTypeFromJSON(object) { + switch (object) { + case 0: + case "UNKNOWN": + return EvidenceType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return EvidenceType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return EvidenceType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return EvidenceType.UNRECOGNIZED; + } +} +exports.evidenceTypeFromJSON = evidenceTypeFromJSON; +function evidenceTypeToJSON(object) { + switch (object) { + case EvidenceType.UNKNOWN: + return "UNKNOWN"; + case EvidenceType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case EvidenceType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case EvidenceType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.evidenceTypeToJSON = evidenceTypeToJSON; +function createBaseRequest() { + return { + echo: undefined, + flush: undefined, + info: undefined, + setOption: undefined, + initChain: undefined, + query: undefined, + beginBlock: undefined, + checkTx: undefined, + deliverTx: undefined, + endBlock: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + }; +} +exports.Request = { + encode(message, writer = _m0.Writer.create()) { + if (message.echo !== undefined) { + exports.RequestEcho.encode(message.echo, writer.uint32(10).fork()).ldelim(); + } + if (message.flush !== undefined) { + exports.RequestFlush.encode(message.flush, writer.uint32(18).fork()).ldelim(); + } + if (message.info !== undefined) { + exports.RequestInfo.encode(message.info, writer.uint32(26).fork()).ldelim(); + } + if (message.setOption !== undefined) { + exports.RequestSetOption.encode(message.setOption, writer.uint32(34).fork()).ldelim(); + } + if (message.initChain !== undefined) { + exports.RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).ldelim(); + } + if (message.query !== undefined) { + exports.RequestQuery.encode(message.query, writer.uint32(50).fork()).ldelim(); + } + if (message.beginBlock !== undefined) { + exports.RequestBeginBlock.encode(message.beginBlock, writer.uint32(58).fork()).ldelim(); + } + if (message.checkTx !== undefined) { + exports.RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).ldelim(); + } + if (message.deliverTx !== undefined) { + exports.RequestDeliverTx.encode(message.deliverTx, writer.uint32(74).fork()).ldelim(); + } + if (message.endBlock !== undefined) { + exports.RequestEndBlock.encode(message.endBlock, writer.uint32(82).fork()).ldelim(); + } + if (message.commit !== undefined) { + exports.RequestCommit.encode(message.commit, writer.uint32(90).fork()).ldelim(); + } + if (message.listSnapshots !== undefined) { + exports.RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).ldelim(); + } + if (message.offerSnapshot !== undefined) { + exports.RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).ldelim(); + } + if (message.loadSnapshotChunk !== undefined) { + exports.RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).ldelim(); + } + if (message.applySnapshotChunk !== undefined) { + exports.RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.echo = exports.RequestEcho.decode(reader, reader.uint32()); + break; + case 2: + message.flush = exports.RequestFlush.decode(reader, reader.uint32()); + break; + case 3: + message.info = exports.RequestInfo.decode(reader, reader.uint32()); + break; + case 4: + message.setOption = exports.RequestSetOption.decode(reader, reader.uint32()); + break; + case 5: + message.initChain = exports.RequestInitChain.decode(reader, reader.uint32()); + break; + case 6: + message.query = exports.RequestQuery.decode(reader, reader.uint32()); + break; + case 7: + message.beginBlock = exports.RequestBeginBlock.decode(reader, reader.uint32()); + break; + case 8: + message.checkTx = exports.RequestCheckTx.decode(reader, reader.uint32()); + break; + case 9: + message.deliverTx = exports.RequestDeliverTx.decode(reader, reader.uint32()); + break; + case 10: + message.endBlock = exports.RequestEndBlock.decode(reader, reader.uint32()); + break; + case 11: + message.commit = exports.RequestCommit.decode(reader, reader.uint32()); + break; + case 12: + message.listSnapshots = exports.RequestListSnapshots.decode(reader, reader.uint32()); + break; + case 13: + message.offerSnapshot = exports.RequestOfferSnapshot.decode(reader, reader.uint32()); + break; + case 14: + message.loadSnapshotChunk = exports.RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + break; + case 15: + message.applySnapshotChunk = exports.RequestApplySnapshotChunk.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + echo: (0, helpers_1.isSet)(object.echo) ? exports.RequestEcho.fromJSON(object.echo) : undefined, + flush: (0, helpers_1.isSet)(object.flush) ? exports.RequestFlush.fromJSON(object.flush) : undefined, + info: (0, helpers_1.isSet)(object.info) ? exports.RequestInfo.fromJSON(object.info) : undefined, + setOption: (0, helpers_1.isSet)(object.setOption) ? exports.RequestSetOption.fromJSON(object.setOption) : undefined, + initChain: (0, helpers_1.isSet)(object.initChain) ? exports.RequestInitChain.fromJSON(object.initChain) : undefined, + query: (0, helpers_1.isSet)(object.query) ? exports.RequestQuery.fromJSON(object.query) : undefined, + beginBlock: (0, helpers_1.isSet)(object.beginBlock) ? exports.RequestBeginBlock.fromJSON(object.beginBlock) : undefined, + checkTx: (0, helpers_1.isSet)(object.checkTx) ? exports.RequestCheckTx.fromJSON(object.checkTx) : undefined, + deliverTx: (0, helpers_1.isSet)(object.deliverTx) ? exports.RequestDeliverTx.fromJSON(object.deliverTx) : undefined, + endBlock: (0, helpers_1.isSet)(object.endBlock) ? exports.RequestEndBlock.fromJSON(object.endBlock) : undefined, + commit: (0, helpers_1.isSet)(object.commit) ? exports.RequestCommit.fromJSON(object.commit) : undefined, + listSnapshots: (0, helpers_1.isSet)(object.listSnapshots) + ? exports.RequestListSnapshots.fromJSON(object.listSnapshots) + : undefined, + offerSnapshot: (0, helpers_1.isSet)(object.offerSnapshot) + ? exports.RequestOfferSnapshot.fromJSON(object.offerSnapshot) + : undefined, + loadSnapshotChunk: (0, helpers_1.isSet)(object.loadSnapshotChunk) + ? exports.RequestLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: (0, helpers_1.isSet)(object.applySnapshotChunk) + ? exports.RequestApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.echo !== undefined && (obj.echo = message.echo ? exports.RequestEcho.toJSON(message.echo) : undefined); + message.flush !== undefined && + (obj.flush = message.flush ? exports.RequestFlush.toJSON(message.flush) : undefined); + message.info !== undefined && (obj.info = message.info ? exports.RequestInfo.toJSON(message.info) : undefined); + message.setOption !== undefined && + (obj.setOption = message.setOption ? exports.RequestSetOption.toJSON(message.setOption) : undefined); + message.initChain !== undefined && + (obj.initChain = message.initChain ? exports.RequestInitChain.toJSON(message.initChain) : undefined); + message.query !== undefined && + (obj.query = message.query ? exports.RequestQuery.toJSON(message.query) : undefined); + message.beginBlock !== undefined && + (obj.beginBlock = message.beginBlock ? exports.RequestBeginBlock.toJSON(message.beginBlock) : undefined); + message.checkTx !== undefined && + (obj.checkTx = message.checkTx ? exports.RequestCheckTx.toJSON(message.checkTx) : undefined); + message.deliverTx !== undefined && + (obj.deliverTx = message.deliverTx ? exports.RequestDeliverTx.toJSON(message.deliverTx) : undefined); + message.endBlock !== undefined && + (obj.endBlock = message.endBlock ? exports.RequestEndBlock.toJSON(message.endBlock) : undefined); + message.commit !== undefined && + (obj.commit = message.commit ? exports.RequestCommit.toJSON(message.commit) : undefined); + message.listSnapshots !== undefined && + (obj.listSnapshots = message.listSnapshots + ? exports.RequestListSnapshots.toJSON(message.listSnapshots) + : undefined); + message.offerSnapshot !== undefined && + (obj.offerSnapshot = message.offerSnapshot + ? exports.RequestOfferSnapshot.toJSON(message.offerSnapshot) + : undefined); + message.loadSnapshotChunk !== undefined && + (obj.loadSnapshotChunk = message.loadSnapshotChunk + ? exports.RequestLoadSnapshotChunk.toJSON(message.loadSnapshotChunk) + : undefined); + message.applySnapshotChunk !== undefined && + (obj.applySnapshotChunk = message.applySnapshotChunk + ? exports.RequestApplySnapshotChunk.toJSON(message.applySnapshotChunk) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseRequest(); + message.echo = + object.echo !== undefined && object.echo !== null ? exports.RequestEcho.fromPartial(object.echo) : undefined; + message.flush = + object.flush !== undefined && object.flush !== null + ? exports.RequestFlush.fromPartial(object.flush) + : undefined; + message.info = + object.info !== undefined && object.info !== null ? exports.RequestInfo.fromPartial(object.info) : undefined; + message.setOption = + object.setOption !== undefined && object.setOption !== null + ? exports.RequestSetOption.fromPartial(object.setOption) + : undefined; + message.initChain = + object.initChain !== undefined && object.initChain !== null + ? exports.RequestInitChain.fromPartial(object.initChain) + : undefined; + message.query = + object.query !== undefined && object.query !== null + ? exports.RequestQuery.fromPartial(object.query) + : undefined; + message.beginBlock = + object.beginBlock !== undefined && object.beginBlock !== null + ? exports.RequestBeginBlock.fromPartial(object.beginBlock) + : undefined; + message.checkTx = + object.checkTx !== undefined && object.checkTx !== null + ? exports.RequestCheckTx.fromPartial(object.checkTx) + : undefined; + message.deliverTx = + object.deliverTx !== undefined && object.deliverTx !== null + ? exports.RequestDeliverTx.fromPartial(object.deliverTx) + : undefined; + message.endBlock = + object.endBlock !== undefined && object.endBlock !== null + ? exports.RequestEndBlock.fromPartial(object.endBlock) + : undefined; + message.commit = + object.commit !== undefined && object.commit !== null + ? exports.RequestCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = + object.listSnapshots !== undefined && object.listSnapshots !== null + ? exports.RequestListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = + object.offerSnapshot !== undefined && object.offerSnapshot !== null + ? exports.RequestOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = + object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null + ? exports.RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = + object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null + ? exports.RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + return message; + }, +}; +function createBaseRequestEcho() { + return { + message: "", + }; +} +exports.RequestEcho = { + encode(message, writer = _m0.Writer.create()) { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + message: (0, helpers_1.isSet)(object.message) ? String(object.message) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.message !== undefined && (obj.message = message.message); + return obj; + }, + fromPartial(object) { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, +}; +function createBaseRequestFlush() { + return {}; +} +exports.RequestFlush = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseRequestFlush(); + return message; + }, +}; +function createBaseRequestInfo() { + return { + version: "", + blockVersion: helpers_1.Long.UZERO, + p2pVersion: helpers_1.Long.UZERO, + }; +} +exports.RequestInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (!message.blockVersion.isZero()) { + writer.uint32(16).uint64(message.blockVersion); + } + if (!message.p2pVersion.isZero()) { + writer.uint32(24).uint64(message.p2pVersion); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.blockVersion = reader.uint64(); + break; + case 3: + message.p2pVersion = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + version: (0, helpers_1.isSet)(object.version) ? String(object.version) : "", + blockVersion: (0, helpers_1.isSet)(object.blockVersion) ? helpers_1.Long.fromValue(object.blockVersion) : helpers_1.Long.UZERO, + p2pVersion: (0, helpers_1.isSet)(object.p2pVersion) ? helpers_1.Long.fromValue(object.p2pVersion) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.version !== undefined && (obj.version = message.version); + message.blockVersion !== undefined && + (obj.blockVersion = (message.blockVersion || helpers_1.Long.UZERO).toString()); + message.p2pVersion !== undefined && (obj.p2pVersion = (message.p2pVersion || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.blockVersion = + object.blockVersion !== undefined && object.blockVersion !== null + ? helpers_1.Long.fromValue(object.blockVersion) + : helpers_1.Long.UZERO; + message.p2pVersion = + object.p2pVersion !== undefined && object.p2pVersion !== null + ? helpers_1.Long.fromValue(object.p2pVersion) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseRequestSetOption() { + return { + key: "", + value: "", + }; +} +exports.RequestSetOption = { + encode(message, writer = _m0.Writer.create()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestSetOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? String(object.key) : "", + value: (0, helpers_1.isSet)(object.value) ? String(object.value) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + fromPartial(object) { + const message = createBaseRequestSetOption(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; +function createBaseRequestInitChain() { + return { + time: undefined, + chainId: "", + consensusParams: undefined, + validators: [], + appStateBytes: new Uint8Array(), + initialHeight: helpers_1.Long.ZERO, + }; +} +exports.RequestInitChain = { + encode(message, writer = _m0.Writer.create()) { + if (message.time !== undefined) { + timestamp_1.Timestamp.encode(message.time, writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.consensusParams !== undefined) { + exports.ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.validators) { + exports.ValidatorUpdate.encode(v, writer.uint32(34).fork()).ldelim(); + } + if (message.appStateBytes.length !== 0) { + writer.uint32(42).bytes(message.appStateBytes); + } + if (!message.initialHeight.isZero()) { + writer.uint32(48).int64(message.initialHeight); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.time = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.chainId = reader.string(); + break; + case 3: + message.consensusParams = exports.ConsensusParams.decode(reader, reader.uint32()); + break; + case 4: + message.validators.push(exports.ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 5: + message.appStateBytes = reader.bytes(); + break; + case 6: + message.initialHeight = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + time: (0, helpers_1.isSet)(object.time) ? (0, helpers_1.fromJsonTimestamp)(object.time) : undefined, + chainId: (0, helpers_1.isSet)(object.chainId) ? String(object.chainId) : "", + consensusParams: (0, helpers_1.isSet)(object.consensusParams) + ? exports.ConsensusParams.fromJSON(object.consensusParams) + : undefined, + validators: Array.isArray(object?.validators) + ? object.validators.map((e) => exports.ValidatorUpdate.fromJSON(e)) + : [], + appStateBytes: (0, helpers_1.isSet)(object.appStateBytes) ? (0, helpers_1.bytesFromBase64)(object.appStateBytes) : new Uint8Array(), + initialHeight: (0, helpers_1.isSet)(object.initialHeight) ? helpers_1.Long.fromValue(object.initialHeight) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.time !== undefined && (obj.time = (0, helpers_1.fromTimestamp)(message.time).toISOString()); + message.chainId !== undefined && (obj.chainId = message.chainId); + message.consensusParams !== undefined && + (obj.consensusParams = message.consensusParams + ? exports.ConsensusParams.toJSON(message.consensusParams) + : undefined); + if (message.validators) { + obj.validators = message.validators.map((e) => (e ? exports.ValidatorUpdate.toJSON(e) : undefined)); + } + else { + obj.validators = []; + } + message.appStateBytes !== undefined && + (obj.appStateBytes = (0, helpers_1.base64FromBytes)(message.appStateBytes !== undefined ? message.appStateBytes : new Uint8Array())); + message.initialHeight !== undefined && + (obj.initialHeight = (message.initialHeight || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseRequestInitChain(); + message.time = + object.time !== undefined && object.time !== null ? timestamp_1.Timestamp.fromPartial(object.time) : undefined; + message.chainId = object.chainId ?? ""; + message.consensusParams = + object.consensusParams !== undefined && object.consensusParams !== null + ? exports.ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = object.validators?.map((e) => exports.ValidatorUpdate.fromPartial(e)) || []; + message.appStateBytes = object.appStateBytes ?? new Uint8Array(); + message.initialHeight = + object.initialHeight !== undefined && object.initialHeight !== null + ? helpers_1.Long.fromValue(object.initialHeight) + : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseRequestQuery() { + return { + data: new Uint8Array(), + path: "", + height: helpers_1.Long.ZERO, + prove: false, + }; +} +exports.RequestQuery = { + encode(message, writer = _m0.Writer.create()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (!message.height.isZero()) { + writer.uint32(24).int64(message.height); + } + if (message.prove === true) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + case 2: + message.path = reader.string(); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + data: (0, helpers_1.isSet)(object.data) ? (0, helpers_1.bytesFromBase64)(object.data) : new Uint8Array(), + path: (0, helpers_1.isSet)(object.path) ? String(object.path) : "", + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + prove: (0, helpers_1.isSet)(object.prove) ? Boolean(object.prove) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.data !== undefined && + (obj.data = (0, helpers_1.base64FromBytes)(message.data !== undefined ? message.data : new Uint8Array())); + message.path !== undefined && (obj.path = message.path); + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + message.prove !== undefined && (obj.prove = message.prove); + return obj; + }, + fromPartial(object) { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(); + message.path = object.path ?? ""; + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + message.prove = object.prove ?? false; + return message; + }, +}; +function createBaseRequestBeginBlock() { + return { + hash: new Uint8Array(), + header: undefined, + lastCommitInfo: undefined, + byzantineValidators: [], + }; +} +exports.RequestBeginBlock = { + encode(message, writer = _m0.Writer.create()) { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.header !== undefined) { + types_1.Header.encode(message.header, writer.uint32(18).fork()).ldelim(); + } + if (message.lastCommitInfo !== undefined) { + exports.LastCommitInfo.encode(message.lastCommitInfo, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.byzantineValidators) { + exports.Evidence.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestBeginBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.header = types_1.Header.decode(reader, reader.uint32()); + break; + case 3: + message.lastCommitInfo = exports.LastCommitInfo.decode(reader, reader.uint32()); + break; + case 4: + message.byzantineValidators.push(exports.Evidence.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + hash: (0, helpers_1.isSet)(object.hash) ? (0, helpers_1.bytesFromBase64)(object.hash) : new Uint8Array(), + header: (0, helpers_1.isSet)(object.header) ? types_1.Header.fromJSON(object.header) : undefined, + lastCommitInfo: (0, helpers_1.isSet)(object.lastCommitInfo) + ? exports.LastCommitInfo.fromJSON(object.lastCommitInfo) + : undefined, + byzantineValidators: Array.isArray(object?.byzantineValidators) + ? object.byzantineValidators.map((e) => exports.Evidence.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.hash !== undefined && + (obj.hash = (0, helpers_1.base64FromBytes)(message.hash !== undefined ? message.hash : new Uint8Array())); + message.header !== undefined && (obj.header = message.header ? types_1.Header.toJSON(message.header) : undefined); + message.lastCommitInfo !== undefined && + (obj.lastCommitInfo = message.lastCommitInfo + ? exports.LastCommitInfo.toJSON(message.lastCommitInfo) + : undefined); + if (message.byzantineValidators) { + obj.byzantineValidators = message.byzantineValidators.map((e) => (e ? exports.Evidence.toJSON(e) : undefined)); + } + else { + obj.byzantineValidators = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseRequestBeginBlock(); + message.hash = object.hash ?? new Uint8Array(); + message.header = + object.header !== undefined && object.header !== null ? types_1.Header.fromPartial(object.header) : undefined; + message.lastCommitInfo = + object.lastCommitInfo !== undefined && object.lastCommitInfo !== null + ? exports.LastCommitInfo.fromPartial(object.lastCommitInfo) + : undefined; + message.byzantineValidators = object.byzantineValidators?.map((e) => exports.Evidence.fromPartial(e)) || []; + return message; + }, +}; +function createBaseRequestCheckTx() { + return { + tx: new Uint8Array(), + type: 0, + }; +} +exports.RequestCheckTx = { + encode(message, writer = _m0.Writer.create()) { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = reader.bytes(); + break; + case 2: + message.type = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + tx: (0, helpers_1.isSet)(object.tx) ? (0, helpers_1.bytesFromBase64)(object.tx) : new Uint8Array(), + type: (0, helpers_1.isSet)(object.type) ? checkTxTypeFromJSON(object.type) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.tx !== undefined && + (obj.tx = (0, helpers_1.base64FromBytes)(message.tx !== undefined ? message.tx : new Uint8Array())); + message.type !== undefined && (obj.type = checkTxTypeToJSON(message.type)); + return obj; + }, + fromPartial(object) { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(); + message.type = object.type ?? 0; + return message; + }, +}; +function createBaseRequestDeliverTx() { + return { + tx: new Uint8Array(), + }; +} +exports.RequestDeliverTx = { + encode(message, writer = _m0.Writer.create()) { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDeliverTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + tx: (0, helpers_1.isSet)(object.tx) ? (0, helpers_1.bytesFromBase64)(object.tx) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.tx !== undefined && + (obj.tx = (0, helpers_1.base64FromBytes)(message.tx !== undefined ? message.tx : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseRequestDeliverTx(); + message.tx = object.tx ?? new Uint8Array(); + return message; + }, +}; +function createBaseRequestEndBlock() { + return { + height: helpers_1.Long.ZERO, + }; +} +exports.RequestEndBlock = { + encode(message, writer = _m0.Writer.create()) { + if (!message.height.isZero()) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEndBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseRequestEndBlock(); + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseRequestCommit() { + return {}; +} +exports.RequestCommit = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseRequestCommit(); + return message; + }, +}; +function createBaseRequestListSnapshots() { + return {}; +} +exports.RequestListSnapshots = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseRequestListSnapshots(); + return message; + }, +}; +function createBaseRequestOfferSnapshot() { + return { + snapshot: undefined, + appHash: new Uint8Array(), + }; +} +exports.RequestOfferSnapshot = { + encode(message, writer = _m0.Writer.create()) { + if (message.snapshot !== undefined) { + exports.Snapshot.encode(message.snapshot, writer.uint32(10).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(18).bytes(message.appHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.snapshot = exports.Snapshot.decode(reader, reader.uint32()); + break; + case 2: + message.appHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + snapshot: (0, helpers_1.isSet)(object.snapshot) ? exports.Snapshot.fromJSON(object.snapshot) : undefined, + appHash: (0, helpers_1.isSet)(object.appHash) ? (0, helpers_1.bytesFromBase64)(object.appHash) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.snapshot !== undefined && + (obj.snapshot = message.snapshot ? exports.Snapshot.toJSON(message.snapshot) : undefined); + message.appHash !== undefined && + (obj.appHash = (0, helpers_1.base64FromBytes)(message.appHash !== undefined ? message.appHash : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = + object.snapshot !== undefined && object.snapshot !== null + ? exports.Snapshot.fromPartial(object.snapshot) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(); + return message; + }, +}; +function createBaseRequestLoadSnapshotChunk() { + return { + height: helpers_1.Long.UZERO, + format: 0, + chunk: 0, + }; +} +exports.RequestLoadSnapshotChunk = { + encode(message, writer = _m0.Writer.create()) { + if (!message.height.isZero()) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunk !== 0) { + writer.uint32(24).uint32(message.chunk); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunk = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.UZERO, + format: (0, helpers_1.isSet)(object.format) ? Number(object.format) : 0, + chunk: (0, helpers_1.isSet)(object.chunk) ? Number(object.chunk) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.UZERO).toString()); + message.format !== undefined && (obj.format = Math.round(message.format)); + message.chunk !== undefined && (obj.chunk = Math.round(message.chunk)); + return obj; + }, + fromPartial(object) { + const message = createBaseRequestLoadSnapshotChunk(); + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.UZERO; + message.format = object.format ?? 0; + message.chunk = object.chunk ?? 0; + return message; + }, +}; +function createBaseRequestApplySnapshotChunk() { + return { + index: 0, + chunk: new Uint8Array(), + sender: "", + }; +} +exports.RequestApplySnapshotChunk = { + encode(message, writer = _m0.Writer.create()) { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(18).bytes(message.chunk); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.uint32(); + break; + case 2: + message.chunk = reader.bytes(); + break; + case 3: + message.sender = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + index: (0, helpers_1.isSet)(object.index) ? Number(object.index) : 0, + chunk: (0, helpers_1.isSet)(object.chunk) ? (0, helpers_1.bytesFromBase64)(object.chunk) : new Uint8Array(), + sender: (0, helpers_1.isSet)(object.sender) ? String(object.sender) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.index !== undefined && (obj.index = Math.round(message.index)); + message.chunk !== undefined && + (obj.chunk = (0, helpers_1.base64FromBytes)(message.chunk !== undefined ? message.chunk : new Uint8Array())); + message.sender !== undefined && (obj.sender = message.sender); + return obj; + }, + fromPartial(object) { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(); + message.sender = object.sender ?? ""; + return message; + }, +}; +function createBaseResponse() { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + setOption: undefined, + initChain: undefined, + query: undefined, + beginBlock: undefined, + checkTx: undefined, + deliverTx: undefined, + endBlock: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + }; +} +exports.Response = { + encode(message, writer = _m0.Writer.create()) { + if (message.exception !== undefined) { + exports.ResponseException.encode(message.exception, writer.uint32(10).fork()).ldelim(); + } + if (message.echo !== undefined) { + exports.ResponseEcho.encode(message.echo, writer.uint32(18).fork()).ldelim(); + } + if (message.flush !== undefined) { + exports.ResponseFlush.encode(message.flush, writer.uint32(26).fork()).ldelim(); + } + if (message.info !== undefined) { + exports.ResponseInfo.encode(message.info, writer.uint32(34).fork()).ldelim(); + } + if (message.setOption !== undefined) { + exports.ResponseSetOption.encode(message.setOption, writer.uint32(42).fork()).ldelim(); + } + if (message.initChain !== undefined) { + exports.ResponseInitChain.encode(message.initChain, writer.uint32(50).fork()).ldelim(); + } + if (message.query !== undefined) { + exports.ResponseQuery.encode(message.query, writer.uint32(58).fork()).ldelim(); + } + if (message.beginBlock !== undefined) { + exports.ResponseBeginBlock.encode(message.beginBlock, writer.uint32(66).fork()).ldelim(); + } + if (message.checkTx !== undefined) { + exports.ResponseCheckTx.encode(message.checkTx, writer.uint32(74).fork()).ldelim(); + } + if (message.deliverTx !== undefined) { + exports.ResponseDeliverTx.encode(message.deliverTx, writer.uint32(82).fork()).ldelim(); + } + if (message.endBlock !== undefined) { + exports.ResponseEndBlock.encode(message.endBlock, writer.uint32(90).fork()).ldelim(); + } + if (message.commit !== undefined) { + exports.ResponseCommit.encode(message.commit, writer.uint32(98).fork()).ldelim(); + } + if (message.listSnapshots !== undefined) { + exports.ResponseListSnapshots.encode(message.listSnapshots, writer.uint32(106).fork()).ldelim(); + } + if (message.offerSnapshot !== undefined) { + exports.ResponseOfferSnapshot.encode(message.offerSnapshot, writer.uint32(114).fork()).ldelim(); + } + if (message.loadSnapshotChunk !== undefined) { + exports.ResponseLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(122).fork()).ldelim(); + } + if (message.applySnapshotChunk !== undefined) { + exports.ResponseApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(130).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exception = exports.ResponseException.decode(reader, reader.uint32()); + break; + case 2: + message.echo = exports.ResponseEcho.decode(reader, reader.uint32()); + break; + case 3: + message.flush = exports.ResponseFlush.decode(reader, reader.uint32()); + break; + case 4: + message.info = exports.ResponseInfo.decode(reader, reader.uint32()); + break; + case 5: + message.setOption = exports.ResponseSetOption.decode(reader, reader.uint32()); + break; + case 6: + message.initChain = exports.ResponseInitChain.decode(reader, reader.uint32()); + break; + case 7: + message.query = exports.ResponseQuery.decode(reader, reader.uint32()); + break; + case 8: + message.beginBlock = exports.ResponseBeginBlock.decode(reader, reader.uint32()); + break; + case 9: + message.checkTx = exports.ResponseCheckTx.decode(reader, reader.uint32()); + break; + case 10: + message.deliverTx = exports.ResponseDeliverTx.decode(reader, reader.uint32()); + break; + case 11: + message.endBlock = exports.ResponseEndBlock.decode(reader, reader.uint32()); + break; + case 12: + message.commit = exports.ResponseCommit.decode(reader, reader.uint32()); + break; + case 13: + message.listSnapshots = exports.ResponseListSnapshots.decode(reader, reader.uint32()); + break; + case 14: + message.offerSnapshot = exports.ResponseOfferSnapshot.decode(reader, reader.uint32()); + break; + case 15: + message.loadSnapshotChunk = exports.ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + break; + case 16: + message.applySnapshotChunk = exports.ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + exception: (0, helpers_1.isSet)(object.exception) ? exports.ResponseException.fromJSON(object.exception) : undefined, + echo: (0, helpers_1.isSet)(object.echo) ? exports.ResponseEcho.fromJSON(object.echo) : undefined, + flush: (0, helpers_1.isSet)(object.flush) ? exports.ResponseFlush.fromJSON(object.flush) : undefined, + info: (0, helpers_1.isSet)(object.info) ? exports.ResponseInfo.fromJSON(object.info) : undefined, + setOption: (0, helpers_1.isSet)(object.setOption) ? exports.ResponseSetOption.fromJSON(object.setOption) : undefined, + initChain: (0, helpers_1.isSet)(object.initChain) ? exports.ResponseInitChain.fromJSON(object.initChain) : undefined, + query: (0, helpers_1.isSet)(object.query) ? exports.ResponseQuery.fromJSON(object.query) : undefined, + beginBlock: (0, helpers_1.isSet)(object.beginBlock) ? exports.ResponseBeginBlock.fromJSON(object.beginBlock) : undefined, + checkTx: (0, helpers_1.isSet)(object.checkTx) ? exports.ResponseCheckTx.fromJSON(object.checkTx) : undefined, + deliverTx: (0, helpers_1.isSet)(object.deliverTx) ? exports.ResponseDeliverTx.fromJSON(object.deliverTx) : undefined, + endBlock: (0, helpers_1.isSet)(object.endBlock) ? exports.ResponseEndBlock.fromJSON(object.endBlock) : undefined, + commit: (0, helpers_1.isSet)(object.commit) ? exports.ResponseCommit.fromJSON(object.commit) : undefined, + listSnapshots: (0, helpers_1.isSet)(object.listSnapshots) + ? exports.ResponseListSnapshots.fromJSON(object.listSnapshots) + : undefined, + offerSnapshot: (0, helpers_1.isSet)(object.offerSnapshot) + ? exports.ResponseOfferSnapshot.fromJSON(object.offerSnapshot) + : undefined, + loadSnapshotChunk: (0, helpers_1.isSet)(object.loadSnapshotChunk) + ? exports.ResponseLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: (0, helpers_1.isSet)(object.applySnapshotChunk) + ? exports.ResponseApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.exception !== undefined && + (obj.exception = message.exception ? exports.ResponseException.toJSON(message.exception) : undefined); + message.echo !== undefined && (obj.echo = message.echo ? exports.ResponseEcho.toJSON(message.echo) : undefined); + message.flush !== undefined && + (obj.flush = message.flush ? exports.ResponseFlush.toJSON(message.flush) : undefined); + message.info !== undefined && (obj.info = message.info ? exports.ResponseInfo.toJSON(message.info) : undefined); + message.setOption !== undefined && + (obj.setOption = message.setOption ? exports.ResponseSetOption.toJSON(message.setOption) : undefined); + message.initChain !== undefined && + (obj.initChain = message.initChain ? exports.ResponseInitChain.toJSON(message.initChain) : undefined); + message.query !== undefined && + (obj.query = message.query ? exports.ResponseQuery.toJSON(message.query) : undefined); + message.beginBlock !== undefined && + (obj.beginBlock = message.beginBlock ? exports.ResponseBeginBlock.toJSON(message.beginBlock) : undefined); + message.checkTx !== undefined && + (obj.checkTx = message.checkTx ? exports.ResponseCheckTx.toJSON(message.checkTx) : undefined); + message.deliverTx !== undefined && + (obj.deliverTx = message.deliverTx ? exports.ResponseDeliverTx.toJSON(message.deliverTx) : undefined); + message.endBlock !== undefined && + (obj.endBlock = message.endBlock ? exports.ResponseEndBlock.toJSON(message.endBlock) : undefined); + message.commit !== undefined && + (obj.commit = message.commit ? exports.ResponseCommit.toJSON(message.commit) : undefined); + message.listSnapshots !== undefined && + (obj.listSnapshots = message.listSnapshots + ? exports.ResponseListSnapshots.toJSON(message.listSnapshots) + : undefined); + message.offerSnapshot !== undefined && + (obj.offerSnapshot = message.offerSnapshot + ? exports.ResponseOfferSnapshot.toJSON(message.offerSnapshot) + : undefined); + message.loadSnapshotChunk !== undefined && + (obj.loadSnapshotChunk = message.loadSnapshotChunk + ? exports.ResponseLoadSnapshotChunk.toJSON(message.loadSnapshotChunk) + : undefined); + message.applySnapshotChunk !== undefined && + (obj.applySnapshotChunk = message.applySnapshotChunk + ? exports.ResponseApplySnapshotChunk.toJSON(message.applySnapshotChunk) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseResponse(); + message.exception = + object.exception !== undefined && object.exception !== null + ? exports.ResponseException.fromPartial(object.exception) + : undefined; + message.echo = + object.echo !== undefined && object.echo !== null ? exports.ResponseEcho.fromPartial(object.echo) : undefined; + message.flush = + object.flush !== undefined && object.flush !== null + ? exports.ResponseFlush.fromPartial(object.flush) + : undefined; + message.info = + object.info !== undefined && object.info !== null ? exports.ResponseInfo.fromPartial(object.info) : undefined; + message.setOption = + object.setOption !== undefined && object.setOption !== null + ? exports.ResponseSetOption.fromPartial(object.setOption) + : undefined; + message.initChain = + object.initChain !== undefined && object.initChain !== null + ? exports.ResponseInitChain.fromPartial(object.initChain) + : undefined; + message.query = + object.query !== undefined && object.query !== null + ? exports.ResponseQuery.fromPartial(object.query) + : undefined; + message.beginBlock = + object.beginBlock !== undefined && object.beginBlock !== null + ? exports.ResponseBeginBlock.fromPartial(object.beginBlock) + : undefined; + message.checkTx = + object.checkTx !== undefined && object.checkTx !== null + ? exports.ResponseCheckTx.fromPartial(object.checkTx) + : undefined; + message.deliverTx = + object.deliverTx !== undefined && object.deliverTx !== null + ? exports.ResponseDeliverTx.fromPartial(object.deliverTx) + : undefined; + message.endBlock = + object.endBlock !== undefined && object.endBlock !== null + ? exports.ResponseEndBlock.fromPartial(object.endBlock) + : undefined; + message.commit = + object.commit !== undefined && object.commit !== null + ? exports.ResponseCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = + object.listSnapshots !== undefined && object.listSnapshots !== null + ? exports.ResponseListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = + object.offerSnapshot !== undefined && object.offerSnapshot !== null + ? exports.ResponseOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = + object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null + ? exports.ResponseLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = + object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null + ? exports.ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + return message; + }, +}; +function createBaseResponseException() { + return { + error: "", + }; +} +exports.ResponseException = { + encode(message, writer = _m0.Writer.create()) { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseException(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.error = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + error: (0, helpers_1.isSet)(object.error) ? String(object.error) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.error !== undefined && (obj.error = message.error); + return obj; + }, + fromPartial(object) { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, +}; +function createBaseResponseEcho() { + return { + message: "", + }; +} +exports.ResponseEcho = { + encode(message, writer = _m0.Writer.create()) { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + message: (0, helpers_1.isSet)(object.message) ? String(object.message) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.message !== undefined && (obj.message = message.message); + return obj; + }, + fromPartial(object) { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, +}; +function createBaseResponseFlush() { + return {}; +} +exports.ResponseFlush = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + fromPartial(_) { + const message = createBaseResponseFlush(); + return message; + }, +}; +function createBaseResponseInfo() { + return { + data: "", + version: "", + appVersion: helpers_1.Long.UZERO, + lastBlockHeight: helpers_1.Long.ZERO, + lastBlockAppHash: new Uint8Array(), + }; +} +exports.ResponseInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (!message.appVersion.isZero()) { + writer.uint32(24).uint64(message.appVersion); + } + if (!message.lastBlockHeight.isZero()) { + writer.uint32(32).int64(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + writer.uint32(42).bytes(message.lastBlockAppHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.string(); + break; + case 2: + message.version = reader.string(); + break; + case 3: + message.appVersion = reader.uint64(); + break; + case 4: + message.lastBlockHeight = reader.int64(); + break; + case 5: + message.lastBlockAppHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + data: (0, helpers_1.isSet)(object.data) ? String(object.data) : "", + version: (0, helpers_1.isSet)(object.version) ? String(object.version) : "", + appVersion: (0, helpers_1.isSet)(object.appVersion) ? helpers_1.Long.fromValue(object.appVersion) : helpers_1.Long.UZERO, + lastBlockHeight: (0, helpers_1.isSet)(object.lastBlockHeight) ? helpers_1.Long.fromValue(object.lastBlockHeight) : helpers_1.Long.ZERO, + lastBlockAppHash: (0, helpers_1.isSet)(object.lastBlockAppHash) + ? (0, helpers_1.bytesFromBase64)(object.lastBlockAppHash) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.data !== undefined && (obj.data = message.data); + message.version !== undefined && (obj.version = message.version); + message.appVersion !== undefined && (obj.appVersion = (message.appVersion || helpers_1.Long.UZERO).toString()); + message.lastBlockHeight !== undefined && + (obj.lastBlockHeight = (message.lastBlockHeight || helpers_1.Long.ZERO).toString()); + message.lastBlockAppHash !== undefined && + (obj.lastBlockAppHash = (0, helpers_1.base64FromBytes)(message.lastBlockAppHash !== undefined ? message.lastBlockAppHash : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.appVersion = + object.appVersion !== undefined && object.appVersion !== null + ? helpers_1.Long.fromValue(object.appVersion) + : helpers_1.Long.UZERO; + message.lastBlockHeight = + object.lastBlockHeight !== undefined && object.lastBlockHeight !== null + ? helpers_1.Long.fromValue(object.lastBlockHeight) + : helpers_1.Long.ZERO; + message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(); + return message; + }, +}; +function createBaseResponseSetOption() { + return { + code: 0, + log: "", + info: "", + }; +} +exports.ResponseSetOption = { + encode(message, writer = _m0.Writer.create()) { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseSetOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + code: (0, helpers_1.isSet)(object.code) ? Number(object.code) : 0, + log: (0, helpers_1.isSet)(object.log) ? String(object.log) : "", + info: (0, helpers_1.isSet)(object.info) ? String(object.info) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + return obj; + }, + fromPartial(object) { + const message = createBaseResponseSetOption(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + return message; + }, +}; +function createBaseResponseInitChain() { + return { + consensusParams: undefined, + validators: [], + appHash: new Uint8Array(), + }; +} +exports.ResponseInitChain = { + encode(message, writer = _m0.Writer.create()) { + if (message.consensusParams !== undefined) { + exports.ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.validators) { + exports.ValidatorUpdate.encode(v, writer.uint32(18).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(26).bytes(message.appHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusParams = exports.ConsensusParams.decode(reader, reader.uint32()); + break; + case 2: + message.validators.push(exports.ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 3: + message.appHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + consensusParams: (0, helpers_1.isSet)(object.consensusParams) + ? exports.ConsensusParams.fromJSON(object.consensusParams) + : undefined, + validators: Array.isArray(object?.validators) + ? object.validators.map((e) => exports.ValidatorUpdate.fromJSON(e)) + : [], + appHash: (0, helpers_1.isSet)(object.appHash) ? (0, helpers_1.bytesFromBase64)(object.appHash) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.consensusParams !== undefined && + (obj.consensusParams = message.consensusParams + ? exports.ConsensusParams.toJSON(message.consensusParams) + : undefined); + if (message.validators) { + obj.validators = message.validators.map((e) => (e ? exports.ValidatorUpdate.toJSON(e) : undefined)); + } + else { + obj.validators = []; + } + message.appHash !== undefined && + (obj.appHash = (0, helpers_1.base64FromBytes)(message.appHash !== undefined ? message.appHash : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseResponseInitChain(); + message.consensusParams = + object.consensusParams !== undefined && object.consensusParams !== null + ? exports.ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = object.validators?.map((e) => exports.ValidatorUpdate.fromPartial(e)) || []; + message.appHash = object.appHash ?? new Uint8Array(); + return message; + }, +}; +function createBaseResponseQuery() { + return { + code: 0, + log: "", + info: "", + index: helpers_1.Long.ZERO, + key: new Uint8Array(), + value: new Uint8Array(), + proofOps: undefined, + height: helpers_1.Long.ZERO, + codespace: "", + }; +} +exports.ResponseQuery = { + encode(message, writer = _m0.Writer.create()) { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (!message.index.isZero()) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + proof_1.ProofOps.encode(message.proofOps, writer.uint32(66).fork()).ldelim(); + } + if (!message.height.isZero()) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.index = reader.int64(); + break; + case 6: + message.key = reader.bytes(); + break; + case 7: + message.value = reader.bytes(); + break; + case 8: + message.proofOps = proof_1.ProofOps.decode(reader, reader.uint32()); + break; + case 9: + message.height = reader.int64(); + break; + case 10: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + code: (0, helpers_1.isSet)(object.code) ? Number(object.code) : 0, + log: (0, helpers_1.isSet)(object.log) ? String(object.log) : "", + info: (0, helpers_1.isSet)(object.info) ? String(object.info) : "", + index: (0, helpers_1.isSet)(object.index) ? helpers_1.Long.fromValue(object.index) : helpers_1.Long.ZERO, + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + value: (0, helpers_1.isSet)(object.value) ? (0, helpers_1.bytesFromBase64)(object.value) : new Uint8Array(), + proofOps: (0, helpers_1.isSet)(object.proofOps) ? proof_1.ProofOps.fromJSON(object.proofOps) : undefined, + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + codespace: (0, helpers_1.isSet)(object.codespace) ? String(object.codespace) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.index !== undefined && (obj.index = (message.index || helpers_1.Long.ZERO).toString()); + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = (0, helpers_1.base64FromBytes)(message.value !== undefined ? message.value : new Uint8Array())); + message.proofOps !== undefined && + (obj.proofOps = message.proofOps ? proof_1.ProofOps.toJSON(message.proofOps) : undefined); + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + fromPartial(object) { + const message = createBaseResponseQuery(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = + object.index !== undefined && object.index !== null ? helpers_1.Long.fromValue(object.index) : helpers_1.Long.ZERO; + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.proofOps = + object.proofOps !== undefined && object.proofOps !== null + ? proof_1.ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + message.codespace = object.codespace ?? ""; + return message; + }, +}; +function createBaseResponseBeginBlock() { + return { + events: [], + }; +} +exports.ResponseBeginBlock = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.events) { + exports.Event.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseBeginBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.events.push(exports.Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + events: Array.isArray(object?.events) ? object.events.map((e) => exports.Event.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.events) { + obj.events = message.events.map((e) => (e ? exports.Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseResponseBeginBlock(); + message.events = object.events?.map((e) => exports.Event.fromPartial(e)) || []; + return message; + }, +}; +function createBaseResponseCheckTx() { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gasWanted: helpers_1.Long.ZERO, + gasUsed: helpers_1.Long.ZERO, + events: [], + codespace: "", + sender: "", + priority: helpers_1.Long.ZERO, + mempoolError: "", + }; +} +exports.ResponseCheckTx = { + encode(message, writer = _m0.Writer.create()) { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (!message.gasWanted.isZero()) { + writer.uint32(40).int64(message.gasWanted); + } + if (!message.gasUsed.isZero()) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + exports.Event.encode(v, writer.uint32(58).fork()).ldelim(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + if (message.sender !== "") { + writer.uint32(74).string(message.sender); + } + if (!message.priority.isZero()) { + writer.uint32(80).int64(message.priority); + } + if (message.mempoolError !== "") { + writer.uint32(90).string(message.mempoolError); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.gasWanted = reader.int64(); + break; + case 6: + message.gasUsed = reader.int64(); + break; + case 7: + message.events.push(exports.Event.decode(reader, reader.uint32())); + break; + case 8: + message.codespace = reader.string(); + break; + case 9: + message.sender = reader.string(); + break; + case 10: + message.priority = reader.int64(); + break; + case 11: + message.mempoolError = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + code: (0, helpers_1.isSet)(object.code) ? Number(object.code) : 0, + data: (0, helpers_1.isSet)(object.data) ? (0, helpers_1.bytesFromBase64)(object.data) : new Uint8Array(), + log: (0, helpers_1.isSet)(object.log) ? String(object.log) : "", + info: (0, helpers_1.isSet)(object.info) ? String(object.info) : "", + gasWanted: (0, helpers_1.isSet)(object.gas_wanted) ? helpers_1.Long.fromValue(object.gas_wanted) : helpers_1.Long.ZERO, + gasUsed: (0, helpers_1.isSet)(object.gas_used) ? helpers_1.Long.fromValue(object.gas_used) : helpers_1.Long.ZERO, + events: Array.isArray(object?.events) ? object.events.map((e) => exports.Event.fromJSON(e)) : [], + codespace: (0, helpers_1.isSet)(object.codespace) ? String(object.codespace) : "", + sender: (0, helpers_1.isSet)(object.sender) ? String(object.sender) : "", + priority: (0, helpers_1.isSet)(object.priority) ? helpers_1.Long.fromValue(object.priority) : helpers_1.Long.ZERO, + mempoolError: (0, helpers_1.isSet)(object.mempoolError) ? String(object.mempoolError) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && + (obj.data = (0, helpers_1.base64FromBytes)(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.gasWanted !== undefined && (obj.gas_wanted = (message.gasWanted || helpers_1.Long.ZERO).toString()); + message.gasUsed !== undefined && (obj.gas_used = (message.gasUsed || helpers_1.Long.ZERO).toString()); + if (message.events) { + obj.events = message.events.map((e) => (e ? exports.Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + message.codespace !== undefined && (obj.codespace = message.codespace); + message.sender !== undefined && (obj.sender = message.sender); + message.priority !== undefined && (obj.priority = (message.priority || helpers_1.Long.ZERO).toString()); + message.mempoolError !== undefined && (obj.mempoolError = message.mempoolError); + return obj; + }, + fromPartial(object) { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = + object.gasWanted !== undefined && object.gasWanted !== null + ? helpers_1.Long.fromValue(object.gasWanted) + : helpers_1.Long.ZERO; + message.gasUsed = + object.gasUsed !== undefined && object.gasUsed !== null ? helpers_1.Long.fromValue(object.gasUsed) : helpers_1.Long.ZERO; + message.events = object.events?.map((e) => exports.Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + message.sender = object.sender ?? ""; + message.priority = + object.priority !== undefined && object.priority !== null ? helpers_1.Long.fromValue(object.priority) : helpers_1.Long.ZERO; + message.mempoolError = object.mempoolError ?? ""; + return message; + }, +}; +function createBaseResponseDeliverTx() { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gasWanted: helpers_1.Long.ZERO, + gasUsed: helpers_1.Long.ZERO, + events: [], + codespace: "", + }; +} +exports.ResponseDeliverTx = { + encode(message, writer = _m0.Writer.create()) { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (!message.gasWanted.isZero()) { + writer.uint32(40).int64(message.gasWanted); + } + if (!message.gasUsed.isZero()) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + exports.Event.encode(v, writer.uint32(58).fork()).ldelim(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseDeliverTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.gasWanted = reader.int64(); + break; + case 6: + message.gasUsed = reader.int64(); + break; + case 7: + message.events.push(exports.Event.decode(reader, reader.uint32())); + break; + case 8: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + code: (0, helpers_1.isSet)(object.code) ? Number(object.code) : 0, + data: (0, helpers_1.isSet)(object.data) ? (0, helpers_1.bytesFromBase64)(object.data) : new Uint8Array(), + log: (0, helpers_1.isSet)(object.log) ? String(object.log) : "", + info: (0, helpers_1.isSet)(object.info) ? String(object.info) : "", + gasWanted: (0, helpers_1.isSet)(object.gas_wanted) ? helpers_1.Long.fromValue(object.gas_wanted) : helpers_1.Long.ZERO, + gasUsed: (0, helpers_1.isSet)(object.gas_used) ? helpers_1.Long.fromValue(object.gas_used) : helpers_1.Long.ZERO, + events: Array.isArray(object?.events) ? object.events.map((e) => exports.Event.fromJSON(e)) : [], + codespace: (0, helpers_1.isSet)(object.codespace) ? String(object.codespace) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && + (obj.data = (0, helpers_1.base64FromBytes)(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.gasWanted !== undefined && (obj.gas_wanted = (message.gasWanted || helpers_1.Long.ZERO).toString()); + message.gasUsed !== undefined && (obj.gas_used = (message.gasUsed || helpers_1.Long.ZERO).toString()); + if (message.events) { + obj.events = message.events.map((e) => (e ? exports.Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + fromPartial(object) { + const message = createBaseResponseDeliverTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = + object.gasWanted !== undefined && object.gasWanted !== null + ? helpers_1.Long.fromValue(object.gasWanted) + : helpers_1.Long.ZERO; + message.gasUsed = + object.gasUsed !== undefined && object.gasUsed !== null ? helpers_1.Long.fromValue(object.gasUsed) : helpers_1.Long.ZERO; + message.events = object.events?.map((e) => exports.Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; +function createBaseResponseEndBlock() { + return { + validatorUpdates: [], + consensusParamUpdates: undefined, + events: [], + }; +} +exports.ResponseEndBlock = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.validatorUpdates) { + exports.ValidatorUpdate.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.consensusParamUpdates !== undefined) { + exports.ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.events) { + exports.Event.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEndBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorUpdates.push(exports.ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 2: + message.consensusParamUpdates = exports.ConsensusParams.decode(reader, reader.uint32()); + break; + case 3: + message.events.push(exports.Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validatorUpdates: Array.isArray(object?.validatorUpdates) + ? object.validatorUpdates.map((e) => exports.ValidatorUpdate.fromJSON(e)) + : [], + consensusParamUpdates: (0, helpers_1.isSet)(object.consensusParamUpdates) + ? exports.ConsensusParams.fromJSON(object.consensusParamUpdates) + : undefined, + events: Array.isArray(object?.events) ? object.events.map((e) => exports.Event.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.validatorUpdates) { + obj.validatorUpdates = message.validatorUpdates.map((e) => (e ? exports.ValidatorUpdate.toJSON(e) : undefined)); + } + else { + obj.validatorUpdates = []; + } + message.consensusParamUpdates !== undefined && + (obj.consensusParamUpdates = message.consensusParamUpdates + ? exports.ConsensusParams.toJSON(message.consensusParamUpdates) + : undefined); + if (message.events) { + obj.events = message.events.map((e) => (e ? exports.Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseResponseEndBlock(); + message.validatorUpdates = object.validatorUpdates?.map((e) => exports.ValidatorUpdate.fromPartial(e)) || []; + message.consensusParamUpdates = + object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null + ? exports.ConsensusParams.fromPartial(object.consensusParamUpdates) + : undefined; + message.events = object.events?.map((e) => exports.Event.fromPartial(e)) || []; + return message; + }, +}; +function createBaseResponseCommit() { + return { + data: new Uint8Array(), + retainHeight: helpers_1.Long.ZERO, + }; +} +exports.ResponseCommit = { + encode(message, writer = _m0.Writer.create()) { + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (!message.retainHeight.isZero()) { + writer.uint32(24).int64(message.retainHeight); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.data = reader.bytes(); + break; + case 3: + message.retainHeight = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + data: (0, helpers_1.isSet)(object.data) ? (0, helpers_1.bytesFromBase64)(object.data) : new Uint8Array(), + retainHeight: (0, helpers_1.isSet)(object.retainHeight) ? helpers_1.Long.fromValue(object.retainHeight) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.data !== undefined && + (obj.data = (0, helpers_1.base64FromBytes)(message.data !== undefined ? message.data : new Uint8Array())); + message.retainHeight !== undefined && (obj.retainHeight = (message.retainHeight || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseResponseCommit(); + message.data = object.data ?? new Uint8Array(); + message.retainHeight = + object.retainHeight !== undefined && object.retainHeight !== null + ? helpers_1.Long.fromValue(object.retainHeight) + : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseResponseListSnapshots() { + return { + snapshots: [], + }; +} +exports.ResponseListSnapshots = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.snapshots) { + exports.Snapshot.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.snapshots.push(exports.Snapshot.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + snapshots: Array.isArray(object?.snapshots) + ? object.snapshots.map((e) => exports.Snapshot.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshots) { + obj.snapshots = message.snapshots.map((e) => (e ? exports.Snapshot.toJSON(e) : undefined)); + } + else { + obj.snapshots = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseResponseListSnapshots(); + message.snapshots = object.snapshots?.map((e) => exports.Snapshot.fromPartial(e)) || []; + return message; + }, +}; +function createBaseResponseOfferSnapshot() { + return { + result: 0, + }; +} +exports.ResponseOfferSnapshot = { + encode(message, writer = _m0.Writer.create()) { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + result: (0, helpers_1.isSet)(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.result !== undefined && (obj.result = responseOfferSnapshot_ResultToJSON(message.result)); + return obj; + }, + fromPartial(object) { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? 0; + return message; + }, +}; +function createBaseResponseLoadSnapshotChunk() { + return { + chunk: new Uint8Array(), + }; +} +exports.ResponseLoadSnapshotChunk = { + encode(message, writer = _m0.Writer.create()) { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chunk = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + chunk: (0, helpers_1.isSet)(object.chunk) ? (0, helpers_1.bytesFromBase64)(object.chunk) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.chunk !== undefined && + (obj.chunk = (0, helpers_1.base64FromBytes)(message.chunk !== undefined ? message.chunk : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(); + return message; + }, +}; +function createBaseResponseApplySnapshotChunk() { + return { + result: 0, + refetchChunks: [], + rejectSenders: [], + }; +} +exports.ResponseApplySnapshotChunk = { + encode(message, writer = _m0.Writer.create()) { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + writer.uint32(18).fork(); + for (const v of message.refetchChunks) { + writer.uint32(v); + } + writer.ldelim(); + for (const v of message.rejectSenders) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = reader.int32(); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.refetchChunks.push(reader.uint32()); + } + } + else { + message.refetchChunks.push(reader.uint32()); + } + break; + case 3: + message.rejectSenders.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + result: (0, helpers_1.isSet)(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, + refetchChunks: Array.isArray(object?.refetchChunks) + ? object.refetchChunks.map((e) => Number(e)) + : [], + rejectSenders: Array.isArray(object?.rejectSenders) + ? object.rejectSenders.map((e) => String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.result !== undefined && (obj.result = responseApplySnapshotChunk_ResultToJSON(message.result)); + if (message.refetchChunks) { + obj.refetchChunks = message.refetchChunks.map((e) => Math.round(e)); + } + else { + obj.refetchChunks = []; + } + if (message.rejectSenders) { + obj.rejectSenders = message.rejectSenders.map((e) => e); + } + else { + obj.rejectSenders = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? 0; + message.refetchChunks = object.refetchChunks?.map((e) => e) || []; + message.rejectSenders = object.rejectSenders?.map((e) => e) || []; + return message; + }, +}; +function createBaseConsensusParams() { + return { + block: undefined, + evidence: undefined, + validator: undefined, + version: undefined, + }; +} +exports.ConsensusParams = { + encode(message, writer = _m0.Writer.create()) { + if (message.block !== undefined) { + exports.BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); + } + if (message.evidence !== undefined) { + params_1.EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).ldelim(); + } + if (message.validator !== undefined) { + params_1.ValidatorParams.encode(message.validator, writer.uint32(26).fork()).ldelim(); + } + if (message.version !== undefined) { + params_1.VersionParams.encode(message.version, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = exports.BlockParams.decode(reader, reader.uint32()); + break; + case 2: + message.evidence = params_1.EvidenceParams.decode(reader, reader.uint32()); + break; + case 3: + message.validator = params_1.ValidatorParams.decode(reader, reader.uint32()); + break; + case 4: + message.version = params_1.VersionParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + block: (0, helpers_1.isSet)(object.block) ? exports.BlockParams.fromJSON(object.block) : undefined, + evidence: (0, helpers_1.isSet)(object.evidence) ? params_1.EvidenceParams.fromJSON(object.evidence) : undefined, + validator: (0, helpers_1.isSet)(object.validator) ? params_1.ValidatorParams.fromJSON(object.validator) : undefined, + version: (0, helpers_1.isSet)(object.version) ? params_1.VersionParams.fromJSON(object.version) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.block !== undefined && + (obj.block = message.block ? exports.BlockParams.toJSON(message.block) : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence ? params_1.EvidenceParams.toJSON(message.evidence) : undefined); + message.validator !== undefined && + (obj.validator = message.validator ? params_1.ValidatorParams.toJSON(message.validator) : undefined); + message.version !== undefined && + (obj.version = message.version ? params_1.VersionParams.toJSON(message.version) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseConsensusParams(); + message.block = + object.block !== undefined && object.block !== null ? exports.BlockParams.fromPartial(object.block) : undefined; + message.evidence = + object.evidence !== undefined && object.evidence !== null + ? params_1.EvidenceParams.fromPartial(object.evidence) + : undefined; + message.validator = + object.validator !== undefined && object.validator !== null + ? params_1.ValidatorParams.fromPartial(object.validator) + : undefined; + message.version = + object.version !== undefined && object.version !== null + ? params_1.VersionParams.fromPartial(object.version) + : undefined; + return message; + }, +}; +function createBaseBlockParams() { + return { + maxBytes: helpers_1.Long.ZERO, + maxGas: helpers_1.Long.ZERO, + }; +} +exports.BlockParams = { + encode(message, writer = _m0.Writer.create()) { + if (!message.maxBytes.isZero()) { + writer.uint32(8).int64(message.maxBytes); + } + if (!message.maxGas.isZero()) { + writer.uint32(16).int64(message.maxGas); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxBytes = reader.int64(); + break; + case 2: + message.maxGas = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + maxBytes: (0, helpers_1.isSet)(object.maxBytes) ? helpers_1.Long.fromValue(object.maxBytes) : helpers_1.Long.ZERO, + maxGas: (0, helpers_1.isSet)(object.maxGas) ? helpers_1.Long.fromValue(object.maxGas) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.maxBytes !== undefined && (obj.maxBytes = (message.maxBytes || helpers_1.Long.ZERO).toString()); + message.maxGas !== undefined && (obj.maxGas = (message.maxGas || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseBlockParams(); + message.maxBytes = + object.maxBytes !== undefined && object.maxBytes !== null ? helpers_1.Long.fromValue(object.maxBytes) : helpers_1.Long.ZERO; + message.maxGas = + object.maxGas !== undefined && object.maxGas !== null ? helpers_1.Long.fromValue(object.maxGas) : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseLastCommitInfo() { + return { + round: 0, + votes: [], + }; +} +exports.LastCommitInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + exports.VoteInfo.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLastCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.round = reader.int32(); + break; + case 2: + message.votes.push(exports.VoteInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + round: (0, helpers_1.isSet)(object.round) ? Number(object.round) : 0, + votes: Array.isArray(object?.votes) ? object.votes.map((e) => exports.VoteInfo.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.round !== undefined && (obj.round = Math.round(message.round)); + if (message.votes) { + obj.votes = message.votes.map((e) => (e ? exports.VoteInfo.toJSON(e) : undefined)); + } + else { + obj.votes = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseLastCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => exports.VoteInfo.fromPartial(e)) || []; + return message; + }, +}; +function createBaseEvent() { + return { + type: "", + attributes: [], + }; +} +exports.Event = { + encode(message, writer = _m0.Writer.create()) { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + exports.EventAttribute.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.attributes.push(exports.EventAttribute.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + type: (0, helpers_1.isSet)(object.type) ? String(object.type) : "", + attributes: Array.isArray(object?.attributes) + ? object.attributes.map((e) => exports.EventAttribute.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && (obj.type = message.type); + if (message.attributes) { + obj.attributes = message.attributes.map((e) => (e ? exports.EventAttribute.toJSON(e) : undefined)); + } + else { + obj.attributes = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseEvent(); + message.type = object.type ?? ""; + message.attributes = object.attributes?.map((e) => exports.EventAttribute.fromPartial(e)) || []; + return message; + }, +}; +function createBaseEventAttribute() { + return { + key: new Uint8Array(), + value: new Uint8Array(), + index: false, + }; +} +exports.EventAttribute = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.index === true) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.index = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + value: (0, helpers_1.isSet)(object.value) ? (0, helpers_1.bytesFromBase64)(object.value) : new Uint8Array(), + index: (0, helpers_1.isSet)(object.index) ? Boolean(object.index) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = (0, helpers_1.base64FromBytes)(message.value !== undefined ? message.value : new Uint8Array())); + message.index !== undefined && (obj.index = message.index); + return obj; + }, + fromPartial(object) { + const message = createBaseEventAttribute(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.index = object.index ?? false; + return message; + }, +}; +function createBaseTxResult() { + return { + height: helpers_1.Long.ZERO, + index: 0, + tx: new Uint8Array(), + result: undefined, + }; +} +exports.TxResult = { + encode(message, writer = _m0.Writer.create()) { + if (!message.height.isZero()) { + writer.uint32(8).int64(message.height); + } + if (message.index !== 0) { + writer.uint32(16).uint32(message.index); + } + if (message.tx.length !== 0) { + writer.uint32(26).bytes(message.tx); + } + if (message.result !== undefined) { + exports.ResponseDeliverTx.encode(message.result, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.index = reader.uint32(); + break; + case 3: + message.tx = reader.bytes(); + break; + case 4: + message.result = exports.ResponseDeliverTx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + index: (0, helpers_1.isSet)(object.index) ? Number(object.index) : 0, + tx: (0, helpers_1.isSet)(object.tx) ? (0, helpers_1.bytesFromBase64)(object.tx) : new Uint8Array(), + result: (0, helpers_1.isSet)(object.result) ? exports.ResponseDeliverTx.fromJSON(object.result) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + message.index !== undefined && (obj.index = Math.round(message.index)); + message.tx !== undefined && + (obj.tx = (0, helpers_1.base64FromBytes)(message.tx !== undefined ? message.tx : new Uint8Array())); + message.result !== undefined && + (obj.result = message.result ? exports.ResponseDeliverTx.toJSON(message.result) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseTxResult(); + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(); + message.result = + object.result !== undefined && object.result !== null + ? exports.ResponseDeliverTx.fromPartial(object.result) + : undefined; + return message; + }, +}; +function createBaseValidator() { + return { + address: new Uint8Array(), + power: helpers_1.Long.ZERO, + }; +} +exports.Validator = { + encode(message, writer = _m0.Writer.create()) { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (!message.power.isZero()) { + writer.uint32(24).int64(message.power); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.bytes(); + break; + case 3: + message.power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + address: (0, helpers_1.isSet)(object.address) ? (0, helpers_1.bytesFromBase64)(object.address) : new Uint8Array(), + power: (0, helpers_1.isSet)(object.power) ? helpers_1.Long.fromValue(object.power) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && + (obj.address = (0, helpers_1.base64FromBytes)(message.address !== undefined ? message.address : new Uint8Array())); + message.power !== undefined && (obj.power = (message.power || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.power = + object.power !== undefined && object.power !== null ? helpers_1.Long.fromValue(object.power) : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseValidatorUpdate() { + return { + pubKey: undefined, + power: helpers_1.Long.ZERO, + }; +} +exports.ValidatorUpdate = { + encode(message, writer = _m0.Writer.create()) { + if (message.pubKey !== undefined) { + keys_1.PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); + } + if (!message.power.isZero()) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pubKey = keys_1.PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pubKey: (0, helpers_1.isSet)(object.pubKey) ? keys_1.PublicKey.fromJSON(object.pubKey) : undefined, + power: (0, helpers_1.isSet)(object.power) ? helpers_1.Long.fromValue(object.power) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.pubKey !== undefined && + (obj.pubKey = message.pubKey ? keys_1.PublicKey.toJSON(message.pubKey) : undefined); + message.power !== undefined && (obj.power = (message.power || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseValidatorUpdate(); + message.pubKey = + object.pubKey !== undefined && object.pubKey !== null + ? keys_1.PublicKey.fromPartial(object.pubKey) + : undefined; + message.power = + object.power !== undefined && object.power !== null ? helpers_1.Long.fromValue(object.power) : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseVoteInfo() { + return { + validator: undefined, + signedLastBlock: false, + }; +} +exports.VoteInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.validator !== undefined) { + exports.Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + if (message.signedLastBlock === true) { + writer.uint32(16).bool(message.signedLastBlock); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = exports.Validator.decode(reader, reader.uint32()); + break; + case 2: + message.signedLastBlock = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validator: (0, helpers_1.isSet)(object.validator) ? exports.Validator.fromJSON(object.validator) : undefined, + signedLastBlock: (0, helpers_1.isSet)(object.signedLastBlock) ? Boolean(object.signedLastBlock) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.validator !== undefined && + (obj.validator = message.validator ? exports.Validator.toJSON(message.validator) : undefined); + message.signedLastBlock !== undefined && (obj.signedLastBlock = message.signedLastBlock); + return obj; + }, + fromPartial(object) { + const message = createBaseVoteInfo(); + message.validator = + object.validator !== undefined && object.validator !== null + ? exports.Validator.fromPartial(object.validator) + : undefined; + message.signedLastBlock = object.signedLastBlock ?? false; + return message; + }, +}; +function createBaseEvidence() { + return { + type: 0, + validator: undefined, + height: helpers_1.Long.ZERO, + time: undefined, + totalVotingPower: helpers_1.Long.ZERO, + }; +} +exports.Evidence = { + encode(message, writer = _m0.Writer.create()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.validator !== undefined) { + exports.Validator.encode(message.validator, writer.uint32(18).fork()).ldelim(); + } + if (!message.height.isZero()) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + timestamp_1.Timestamp.encode(message.time, writer.uint32(34).fork()).ldelim(); + } + if (!message.totalVotingPower.isZero()) { + writer.uint32(40).int64(message.totalVotingPower); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32(); + break; + case 2: + message.validator = exports.Validator.decode(reader, reader.uint32()); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.time = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.totalVotingPower = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + type: (0, helpers_1.isSet)(object.type) ? evidenceTypeFromJSON(object.type) : 0, + validator: (0, helpers_1.isSet)(object.validator) ? exports.Validator.fromJSON(object.validator) : undefined, + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + time: (0, helpers_1.isSet)(object.time) ? (0, helpers_1.fromJsonTimestamp)(object.time) : undefined, + totalVotingPower: (0, helpers_1.isSet)(object.totalVotingPower) ? helpers_1.Long.fromValue(object.totalVotingPower) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && (obj.type = evidenceTypeToJSON(message.type)); + message.validator !== undefined && + (obj.validator = message.validator ? exports.Validator.toJSON(message.validator) : undefined); + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + message.time !== undefined && (obj.time = (0, helpers_1.fromTimestamp)(message.time).toISOString()); + message.totalVotingPower !== undefined && + (obj.totalVotingPower = (message.totalVotingPower || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseEvidence(); + message.type = object.type ?? 0; + message.validator = + object.validator !== undefined && object.validator !== null + ? exports.Validator.fromPartial(object.validator) + : undefined; + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + message.time = + object.time !== undefined && object.time !== null ? timestamp_1.Timestamp.fromPartial(object.time) : undefined; + message.totalVotingPower = + object.totalVotingPower !== undefined && object.totalVotingPower !== null + ? helpers_1.Long.fromValue(object.totalVotingPower) + : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseSnapshot() { + return { + height: helpers_1.Long.UZERO, + format: 0, + chunks: 0, + hash: new Uint8Array(), + metadata: new Uint8Array(), + }; +} +exports.Snapshot = { + encode(message, writer = _m0.Writer.create()) { + if (!message.height.isZero()) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunks !== 0) { + writer.uint32(24).uint32(message.chunks); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.metadata.length !== 0) { + writer.uint32(42).bytes(message.metadata); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunks = reader.uint32(); + break; + case 4: + message.hash = reader.bytes(); + break; + case 5: + message.metadata = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.UZERO, + format: (0, helpers_1.isSet)(object.format) ? Number(object.format) : 0, + chunks: (0, helpers_1.isSet)(object.chunks) ? Number(object.chunks) : 0, + hash: (0, helpers_1.isSet)(object.hash) ? (0, helpers_1.bytesFromBase64)(object.hash) : new Uint8Array(), + metadata: (0, helpers_1.isSet)(object.metadata) ? (0, helpers_1.bytesFromBase64)(object.metadata) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.UZERO).toString()); + message.format !== undefined && (obj.format = Math.round(message.format)); + message.chunks !== undefined && (obj.chunks = Math.round(message.chunks)); + message.hash !== undefined && + (obj.hash = (0, helpers_1.base64FromBytes)(message.hash !== undefined ? message.hash : new Uint8Array())); + message.metadata !== undefined && + (obj.metadata = (0, helpers_1.base64FromBytes)(message.metadata !== undefined ? message.metadata : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseSnapshot(); + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.UZERO; + message.format = object.format ?? 0; + message.chunks = object.chunks ?? 0; + message.hash = object.hash ?? new Uint8Array(); + message.metadata = object.metadata ?? new Uint8Array(); + return message; + }, +}; +class ABCIApplicationClientImpl { + constructor(rpc) { + this.rpc = rpc; + this.Echo = this.Echo.bind(this); + this.Flush = this.Flush.bind(this); + this.Info = this.Info.bind(this); + this.SetOption = this.SetOption.bind(this); + this.DeliverTx = this.DeliverTx.bind(this); + this.CheckTx = this.CheckTx.bind(this); + this.Query = this.Query.bind(this); + this.Commit = this.Commit.bind(this); + this.InitChain = this.InitChain.bind(this); + this.BeginBlock = this.BeginBlock.bind(this); + this.EndBlock = this.EndBlock.bind(this); + this.ListSnapshots = this.ListSnapshots.bind(this); + this.OfferSnapshot = this.OfferSnapshot.bind(this); + this.LoadSnapshotChunk = this.LoadSnapshotChunk.bind(this); + this.ApplySnapshotChunk = this.ApplySnapshotChunk.bind(this); + } + Echo(request) { + const data = exports.RequestEcho.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "Echo", data); + return promise.then((data) => exports.ResponseEcho.decode(new _m0.Reader(data))); + } + Flush(request = {}) { + const data = exports.RequestFlush.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "Flush", data); + return promise.then((data) => exports.ResponseFlush.decode(new _m0.Reader(data))); + } + Info(request) { + const data = exports.RequestInfo.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "Info", data); + return promise.then((data) => exports.ResponseInfo.decode(new _m0.Reader(data))); + } + SetOption(request) { + const data = exports.RequestSetOption.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "SetOption", data); + return promise.then((data) => exports.ResponseSetOption.decode(new _m0.Reader(data))); + } + DeliverTx(request) { + const data = exports.RequestDeliverTx.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "DeliverTx", data); + return promise.then((data) => exports.ResponseDeliverTx.decode(new _m0.Reader(data))); + } + CheckTx(request) { + const data = exports.RequestCheckTx.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "CheckTx", data); + return promise.then((data) => exports.ResponseCheckTx.decode(new _m0.Reader(data))); + } + Query(request) { + const data = exports.RequestQuery.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "Query", data); + return promise.then((data) => exports.ResponseQuery.decode(new _m0.Reader(data))); + } + Commit(request = {}) { + const data = exports.RequestCommit.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "Commit", data); + return promise.then((data) => exports.ResponseCommit.decode(new _m0.Reader(data))); + } + InitChain(request) { + const data = exports.RequestInitChain.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "InitChain", data); + return promise.then((data) => exports.ResponseInitChain.decode(new _m0.Reader(data))); + } + BeginBlock(request) { + const data = exports.RequestBeginBlock.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "BeginBlock", data); + return promise.then((data) => exports.ResponseBeginBlock.decode(new _m0.Reader(data))); + } + EndBlock(request) { + const data = exports.RequestEndBlock.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "EndBlock", data); + return promise.then((data) => exports.ResponseEndBlock.decode(new _m0.Reader(data))); + } + ListSnapshots(request = {}) { + const data = exports.RequestListSnapshots.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "ListSnapshots", data); + return promise.then((data) => exports.ResponseListSnapshots.decode(new _m0.Reader(data))); + } + OfferSnapshot(request) { + const data = exports.RequestOfferSnapshot.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "OfferSnapshot", data); + return promise.then((data) => exports.ResponseOfferSnapshot.decode(new _m0.Reader(data))); + } + LoadSnapshotChunk(request) { + const data = exports.RequestLoadSnapshotChunk.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "LoadSnapshotChunk", data); + return promise.then((data) => exports.ResponseLoadSnapshotChunk.decode(new _m0.Reader(data))); + } + ApplySnapshotChunk(request) { + const data = exports.RequestApplySnapshotChunk.encode(request).finish(); + const promise = this.rpc.request("tendermint.abci.ABCIApplication", "ApplySnapshotChunk", data); + return promise.then((data) => exports.ResponseApplySnapshotChunk.decode(new _m0.Reader(data))); + } +} +exports.ABCIApplicationClientImpl = ABCIApplicationClientImpl; +//# sourceMappingURL=types.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/tendermint/crypto/keys.js": +/*!*************************************************************!*\ + !*** ./node_modules/cosmjs-types/tendermint/crypto/keys.js ***! + \*************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PublicKey = exports.protobufPackage = void 0; +/* eslint-disable */ +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "tendermint.crypto"; +function createBasePublicKey() { + return { + ed25519: undefined, + secp256k1: undefined, + }; +} +exports.PublicKey = { + encode(message, writer = _m0.Writer.create()) { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ed25519 = reader.bytes(); + break; + case 2: + message.secp256k1 = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + ed25519: (0, helpers_1.isSet)(object.ed25519) ? (0, helpers_1.bytesFromBase64)(object.ed25519) : undefined, + secp256k1: (0, helpers_1.isSet)(object.secp256k1) ? (0, helpers_1.bytesFromBase64)(object.secp256k1) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.ed25519 !== undefined && + (obj.ed25519 = message.ed25519 !== undefined ? (0, helpers_1.base64FromBytes)(message.ed25519) : undefined); + message.secp256k1 !== undefined && + (obj.secp256k1 = message.secp256k1 !== undefined ? (0, helpers_1.base64FromBytes)(message.secp256k1) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + return message; + }, +}; +//# sourceMappingURL=keys.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/tendermint/crypto/proof.js": +/*!**************************************************************!*\ + !*** ./node_modules/cosmjs-types/tendermint/crypto/proof.js ***! + \**************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ProofOps = exports.ProofOp = exports.DominoOp = exports.ValueOp = exports.Proof = exports.protobufPackage = void 0; +/* eslint-disable */ +const helpers_1 = __webpack_require__(/*! ../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "tendermint.crypto"; +function createBaseProof() { + return { + total: helpers_1.Long.ZERO, + index: helpers_1.Long.ZERO, + leafHash: new Uint8Array(), + aunts: [], + }; +} +exports.Proof = { + encode(message, writer = _m0.Writer.create()) { + if (!message.total.isZero()) { + writer.uint32(8).int64(message.total); + } + if (!message.index.isZero()) { + writer.uint32(16).int64(message.index); + } + if (message.leafHash.length !== 0) { + writer.uint32(26).bytes(message.leafHash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.total = reader.int64(); + break; + case 2: + message.index = reader.int64(); + break; + case 3: + message.leafHash = reader.bytes(); + break; + case 4: + message.aunts.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + total: (0, helpers_1.isSet)(object.total) ? helpers_1.Long.fromValue(object.total) : helpers_1.Long.ZERO, + index: (0, helpers_1.isSet)(object.index) ? helpers_1.Long.fromValue(object.index) : helpers_1.Long.ZERO, + leafHash: (0, helpers_1.isSet)(object.leafHash) ? (0, helpers_1.bytesFromBase64)(object.leafHash) : new Uint8Array(), + aunts: Array.isArray(object?.aunts) ? object.aunts.map((e) => (0, helpers_1.bytesFromBase64)(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.total !== undefined && (obj.total = (message.total || helpers_1.Long.ZERO).toString()); + message.index !== undefined && (obj.index = (message.index || helpers_1.Long.ZERO).toString()); + message.leafHash !== undefined && + (obj.leafHash = (0, helpers_1.base64FromBytes)(message.leafHash !== undefined ? message.leafHash : new Uint8Array())); + if (message.aunts) { + obj.aunts = message.aunts.map((e) => (0, helpers_1.base64FromBytes)(e !== undefined ? e : new Uint8Array())); + } + else { + obj.aunts = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseProof(); + message.total = + object.total !== undefined && object.total !== null ? helpers_1.Long.fromValue(object.total) : helpers_1.Long.ZERO; + message.index = + object.index !== undefined && object.index !== null ? helpers_1.Long.fromValue(object.index) : helpers_1.Long.ZERO; + message.leafHash = object.leafHash ?? new Uint8Array(); + message.aunts = object.aunts?.map((e) => e) || []; + return message; + }, +}; +function createBaseValueOp() { + return { + key: new Uint8Array(), + proof: undefined, + }; +} +exports.ValueOp = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.proof !== undefined) { + exports.Proof.encode(message.proof, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValueOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.proof = exports.Proof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + proof: (0, helpers_1.isSet)(object.proof) ? exports.Proof.fromJSON(object.proof) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? exports.Proof.toJSON(message.proof) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseValueOp(); + message.key = object.key ?? new Uint8Array(); + message.proof = + object.proof !== undefined && object.proof !== null ? exports.Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; +function createBaseDominoOp() { + return { + key: "", + input: "", + output: "", + }; +} +exports.DominoOp = { + encode(message, writer = _m0.Writer.create()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + if (message.output !== "") { + writer.uint32(26).string(message.output); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDominoOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.input = reader.string(); + break; + case 3: + message.output = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: (0, helpers_1.isSet)(object.key) ? String(object.key) : "", + input: (0, helpers_1.isSet)(object.input) ? String(object.input) : "", + output: (0, helpers_1.isSet)(object.output) ? String(object.output) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && (obj.key = message.key); + message.input !== undefined && (obj.input = message.input); + message.output !== undefined && (obj.output = message.output); + return obj; + }, + fromPartial(object) { + const message = createBaseDominoOp(); + message.key = object.key ?? ""; + message.input = object.input ?? ""; + message.output = object.output ?? ""; + return message; + }, +}; +function createBaseProofOp() { + return { + type: "", + key: new Uint8Array(), + data: new Uint8Array(), + }; +} +exports.ProofOp = { + encode(message, writer = _m0.Writer.create()) { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.key = reader.bytes(); + break; + case 3: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + type: (0, helpers_1.isSet)(object.type) ? String(object.type) : "", + key: (0, helpers_1.isSet)(object.key) ? (0, helpers_1.bytesFromBase64)(object.key) : new Uint8Array(), + data: (0, helpers_1.isSet)(object.data) ? (0, helpers_1.bytesFromBase64)(object.data) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && (obj.type = message.type); + message.key !== undefined && + (obj.key = (0, helpers_1.base64FromBytes)(message.key !== undefined ? message.key : new Uint8Array())); + message.data !== undefined && + (obj.data = (0, helpers_1.base64FromBytes)(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; +function createBaseProofOps() { + return { + ops: [], + }; +} +exports.ProofOps = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.ops) { + exports.ProofOp.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ops.push(exports.ProofOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + ops: Array.isArray(object?.ops) ? object.ops.map((e) => exports.ProofOp.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.ops) { + obj.ops = message.ops.map((e) => (e ? exports.ProofOp.toJSON(e) : undefined)); + } + else { + obj.ops = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => exports.ProofOp.fromPartial(e)) || []; + return message; + }, +}; +//# sourceMappingURL=proof.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/tendermint/types/block.js": +/*!*************************************************************!*\ + !*** ./node_modules/cosmjs-types/tendermint/types/block.js ***! + \*************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Block = exports.protobufPackage = void 0; +/* eslint-disable */ +const types_1 = __webpack_require__(/*! ./types */ "./node_modules/cosmjs-types/tendermint/types/types.js"); +const evidence_1 = __webpack_require__(/*! ./evidence */ "./node_modules/cosmjs-types/tendermint/types/evidence.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "tendermint.types"; +function createBaseBlock() { + return { + header: undefined, + data: undefined, + evidence: undefined, + lastCommit: undefined, + }; +} +exports.Block = { + encode(message, writer = _m0.Writer.create()) { + if (message.header !== undefined) { + types_1.Header.encode(message.header, writer.uint32(10).fork()).ldelim(); + } + if (message.data !== undefined) { + types_1.Data.encode(message.data, writer.uint32(18).fork()).ldelim(); + } + if (message.evidence !== undefined) { + evidence_1.EvidenceList.encode(message.evidence, writer.uint32(26).fork()).ldelim(); + } + if (message.lastCommit !== undefined) { + types_1.Commit.encode(message.lastCommit, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = types_1.Header.decode(reader, reader.uint32()); + break; + case 2: + message.data = types_1.Data.decode(reader, reader.uint32()); + break; + case 3: + message.evidence = evidence_1.EvidenceList.decode(reader, reader.uint32()); + break; + case 4: + message.lastCommit = types_1.Commit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + header: (0, helpers_1.isSet)(object.header) ? types_1.Header.fromJSON(object.header) : undefined, + data: (0, helpers_1.isSet)(object.data) ? types_1.Data.fromJSON(object.data) : undefined, + evidence: (0, helpers_1.isSet)(object.evidence) ? evidence_1.EvidenceList.fromJSON(object.evidence) : undefined, + lastCommit: (0, helpers_1.isSet)(object.lastCommit) ? types_1.Commit.fromJSON(object.lastCommit) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.header !== undefined && (obj.header = message.header ? types_1.Header.toJSON(message.header) : undefined); + message.data !== undefined && (obj.data = message.data ? types_1.Data.toJSON(message.data) : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence ? evidence_1.EvidenceList.toJSON(message.evidence) : undefined); + message.lastCommit !== undefined && + (obj.lastCommit = message.lastCommit ? types_1.Commit.toJSON(message.lastCommit) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseBlock(); + message.header = + object.header !== undefined && object.header !== null ? types_1.Header.fromPartial(object.header) : undefined; + message.data = + object.data !== undefined && object.data !== null ? types_1.Data.fromPartial(object.data) : undefined; + message.evidence = + object.evidence !== undefined && object.evidence !== null + ? evidence_1.EvidenceList.fromPartial(object.evidence) + : undefined; + message.lastCommit = + object.lastCommit !== undefined && object.lastCommit !== null + ? types_1.Commit.fromPartial(object.lastCommit) + : undefined; + return message; + }, +}; +//# sourceMappingURL=block.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/tendermint/types/evidence.js": +/*!****************************************************************!*\ + !*** ./node_modules/cosmjs-types/tendermint/types/evidence.js ***! + \****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.EvidenceList = exports.LightClientAttackEvidence = exports.DuplicateVoteEvidence = exports.Evidence = exports.protobufPackage = void 0; +/* eslint-disable */ +const types_1 = __webpack_require__(/*! ./types */ "./node_modules/cosmjs-types/tendermint/types/types.js"); +const timestamp_1 = __webpack_require__(/*! ../../google/protobuf/timestamp */ "./node_modules/cosmjs-types/google/protobuf/timestamp.js"); +const validator_1 = __webpack_require__(/*! ./validator */ "./node_modules/cosmjs-types/tendermint/types/validator.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "tendermint.types"; +function createBaseEvidence() { + return { + duplicateVoteEvidence: undefined, + lightClientAttackEvidence: undefined, + }; +} +exports.Evidence = { + encode(message, writer = _m0.Writer.create()) { + if (message.duplicateVoteEvidence !== undefined) { + exports.DuplicateVoteEvidence.encode(message.duplicateVoteEvidence, writer.uint32(10).fork()).ldelim(); + } + if (message.lightClientAttackEvidence !== undefined) { + exports.LightClientAttackEvidence.encode(message.lightClientAttackEvidence, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.duplicateVoteEvidence = exports.DuplicateVoteEvidence.decode(reader, reader.uint32()); + break; + case 2: + message.lightClientAttackEvidence = exports.LightClientAttackEvidence.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + duplicateVoteEvidence: (0, helpers_1.isSet)(object.duplicateVoteEvidence) + ? exports.DuplicateVoteEvidence.fromJSON(object.duplicateVoteEvidence) + : undefined, + lightClientAttackEvidence: (0, helpers_1.isSet)(object.lightClientAttackEvidence) + ? exports.LightClientAttackEvidence.fromJSON(object.lightClientAttackEvidence) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.duplicateVoteEvidence !== undefined && + (obj.duplicateVoteEvidence = message.duplicateVoteEvidence + ? exports.DuplicateVoteEvidence.toJSON(message.duplicateVoteEvidence) + : undefined); + message.lightClientAttackEvidence !== undefined && + (obj.lightClientAttackEvidence = message.lightClientAttackEvidence + ? exports.LightClientAttackEvidence.toJSON(message.lightClientAttackEvidence) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseEvidence(); + message.duplicateVoteEvidence = + object.duplicateVoteEvidence !== undefined && object.duplicateVoteEvidence !== null + ? exports.DuplicateVoteEvidence.fromPartial(object.duplicateVoteEvidence) + : undefined; + message.lightClientAttackEvidence = + object.lightClientAttackEvidence !== undefined && object.lightClientAttackEvidence !== null + ? exports.LightClientAttackEvidence.fromPartial(object.lightClientAttackEvidence) + : undefined; + return message; + }, +}; +function createBaseDuplicateVoteEvidence() { + return { + voteA: undefined, + voteB: undefined, + totalVotingPower: helpers_1.Long.ZERO, + validatorPower: helpers_1.Long.ZERO, + timestamp: undefined, + }; +} +exports.DuplicateVoteEvidence = { + encode(message, writer = _m0.Writer.create()) { + if (message.voteA !== undefined) { + types_1.Vote.encode(message.voteA, writer.uint32(10).fork()).ldelim(); + } + if (message.voteB !== undefined) { + types_1.Vote.encode(message.voteB, writer.uint32(18).fork()).ldelim(); + } + if (!message.totalVotingPower.isZero()) { + writer.uint32(24).int64(message.totalVotingPower); + } + if (!message.validatorPower.isZero()) { + writer.uint32(32).int64(message.validatorPower); + } + if (message.timestamp !== undefined) { + timestamp_1.Timestamp.encode(message.timestamp, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuplicateVoteEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.voteA = types_1.Vote.decode(reader, reader.uint32()); + break; + case 2: + message.voteB = types_1.Vote.decode(reader, reader.uint32()); + break; + case 3: + message.totalVotingPower = reader.int64(); + break; + case 4: + message.validatorPower = reader.int64(); + break; + case 5: + message.timestamp = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + voteA: (0, helpers_1.isSet)(object.voteA) ? types_1.Vote.fromJSON(object.voteA) : undefined, + voteB: (0, helpers_1.isSet)(object.voteB) ? types_1.Vote.fromJSON(object.voteB) : undefined, + totalVotingPower: (0, helpers_1.isSet)(object.totalVotingPower) ? helpers_1.Long.fromValue(object.totalVotingPower) : helpers_1.Long.ZERO, + validatorPower: (0, helpers_1.isSet)(object.validatorPower) ? helpers_1.Long.fromValue(object.validatorPower) : helpers_1.Long.ZERO, + timestamp: (0, helpers_1.isSet)(object.timestamp) ? (0, helpers_1.fromJsonTimestamp)(object.timestamp) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.voteA !== undefined && (obj.voteA = message.voteA ? types_1.Vote.toJSON(message.voteA) : undefined); + message.voteB !== undefined && (obj.voteB = message.voteB ? types_1.Vote.toJSON(message.voteB) : undefined); + message.totalVotingPower !== undefined && + (obj.totalVotingPower = (message.totalVotingPower || helpers_1.Long.ZERO).toString()); + message.validatorPower !== undefined && + (obj.validatorPower = (message.validatorPower || helpers_1.Long.ZERO).toString()); + message.timestamp !== undefined && (obj.timestamp = (0, helpers_1.fromTimestamp)(message.timestamp).toISOString()); + return obj; + }, + fromPartial(object) { + const message = createBaseDuplicateVoteEvidence(); + message.voteA = + object.voteA !== undefined && object.voteA !== null ? types_1.Vote.fromPartial(object.voteA) : undefined; + message.voteB = + object.voteB !== undefined && object.voteB !== null ? types_1.Vote.fromPartial(object.voteB) : undefined; + message.totalVotingPower = + object.totalVotingPower !== undefined && object.totalVotingPower !== null + ? helpers_1.Long.fromValue(object.totalVotingPower) + : helpers_1.Long.ZERO; + message.validatorPower = + object.validatorPower !== undefined && object.validatorPower !== null + ? helpers_1.Long.fromValue(object.validatorPower) + : helpers_1.Long.ZERO; + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? timestamp_1.Timestamp.fromPartial(object.timestamp) + : undefined; + return message; + }, +}; +function createBaseLightClientAttackEvidence() { + return { + conflictingBlock: undefined, + commonHeight: helpers_1.Long.ZERO, + byzantineValidators: [], + totalVotingPower: helpers_1.Long.ZERO, + timestamp: undefined, + }; +} +exports.LightClientAttackEvidence = { + encode(message, writer = _m0.Writer.create()) { + if (message.conflictingBlock !== undefined) { + types_1.LightBlock.encode(message.conflictingBlock, writer.uint32(10).fork()).ldelim(); + } + if (!message.commonHeight.isZero()) { + writer.uint32(16).int64(message.commonHeight); + } + for (const v of message.byzantineValidators) { + validator_1.Validator.encode(v, writer.uint32(26).fork()).ldelim(); + } + if (!message.totalVotingPower.isZero()) { + writer.uint32(32).int64(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + timestamp_1.Timestamp.encode(message.timestamp, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightClientAttackEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.conflictingBlock = types_1.LightBlock.decode(reader, reader.uint32()); + break; + case 2: + message.commonHeight = reader.int64(); + break; + case 3: + message.byzantineValidators.push(validator_1.Validator.decode(reader, reader.uint32())); + break; + case 4: + message.totalVotingPower = reader.int64(); + break; + case 5: + message.timestamp = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + conflictingBlock: (0, helpers_1.isSet)(object.conflictingBlock) + ? types_1.LightBlock.fromJSON(object.conflictingBlock) + : undefined, + commonHeight: (0, helpers_1.isSet)(object.commonHeight) ? helpers_1.Long.fromValue(object.commonHeight) : helpers_1.Long.ZERO, + byzantineValidators: Array.isArray(object?.byzantineValidators) + ? object.byzantineValidators.map((e) => validator_1.Validator.fromJSON(e)) + : [], + totalVotingPower: (0, helpers_1.isSet)(object.totalVotingPower) ? helpers_1.Long.fromValue(object.totalVotingPower) : helpers_1.Long.ZERO, + timestamp: (0, helpers_1.isSet)(object.timestamp) ? (0, helpers_1.fromJsonTimestamp)(object.timestamp) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.conflictingBlock !== undefined && + (obj.conflictingBlock = message.conflictingBlock + ? types_1.LightBlock.toJSON(message.conflictingBlock) + : undefined); + message.commonHeight !== undefined && (obj.commonHeight = (message.commonHeight || helpers_1.Long.ZERO).toString()); + if (message.byzantineValidators) { + obj.byzantineValidators = message.byzantineValidators.map((e) => (e ? validator_1.Validator.toJSON(e) : undefined)); + } + else { + obj.byzantineValidators = []; + } + message.totalVotingPower !== undefined && + (obj.totalVotingPower = (message.totalVotingPower || helpers_1.Long.ZERO).toString()); + message.timestamp !== undefined && (obj.timestamp = (0, helpers_1.fromTimestamp)(message.timestamp).toISOString()); + return obj; + }, + fromPartial(object) { + const message = createBaseLightClientAttackEvidence(); + message.conflictingBlock = + object.conflictingBlock !== undefined && object.conflictingBlock !== null + ? types_1.LightBlock.fromPartial(object.conflictingBlock) + : undefined; + message.commonHeight = + object.commonHeight !== undefined && object.commonHeight !== null + ? helpers_1.Long.fromValue(object.commonHeight) + : helpers_1.Long.ZERO; + message.byzantineValidators = object.byzantineValidators?.map((e) => validator_1.Validator.fromPartial(e)) || []; + message.totalVotingPower = + object.totalVotingPower !== undefined && object.totalVotingPower !== null + ? helpers_1.Long.fromValue(object.totalVotingPower) + : helpers_1.Long.ZERO; + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? timestamp_1.Timestamp.fromPartial(object.timestamp) + : undefined; + return message; + }, +}; +function createBaseEvidenceList() { + return { + evidence: [], + }; +} +exports.EvidenceList = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.evidence) { + exports.Evidence.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence.push(exports.Evidence.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + evidence: Array.isArray(object?.evidence) ? object.evidence.map((e) => exports.Evidence.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.evidence) { + obj.evidence = message.evidence.map((e) => (e ? exports.Evidence.toJSON(e) : undefined)); + } + else { + obj.evidence = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseEvidenceList(); + message.evidence = object.evidence?.map((e) => exports.Evidence.fromPartial(e)) || []; + return message; + }, +}; +//# sourceMappingURL=evidence.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/tendermint/types/params.js": +/*!**************************************************************!*\ + !*** ./node_modules/cosmjs-types/tendermint/types/params.js ***! + \**************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.HashedParams = exports.VersionParams = exports.ValidatorParams = exports.EvidenceParams = exports.BlockParams = exports.ConsensusParams = exports.protobufPackage = void 0; +/* eslint-disable */ +const duration_1 = __webpack_require__(/*! ../../google/protobuf/duration */ "./node_modules/cosmjs-types/google/protobuf/duration.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "tendermint.types"; +function createBaseConsensusParams() { + return { + block: undefined, + evidence: undefined, + validator: undefined, + version: undefined, + }; +} +exports.ConsensusParams = { + encode(message, writer = _m0.Writer.create()) { + if (message.block !== undefined) { + exports.BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); + } + if (message.evidence !== undefined) { + exports.EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).ldelim(); + } + if (message.validator !== undefined) { + exports.ValidatorParams.encode(message.validator, writer.uint32(26).fork()).ldelim(); + } + if (message.version !== undefined) { + exports.VersionParams.encode(message.version, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = exports.BlockParams.decode(reader, reader.uint32()); + break; + case 2: + message.evidence = exports.EvidenceParams.decode(reader, reader.uint32()); + break; + case 3: + message.validator = exports.ValidatorParams.decode(reader, reader.uint32()); + break; + case 4: + message.version = exports.VersionParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + block: (0, helpers_1.isSet)(object.block) ? exports.BlockParams.fromJSON(object.block) : undefined, + evidence: (0, helpers_1.isSet)(object.evidence) ? exports.EvidenceParams.fromJSON(object.evidence) : undefined, + validator: (0, helpers_1.isSet)(object.validator) ? exports.ValidatorParams.fromJSON(object.validator) : undefined, + version: (0, helpers_1.isSet)(object.version) ? exports.VersionParams.fromJSON(object.version) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.block !== undefined && + (obj.block = message.block ? exports.BlockParams.toJSON(message.block) : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence ? exports.EvidenceParams.toJSON(message.evidence) : undefined); + message.validator !== undefined && + (obj.validator = message.validator ? exports.ValidatorParams.toJSON(message.validator) : undefined); + message.version !== undefined && + (obj.version = message.version ? exports.VersionParams.toJSON(message.version) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseConsensusParams(); + message.block = + object.block !== undefined && object.block !== null ? exports.BlockParams.fromPartial(object.block) : undefined; + message.evidence = + object.evidence !== undefined && object.evidence !== null + ? exports.EvidenceParams.fromPartial(object.evidence) + : undefined; + message.validator = + object.validator !== undefined && object.validator !== null + ? exports.ValidatorParams.fromPartial(object.validator) + : undefined; + message.version = + object.version !== undefined && object.version !== null + ? exports.VersionParams.fromPartial(object.version) + : undefined; + return message; + }, +}; +function createBaseBlockParams() { + return { + maxBytes: helpers_1.Long.ZERO, + maxGas: helpers_1.Long.ZERO, + timeIotaMs: helpers_1.Long.ZERO, + }; +} +exports.BlockParams = { + encode(message, writer = _m0.Writer.create()) { + if (!message.maxBytes.isZero()) { + writer.uint32(8).int64(message.maxBytes); + } + if (!message.maxGas.isZero()) { + writer.uint32(16).int64(message.maxGas); + } + if (!message.timeIotaMs.isZero()) { + writer.uint32(24).int64(message.timeIotaMs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxBytes = reader.int64(); + break; + case 2: + message.maxGas = reader.int64(); + break; + case 3: + message.timeIotaMs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + maxBytes: (0, helpers_1.isSet)(object.maxBytes) ? helpers_1.Long.fromValue(object.maxBytes) : helpers_1.Long.ZERO, + maxGas: (0, helpers_1.isSet)(object.maxGas) ? helpers_1.Long.fromValue(object.maxGas) : helpers_1.Long.ZERO, + timeIotaMs: (0, helpers_1.isSet)(object.timeIotaMs) ? helpers_1.Long.fromValue(object.timeIotaMs) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.maxBytes !== undefined && (obj.maxBytes = (message.maxBytes || helpers_1.Long.ZERO).toString()); + message.maxGas !== undefined && (obj.maxGas = (message.maxGas || helpers_1.Long.ZERO).toString()); + message.timeIotaMs !== undefined && (obj.timeIotaMs = (message.timeIotaMs || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseBlockParams(); + message.maxBytes = + object.maxBytes !== undefined && object.maxBytes !== null ? helpers_1.Long.fromValue(object.maxBytes) : helpers_1.Long.ZERO; + message.maxGas = + object.maxGas !== undefined && object.maxGas !== null ? helpers_1.Long.fromValue(object.maxGas) : helpers_1.Long.ZERO; + message.timeIotaMs = + object.timeIotaMs !== undefined && object.timeIotaMs !== null + ? helpers_1.Long.fromValue(object.timeIotaMs) + : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseEvidenceParams() { + return { + maxAgeNumBlocks: helpers_1.Long.ZERO, + maxAgeDuration: undefined, + maxBytes: helpers_1.Long.ZERO, + }; +} +exports.EvidenceParams = { + encode(message, writer = _m0.Writer.create()) { + if (!message.maxAgeNumBlocks.isZero()) { + writer.uint32(8).int64(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + duration_1.Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).ldelim(); + } + if (!message.maxBytes.isZero()) { + writer.uint32(24).int64(message.maxBytes); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxAgeNumBlocks = reader.int64(); + break; + case 2: + message.maxAgeDuration = duration_1.Duration.decode(reader, reader.uint32()); + break; + case 3: + message.maxBytes = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + maxAgeNumBlocks: (0, helpers_1.isSet)(object.maxAgeNumBlocks) ? helpers_1.Long.fromValue(object.maxAgeNumBlocks) : helpers_1.Long.ZERO, + maxAgeDuration: (0, helpers_1.isSet)(object.maxAgeDuration) ? duration_1.Duration.fromJSON(object.maxAgeDuration) : undefined, + maxBytes: (0, helpers_1.isSet)(object.maxBytes) ? helpers_1.Long.fromValue(object.maxBytes) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.maxAgeNumBlocks !== undefined && + (obj.maxAgeNumBlocks = (message.maxAgeNumBlocks || helpers_1.Long.ZERO).toString()); + message.maxAgeDuration !== undefined && + (obj.maxAgeDuration = message.maxAgeDuration ? duration_1.Duration.toJSON(message.maxAgeDuration) : undefined); + message.maxBytes !== undefined && (obj.maxBytes = (message.maxBytes || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseEvidenceParams(); + message.maxAgeNumBlocks = + object.maxAgeNumBlocks !== undefined && object.maxAgeNumBlocks !== null + ? helpers_1.Long.fromValue(object.maxAgeNumBlocks) + : helpers_1.Long.ZERO; + message.maxAgeDuration = + object.maxAgeDuration !== undefined && object.maxAgeDuration !== null + ? duration_1.Duration.fromPartial(object.maxAgeDuration) + : undefined; + message.maxBytes = + object.maxBytes !== undefined && object.maxBytes !== null ? helpers_1.Long.fromValue(object.maxBytes) : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseValidatorParams() { + return { + pubKeyTypes: [], + }; +} +exports.ValidatorParams = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.pubKeyTypes) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pubKeyTypes.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pubKeyTypes: Array.isArray(object?.pubKeyTypes) ? object.pubKeyTypes.map((e) => String(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pubKeyTypes) { + obj.pubKeyTypes = message.pubKeyTypes.map((e) => e); + } + else { + obj.pubKeyTypes = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pubKeyTypes?.map((e) => e) || []; + return message; + }, +}; +function createBaseVersionParams() { + return { + appVersion: helpers_1.Long.UZERO, + }; +} +exports.VersionParams = { + encode(message, writer = _m0.Writer.create()) { + if (!message.appVersion.isZero()) { + writer.uint32(8).uint64(message.appVersion); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.appVersion = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + appVersion: (0, helpers_1.isSet)(object.appVersion) ? helpers_1.Long.fromValue(object.appVersion) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.appVersion !== undefined && (obj.appVersion = (message.appVersion || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseVersionParams(); + message.appVersion = + object.appVersion !== undefined && object.appVersion !== null + ? helpers_1.Long.fromValue(object.appVersion) + : helpers_1.Long.UZERO; + return message; + }, +}; +function createBaseHashedParams() { + return { + blockMaxBytes: helpers_1.Long.ZERO, + blockMaxGas: helpers_1.Long.ZERO, + }; +} +exports.HashedParams = { + encode(message, writer = _m0.Writer.create()) { + if (!message.blockMaxBytes.isZero()) { + writer.uint32(8).int64(message.blockMaxBytes); + } + if (!message.blockMaxGas.isZero()) { + writer.uint32(16).int64(message.blockMaxGas); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashedParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockMaxBytes = reader.int64(); + break; + case 2: + message.blockMaxGas = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + blockMaxBytes: (0, helpers_1.isSet)(object.blockMaxBytes) ? helpers_1.Long.fromValue(object.blockMaxBytes) : helpers_1.Long.ZERO, + blockMaxGas: (0, helpers_1.isSet)(object.blockMaxGas) ? helpers_1.Long.fromValue(object.blockMaxGas) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.blockMaxBytes !== undefined && + (obj.blockMaxBytes = (message.blockMaxBytes || helpers_1.Long.ZERO).toString()); + message.blockMaxGas !== undefined && (obj.blockMaxGas = (message.blockMaxGas || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseHashedParams(); + message.blockMaxBytes = + object.blockMaxBytes !== undefined && object.blockMaxBytes !== null + ? helpers_1.Long.fromValue(object.blockMaxBytes) + : helpers_1.Long.ZERO; + message.blockMaxGas = + object.blockMaxGas !== undefined && object.blockMaxGas !== null + ? helpers_1.Long.fromValue(object.blockMaxGas) + : helpers_1.Long.ZERO; + return message; + }, +}; +//# sourceMappingURL=params.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/tendermint/types/types.js": +/*!*************************************************************!*\ + !*** ./node_modules/cosmjs-types/tendermint/types/types.js ***! + \*************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TxProof = exports.BlockMeta = exports.LightBlock = exports.SignedHeader = exports.Proposal = exports.CommitSig = exports.Commit = exports.Vote = exports.Data = exports.Header = exports.BlockID = exports.Part = exports.PartSetHeader = exports.signedMsgTypeToJSON = exports.signedMsgTypeFromJSON = exports.SignedMsgType = exports.blockIDFlagToJSON = exports.blockIDFlagFromJSON = exports.BlockIDFlag = exports.protobufPackage = void 0; +/* eslint-disable */ +const proof_1 = __webpack_require__(/*! ../crypto/proof */ "./node_modules/cosmjs-types/tendermint/crypto/proof.js"); +const types_1 = __webpack_require__(/*! ../version/types */ "./node_modules/cosmjs-types/tendermint/version/types.js"); +const timestamp_1 = __webpack_require__(/*! ../../google/protobuf/timestamp */ "./node_modules/cosmjs-types/google/protobuf/timestamp.js"); +const validator_1 = __webpack_require__(/*! ./validator */ "./node_modules/cosmjs-types/tendermint/types/validator.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +const helpers_1 = __webpack_require__(/*! ../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +exports.protobufPackage = "tendermint.types"; +/** BlockIdFlag indicates which BlcokID the signature is for */ +var BlockIDFlag; +(function (BlockIDFlag) { + BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_UNKNOWN"] = 0] = "BLOCK_ID_FLAG_UNKNOWN"; + BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_ABSENT"] = 1] = "BLOCK_ID_FLAG_ABSENT"; + BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_COMMIT"] = 2] = "BLOCK_ID_FLAG_COMMIT"; + BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_NIL"] = 3] = "BLOCK_ID_FLAG_NIL"; + BlockIDFlag[BlockIDFlag["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(BlockIDFlag = exports.BlockIDFlag || (exports.BlockIDFlag = {})); +function blockIDFlagFromJSON(object) { + switch (object) { + case 0: + case "BLOCK_ID_FLAG_UNKNOWN": + return BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN; + case 1: + case "BLOCK_ID_FLAG_ABSENT": + return BlockIDFlag.BLOCK_ID_FLAG_ABSENT; + case 2: + case "BLOCK_ID_FLAG_COMMIT": + return BlockIDFlag.BLOCK_ID_FLAG_COMMIT; + case 3: + case "BLOCK_ID_FLAG_NIL": + return BlockIDFlag.BLOCK_ID_FLAG_NIL; + case -1: + case "UNRECOGNIZED": + default: + return BlockIDFlag.UNRECOGNIZED; + } +} +exports.blockIDFlagFromJSON = blockIDFlagFromJSON; +function blockIDFlagToJSON(object) { + switch (object) { + case BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN: + return "BLOCK_ID_FLAG_UNKNOWN"; + case BlockIDFlag.BLOCK_ID_FLAG_ABSENT: + return "BLOCK_ID_FLAG_ABSENT"; + case BlockIDFlag.BLOCK_ID_FLAG_COMMIT: + return "BLOCK_ID_FLAG_COMMIT"; + case BlockIDFlag.BLOCK_ID_FLAG_NIL: + return "BLOCK_ID_FLAG_NIL"; + case BlockIDFlag.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.blockIDFlagToJSON = blockIDFlagToJSON; +/** SignedMsgType is a type of signed message in the consensus. */ +var SignedMsgType; +(function (SignedMsgType) { + SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_UNKNOWN"] = 0] = "SIGNED_MSG_TYPE_UNKNOWN"; + /** SIGNED_MSG_TYPE_PREVOTE - Votes */ + SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_PREVOTE"] = 1] = "SIGNED_MSG_TYPE_PREVOTE"; + SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_PRECOMMIT"] = 2] = "SIGNED_MSG_TYPE_PRECOMMIT"; + /** SIGNED_MSG_TYPE_PROPOSAL - Proposals */ + SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_PROPOSAL"] = 32] = "SIGNED_MSG_TYPE_PROPOSAL"; + SignedMsgType[SignedMsgType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(SignedMsgType = exports.SignedMsgType || (exports.SignedMsgType = {})); +function signedMsgTypeFromJSON(object) { + switch (object) { + case 0: + case "SIGNED_MSG_TYPE_UNKNOWN": + return SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN; + case 1: + case "SIGNED_MSG_TYPE_PREVOTE": + return SignedMsgType.SIGNED_MSG_TYPE_PREVOTE; + case 2: + case "SIGNED_MSG_TYPE_PRECOMMIT": + return SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT; + case 32: + case "SIGNED_MSG_TYPE_PROPOSAL": + return SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL; + case -1: + case "UNRECOGNIZED": + default: + return SignedMsgType.UNRECOGNIZED; + } +} +exports.signedMsgTypeFromJSON = signedMsgTypeFromJSON; +function signedMsgTypeToJSON(object) { + switch (object) { + case SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN: + return "SIGNED_MSG_TYPE_UNKNOWN"; + case SignedMsgType.SIGNED_MSG_TYPE_PREVOTE: + return "SIGNED_MSG_TYPE_PREVOTE"; + case SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT: + return "SIGNED_MSG_TYPE_PRECOMMIT"; + case SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL: + return "SIGNED_MSG_TYPE_PROPOSAL"; + case SignedMsgType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.signedMsgTypeToJSON = signedMsgTypeToJSON; +function createBasePartSetHeader() { + return { + total: 0, + hash: new Uint8Array(), + }; +} +exports.PartSetHeader = { + encode(message, writer = _m0.Writer.create()) { + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartSetHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.total = reader.uint32(); + break; + case 2: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + total: (0, helpers_1.isSet)(object.total) ? Number(object.total) : 0, + hash: (0, helpers_1.isSet)(object.hash) ? (0, helpers_1.bytesFromBase64)(object.hash) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.total !== undefined && (obj.total = Math.round(message.total)); + message.hash !== undefined && + (obj.hash = (0, helpers_1.base64FromBytes)(message.hash !== undefined ? message.hash : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(); + return message; + }, +}; +function createBasePart() { + return { + index: 0, + bytes: new Uint8Array(), + proof: undefined, + }; +} +exports.Part = { + encode(message, writer = _m0.Writer.create()) { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.bytes.length !== 0) { + writer.uint32(18).bytes(message.bytes); + } + if (message.proof !== undefined) { + proof_1.Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.uint32(); + break; + case 2: + message.bytes = reader.bytes(); + break; + case 3: + message.proof = proof_1.Proof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + index: (0, helpers_1.isSet)(object.index) ? Number(object.index) : 0, + bytes: (0, helpers_1.isSet)(object.bytes) ? (0, helpers_1.bytesFromBase64)(object.bytes) : new Uint8Array(), + proof: (0, helpers_1.isSet)(object.proof) ? proof_1.Proof.fromJSON(object.proof) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.index !== undefined && (obj.index = Math.round(message.index)); + message.bytes !== undefined && + (obj.bytes = (0, helpers_1.base64FromBytes)(message.bytes !== undefined ? message.bytes : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? proof_1.Proof.toJSON(message.proof) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBasePart(); + message.index = object.index ?? 0; + message.bytes = object.bytes ?? new Uint8Array(); + message.proof = + object.proof !== undefined && object.proof !== null ? proof_1.Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; +function createBaseBlockID() { + return { + hash: new Uint8Array(), + partSetHeader: undefined, + }; +} +exports.BlockID = { + encode(message, writer = _m0.Writer.create()) { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.partSetHeader !== undefined) { + exports.PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.partSetHeader = exports.PartSetHeader.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + hash: (0, helpers_1.isSet)(object.hash) ? (0, helpers_1.bytesFromBase64)(object.hash) : new Uint8Array(), + partSetHeader: (0, helpers_1.isSet)(object.partSetHeader) ? exports.PartSetHeader.fromJSON(object.partSetHeader) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.hash !== undefined && + (obj.hash = (0, helpers_1.base64FromBytes)(message.hash !== undefined ? message.hash : new Uint8Array())); + message.partSetHeader !== undefined && + (obj.partSetHeader = message.partSetHeader ? exports.PartSetHeader.toJSON(message.partSetHeader) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(); + message.partSetHeader = + object.partSetHeader !== undefined && object.partSetHeader !== null + ? exports.PartSetHeader.fromPartial(object.partSetHeader) + : undefined; + return message; + }, +}; +function createBaseHeader() { + return { + version: undefined, + chainId: "", + height: helpers_1.Long.ZERO, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(), + dataHash: new Uint8Array(), + validatorsHash: new Uint8Array(), + nextValidatorsHash: new Uint8Array(), + consensusHash: new Uint8Array(), + appHash: new Uint8Array(), + lastResultsHash: new Uint8Array(), + evidenceHash: new Uint8Array(), + proposerAddress: new Uint8Array(), + }; +} +exports.Header = { + encode(message, writer = _m0.Writer.create()) { + if (message.version !== undefined) { + types_1.Consensus.encode(message.version, writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (!message.height.isZero()) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + timestamp_1.Timestamp.encode(message.time, writer.uint32(34).fork()).ldelim(); + } + if (message.lastBlockId !== undefined) { + exports.BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).ldelim(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(114).bytes(message.proposerAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = types_1.Consensus.decode(reader, reader.uint32()); + break; + case 2: + message.chainId = reader.string(); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.time = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.lastBlockId = exports.BlockID.decode(reader, reader.uint32()); + break; + case 6: + message.lastCommitHash = reader.bytes(); + break; + case 7: + message.dataHash = reader.bytes(); + break; + case 8: + message.validatorsHash = reader.bytes(); + break; + case 9: + message.nextValidatorsHash = reader.bytes(); + break; + case 10: + message.consensusHash = reader.bytes(); + break; + case 11: + message.appHash = reader.bytes(); + break; + case 12: + message.lastResultsHash = reader.bytes(); + break; + case 13: + message.evidenceHash = reader.bytes(); + break; + case 14: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + version: (0, helpers_1.isSet)(object.version) ? types_1.Consensus.fromJSON(object.version) : undefined, + chainId: (0, helpers_1.isSet)(object.chainId) ? String(object.chainId) : "", + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + time: (0, helpers_1.isSet)(object.time) ? (0, helpers_1.fromJsonTimestamp)(object.time) : undefined, + lastBlockId: (0, helpers_1.isSet)(object.lastBlockId) ? exports.BlockID.fromJSON(object.lastBlockId) : undefined, + lastCommitHash: (0, helpers_1.isSet)(object.lastCommitHash) + ? (0, helpers_1.bytesFromBase64)(object.lastCommitHash) + : new Uint8Array(), + dataHash: (0, helpers_1.isSet)(object.dataHash) ? (0, helpers_1.bytesFromBase64)(object.dataHash) : new Uint8Array(), + validatorsHash: (0, helpers_1.isSet)(object.validatorsHash) + ? (0, helpers_1.bytesFromBase64)(object.validatorsHash) + : new Uint8Array(), + nextValidatorsHash: (0, helpers_1.isSet)(object.nextValidatorsHash) + ? (0, helpers_1.bytesFromBase64)(object.nextValidatorsHash) + : new Uint8Array(), + consensusHash: (0, helpers_1.isSet)(object.consensusHash) ? (0, helpers_1.bytesFromBase64)(object.consensusHash) : new Uint8Array(), + appHash: (0, helpers_1.isSet)(object.appHash) ? (0, helpers_1.bytesFromBase64)(object.appHash) : new Uint8Array(), + lastResultsHash: (0, helpers_1.isSet)(object.lastResultsHash) + ? (0, helpers_1.bytesFromBase64)(object.lastResultsHash) + : new Uint8Array(), + evidenceHash: (0, helpers_1.isSet)(object.evidenceHash) ? (0, helpers_1.bytesFromBase64)(object.evidenceHash) : new Uint8Array(), + proposerAddress: (0, helpers_1.isSet)(object.proposerAddress) + ? (0, helpers_1.bytesFromBase64)(object.proposerAddress) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.version !== undefined && + (obj.version = message.version ? types_1.Consensus.toJSON(message.version) : undefined); + message.chainId !== undefined && (obj.chainId = message.chainId); + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + message.time !== undefined && (obj.time = (0, helpers_1.fromTimestamp)(message.time).toISOString()); + message.lastBlockId !== undefined && + (obj.lastBlockId = message.lastBlockId ? exports.BlockID.toJSON(message.lastBlockId) : undefined); + message.lastCommitHash !== undefined && + (obj.lastCommitHash = (0, helpers_1.base64FromBytes)(message.lastCommitHash !== undefined ? message.lastCommitHash : new Uint8Array())); + message.dataHash !== undefined && + (obj.dataHash = (0, helpers_1.base64FromBytes)(message.dataHash !== undefined ? message.dataHash : new Uint8Array())); + message.validatorsHash !== undefined && + (obj.validatorsHash = (0, helpers_1.base64FromBytes)(message.validatorsHash !== undefined ? message.validatorsHash : new Uint8Array())); + message.nextValidatorsHash !== undefined && + (obj.nextValidatorsHash = (0, helpers_1.base64FromBytes)(message.nextValidatorsHash !== undefined ? message.nextValidatorsHash : new Uint8Array())); + message.consensusHash !== undefined && + (obj.consensusHash = (0, helpers_1.base64FromBytes)(message.consensusHash !== undefined ? message.consensusHash : new Uint8Array())); + message.appHash !== undefined && + (obj.appHash = (0, helpers_1.base64FromBytes)(message.appHash !== undefined ? message.appHash : new Uint8Array())); + message.lastResultsHash !== undefined && + (obj.lastResultsHash = (0, helpers_1.base64FromBytes)(message.lastResultsHash !== undefined ? message.lastResultsHash : new Uint8Array())); + message.evidenceHash !== undefined && + (obj.evidenceHash = (0, helpers_1.base64FromBytes)(message.evidenceHash !== undefined ? message.evidenceHash : new Uint8Array())); + message.proposerAddress !== undefined && + (obj.proposerAddress = (0, helpers_1.base64FromBytes)(message.proposerAddress !== undefined ? message.proposerAddress : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseHeader(); + message.version = + object.version !== undefined && object.version !== null + ? types_1.Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + message.time = + object.time !== undefined && object.time !== null ? timestamp_1.Timestamp.fromPartial(object.time) : undefined; + message.lastBlockId = + object.lastBlockId !== undefined && object.lastBlockId !== null + ? exports.BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(); + message.dataHash = object.dataHash ?? new Uint8Array(); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.consensusHash = object.consensusHash ?? new Uint8Array(); + message.appHash = object.appHash ?? new Uint8Array(); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, +}; +function createBaseData() { + return { + txs: [], + }; +} +exports.Data = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.txs) { + writer.uint32(10).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + txs: Array.isArray(object?.txs) ? object.txs.map((e) => (0, helpers_1.bytesFromBase64)(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => (0, helpers_1.base64FromBytes)(e !== undefined ? e : new Uint8Array())); + } + else { + obj.txs = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseData(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; +function createBaseVote() { + return { + type: 0, + height: helpers_1.Long.ZERO, + round: 0, + blockId: undefined, + timestamp: undefined, + validatorAddress: new Uint8Array(), + validatorIndex: 0, + signature: new Uint8Array(), + }; +} +exports.Vote = { + encode(message, writer = _m0.Writer.create()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (!message.height.isZero()) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.blockId !== undefined) { + exports.BlockID.encode(message.blockId, writer.uint32(34).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + timestamp_1.Timestamp.encode(message.timestamp, writer.uint32(42).fork()).ldelim(); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(50).bytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + writer.uint32(56).int32(message.validatorIndex); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32(); + break; + case 2: + message.height = reader.int64(); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.blockId = exports.BlockID.decode(reader, reader.uint32()); + break; + case 5: + message.timestamp = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.validatorAddress = reader.bytes(); + break; + case 7: + message.validatorIndex = reader.int32(); + break; + case 8: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + type: (0, helpers_1.isSet)(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + round: (0, helpers_1.isSet)(object.round) ? Number(object.round) : 0, + blockId: (0, helpers_1.isSet)(object.blockId) ? exports.BlockID.fromJSON(object.blockId) : undefined, + timestamp: (0, helpers_1.isSet)(object.timestamp) ? (0, helpers_1.fromJsonTimestamp)(object.timestamp) : undefined, + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) + ? (0, helpers_1.bytesFromBase64)(object.validatorAddress) + : new Uint8Array(), + validatorIndex: (0, helpers_1.isSet)(object.validatorIndex) ? Number(object.validatorIndex) : 0, + signature: (0, helpers_1.isSet)(object.signature) ? (0, helpers_1.bytesFromBase64)(object.signature) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && (obj.type = signedMsgTypeToJSON(message.type)); + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.blockId !== undefined && + (obj.blockId = message.blockId ? exports.BlockID.toJSON(message.blockId) : undefined); + message.timestamp !== undefined && (obj.timestamp = (0, helpers_1.fromTimestamp)(message.timestamp).toISOString()); + message.validatorAddress !== undefined && + (obj.validatorAddress = (0, helpers_1.base64FromBytes)(message.validatorAddress !== undefined ? message.validatorAddress : new Uint8Array())); + message.validatorIndex !== undefined && (obj.validatorIndex = Math.round(message.validatorIndex)); + message.signature !== undefined && + (obj.signature = (0, helpers_1.base64FromBytes)(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseVote(); + message.type = object.type ?? 0; + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + message.round = object.round ?? 0; + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? exports.BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? timestamp_1.Timestamp.fromPartial(object.timestamp) + : undefined; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.validatorIndex = object.validatorIndex ?? 0; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; +function createBaseCommit() { + return { + height: helpers_1.Long.ZERO, + round: 0, + blockId: undefined, + signatures: [], + }; +} +exports.Commit = { + encode(message, writer = _m0.Writer.create()) { + if (!message.height.isZero()) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + exports.BlockID.encode(message.blockId, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.signatures) { + exports.CommitSig.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.blockId = exports.BlockID.decode(reader, reader.uint32()); + break; + case 4: + message.signatures.push(exports.CommitSig.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + round: (0, helpers_1.isSet)(object.round) ? Number(object.round) : 0, + blockId: (0, helpers_1.isSet)(object.blockId) ? exports.BlockID.fromJSON(object.blockId) : undefined, + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e) => exports.CommitSig.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.blockId !== undefined && + (obj.blockId = message.blockId ? exports.BlockID.toJSON(message.blockId) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => (e ? exports.CommitSig.toJSON(e) : undefined)); + } + else { + obj.signatures = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseCommit(); + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + message.round = object.round ?? 0; + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? exports.BlockID.fromPartial(object.blockId) + : undefined; + message.signatures = object.signatures?.map((e) => exports.CommitSig.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCommitSig() { + return { + blockIdFlag: 0, + validatorAddress: new Uint8Array(), + timestamp: undefined, + signature: new Uint8Array(), + }; +} +exports.CommitSig = { + encode(message, writer = _m0.Writer.create()) { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + timestamp_1.Timestamp.encode(message.timestamp, writer.uint32(26).fork()).ldelim(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockIdFlag = reader.int32(); + break; + case 2: + message.validatorAddress = reader.bytes(); + break; + case 3: + message.timestamp = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + blockIdFlag: (0, helpers_1.isSet)(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + validatorAddress: (0, helpers_1.isSet)(object.validatorAddress) + ? (0, helpers_1.bytesFromBase64)(object.validatorAddress) + : new Uint8Array(), + timestamp: (0, helpers_1.isSet)(object.timestamp) ? (0, helpers_1.fromJsonTimestamp)(object.timestamp) : undefined, + signature: (0, helpers_1.isSet)(object.signature) ? (0, helpers_1.bytesFromBase64)(object.signature) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.blockIdFlag !== undefined && (obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag)); + message.validatorAddress !== undefined && + (obj.validatorAddress = (0, helpers_1.base64FromBytes)(message.validatorAddress !== undefined ? message.validatorAddress : new Uint8Array())); + message.timestamp !== undefined && (obj.timestamp = (0, helpers_1.fromTimestamp)(message.timestamp).toISOString()); + message.signature !== undefined && + (obj.signature = (0, helpers_1.base64FromBytes)(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? timestamp_1.Timestamp.fromPartial(object.timestamp) + : undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; +function createBaseProposal() { + return { + type: 0, + height: helpers_1.Long.ZERO, + round: 0, + polRound: 0, + blockId: undefined, + timestamp: undefined, + signature: new Uint8Array(), + }; +} +exports.Proposal = { + encode(message, writer = _m0.Writer.create()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (!message.height.isZero()) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.polRound !== 0) { + writer.uint32(32).int32(message.polRound); + } + if (message.blockId !== undefined) { + exports.BlockID.encode(message.blockId, writer.uint32(42).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + timestamp_1.Timestamp.encode(message.timestamp, writer.uint32(50).fork()).ldelim(); + } + if (message.signature.length !== 0) { + writer.uint32(58).bytes(message.signature); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32(); + break; + case 2: + message.height = reader.int64(); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.polRound = reader.int32(); + break; + case 5: + message.blockId = exports.BlockID.decode(reader, reader.uint32()); + break; + case 6: + message.timestamp = timestamp_1.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + type: (0, helpers_1.isSet)(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: (0, helpers_1.isSet)(object.height) ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO, + round: (0, helpers_1.isSet)(object.round) ? Number(object.round) : 0, + polRound: (0, helpers_1.isSet)(object.polRound) ? Number(object.polRound) : 0, + blockId: (0, helpers_1.isSet)(object.blockId) ? exports.BlockID.fromJSON(object.blockId) : undefined, + timestamp: (0, helpers_1.isSet)(object.timestamp) ? (0, helpers_1.fromJsonTimestamp)(object.timestamp) : undefined, + signature: (0, helpers_1.isSet)(object.signature) ? (0, helpers_1.bytesFromBase64)(object.signature) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && (obj.type = signedMsgTypeToJSON(message.type)); + message.height !== undefined && (obj.height = (message.height || helpers_1.Long.ZERO).toString()); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.polRound !== undefined && (obj.polRound = Math.round(message.polRound)); + message.blockId !== undefined && + (obj.blockId = message.blockId ? exports.BlockID.toJSON(message.blockId) : undefined); + message.timestamp !== undefined && (obj.timestamp = (0, helpers_1.fromTimestamp)(message.timestamp).toISOString()); + message.signature !== undefined && + (obj.signature = (0, helpers_1.base64FromBytes)(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + fromPartial(object) { + const message = createBaseProposal(); + message.type = object.type ?? 0; + message.height = + object.height !== undefined && object.height !== null ? helpers_1.Long.fromValue(object.height) : helpers_1.Long.ZERO; + message.round = object.round ?? 0; + message.polRound = object.polRound ?? 0; + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? exports.BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? timestamp_1.Timestamp.fromPartial(object.timestamp) + : undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; +function createBaseSignedHeader() { + return { + header: undefined, + commit: undefined, + }; +} +exports.SignedHeader = { + encode(message, writer = _m0.Writer.create()) { + if (message.header !== undefined) { + exports.Header.encode(message.header, writer.uint32(10).fork()).ldelim(); + } + if (message.commit !== undefined) { + exports.Commit.encode(message.commit, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = exports.Header.decode(reader, reader.uint32()); + break; + case 2: + message.commit = exports.Commit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + header: (0, helpers_1.isSet)(object.header) ? exports.Header.fromJSON(object.header) : undefined, + commit: (0, helpers_1.isSet)(object.commit) ? exports.Commit.fromJSON(object.commit) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.header !== undefined && (obj.header = message.header ? exports.Header.toJSON(message.header) : undefined); + message.commit !== undefined && (obj.commit = message.commit ? exports.Commit.toJSON(message.commit) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseSignedHeader(); + message.header = + object.header !== undefined && object.header !== null ? exports.Header.fromPartial(object.header) : undefined; + message.commit = + object.commit !== undefined && object.commit !== null ? exports.Commit.fromPartial(object.commit) : undefined; + return message; + }, +}; +function createBaseLightBlock() { + return { + signedHeader: undefined, + validatorSet: undefined, + }; +} +exports.LightBlock = { + encode(message, writer = _m0.Writer.create()) { + if (message.signedHeader !== undefined) { + exports.SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); + } + if (message.validatorSet !== undefined) { + validator_1.ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signedHeader = exports.SignedHeader.decode(reader, reader.uint32()); + break; + case 2: + message.validatorSet = validator_1.ValidatorSet.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + signedHeader: (0, helpers_1.isSet)(object.signedHeader) ? exports.SignedHeader.fromJSON(object.signedHeader) : undefined, + validatorSet: (0, helpers_1.isSet)(object.validatorSet) ? validator_1.ValidatorSet.fromJSON(object.validatorSet) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.signedHeader !== undefined && + (obj.signedHeader = message.signedHeader ? exports.SignedHeader.toJSON(message.signedHeader) : undefined); + message.validatorSet !== undefined && + (obj.validatorSet = message.validatorSet ? validator_1.ValidatorSet.toJSON(message.validatorSet) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseLightBlock(); + message.signedHeader = + object.signedHeader !== undefined && object.signedHeader !== null + ? exports.SignedHeader.fromPartial(object.signedHeader) + : undefined; + message.validatorSet = + object.validatorSet !== undefined && object.validatorSet !== null + ? validator_1.ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; +function createBaseBlockMeta() { + return { + blockId: undefined, + blockSize: helpers_1.Long.ZERO, + header: undefined, + numTxs: helpers_1.Long.ZERO, + }; +} +exports.BlockMeta = { + encode(message, writer = _m0.Writer.create()) { + if (message.blockId !== undefined) { + exports.BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); + } + if (!message.blockSize.isZero()) { + writer.uint32(16).int64(message.blockSize); + } + if (message.header !== undefined) { + exports.Header.encode(message.header, writer.uint32(26).fork()).ldelim(); + } + if (!message.numTxs.isZero()) { + writer.uint32(32).int64(message.numTxs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockId = exports.BlockID.decode(reader, reader.uint32()); + break; + case 2: + message.blockSize = reader.int64(); + break; + case 3: + message.header = exports.Header.decode(reader, reader.uint32()); + break; + case 4: + message.numTxs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + blockId: (0, helpers_1.isSet)(object.blockId) ? exports.BlockID.fromJSON(object.blockId) : undefined, + blockSize: (0, helpers_1.isSet)(object.blockSize) ? helpers_1.Long.fromValue(object.blockSize) : helpers_1.Long.ZERO, + header: (0, helpers_1.isSet)(object.header) ? exports.Header.fromJSON(object.header) : undefined, + numTxs: (0, helpers_1.isSet)(object.numTxs) ? helpers_1.Long.fromValue(object.numTxs) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.blockId !== undefined && + (obj.blockId = message.blockId ? exports.BlockID.toJSON(message.blockId) : undefined); + message.blockSize !== undefined && (obj.blockSize = (message.blockSize || helpers_1.Long.ZERO).toString()); + message.header !== undefined && (obj.header = message.header ? exports.Header.toJSON(message.header) : undefined); + message.numTxs !== undefined && (obj.numTxs = (message.numTxs || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseBlockMeta(); + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? exports.BlockID.fromPartial(object.blockId) + : undefined; + message.blockSize = + object.blockSize !== undefined && object.blockSize !== null + ? helpers_1.Long.fromValue(object.blockSize) + : helpers_1.Long.ZERO; + message.header = + object.header !== undefined && object.header !== null ? exports.Header.fromPartial(object.header) : undefined; + message.numTxs = + object.numTxs !== undefined && object.numTxs !== null ? helpers_1.Long.fromValue(object.numTxs) : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseTxProof() { + return { + rootHash: new Uint8Array(), + data: new Uint8Array(), + proof: undefined, + }; +} +exports.TxProof = { + encode(message, writer = _m0.Writer.create()) { + if (message.rootHash.length !== 0) { + writer.uint32(10).bytes(message.rootHash); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.proof !== undefined) { + proof_1.Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rootHash = reader.bytes(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.proof = proof_1.Proof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + rootHash: (0, helpers_1.isSet)(object.rootHash) ? (0, helpers_1.bytesFromBase64)(object.rootHash) : new Uint8Array(), + data: (0, helpers_1.isSet)(object.data) ? (0, helpers_1.bytesFromBase64)(object.data) : new Uint8Array(), + proof: (0, helpers_1.isSet)(object.proof) ? proof_1.Proof.fromJSON(object.proof) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.rootHash !== undefined && + (obj.rootHash = (0, helpers_1.base64FromBytes)(message.rootHash !== undefined ? message.rootHash : new Uint8Array())); + message.data !== undefined && + (obj.data = (0, helpers_1.base64FromBytes)(message.data !== undefined ? message.data : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? proof_1.Proof.toJSON(message.proof) : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseTxProof(); + message.rootHash = object.rootHash ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + message.proof = + object.proof !== undefined && object.proof !== null ? proof_1.Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; +//# sourceMappingURL=types.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/tendermint/types/validator.js": +/*!*****************************************************************!*\ + !*** ./node_modules/cosmjs-types/tendermint/types/validator.js ***! + \*****************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SimpleValidator = exports.Validator = exports.ValidatorSet = exports.protobufPackage = void 0; +/* eslint-disable */ +const keys_1 = __webpack_require__(/*! ../crypto/keys */ "./node_modules/cosmjs-types/tendermint/crypto/keys.js"); +const helpers_1 = __webpack_require__(/*! ../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "tendermint.types"; +function createBaseValidatorSet() { + return { + validators: [], + proposer: undefined, + totalVotingPower: helpers_1.Long.ZERO, + }; +} +exports.ValidatorSet = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.validators) { + exports.Validator.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.proposer !== undefined) { + exports.Validator.encode(message.proposer, writer.uint32(18).fork()).ldelim(); + } + if (!message.totalVotingPower.isZero()) { + writer.uint32(24).int64(message.totalVotingPower); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validators.push(exports.Validator.decode(reader, reader.uint32())); + break; + case 2: + message.proposer = exports.Validator.decode(reader, reader.uint32()); + break; + case 3: + message.totalVotingPower = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + validators: Array.isArray(object?.validators) + ? object.validators.map((e) => exports.Validator.fromJSON(e)) + : [], + proposer: (0, helpers_1.isSet)(object.proposer) ? exports.Validator.fromJSON(object.proposer) : undefined, + totalVotingPower: (0, helpers_1.isSet)(object.totalVotingPower) ? helpers_1.Long.fromValue(object.totalVotingPower) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => (e ? exports.Validator.toJSON(e) : undefined)); + } + else { + obj.validators = []; + } + message.proposer !== undefined && + (obj.proposer = message.proposer ? exports.Validator.toJSON(message.proposer) : undefined); + message.totalVotingPower !== undefined && + (obj.totalVotingPower = (message.totalVotingPower || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseValidatorSet(); + message.validators = object.validators?.map((e) => exports.Validator.fromPartial(e)) || []; + message.proposer = + object.proposer !== undefined && object.proposer !== null + ? exports.Validator.fromPartial(object.proposer) + : undefined; + message.totalVotingPower = + object.totalVotingPower !== undefined && object.totalVotingPower !== null + ? helpers_1.Long.fromValue(object.totalVotingPower) + : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseValidator() { + return { + address: new Uint8Array(), + pubKey: undefined, + votingPower: helpers_1.Long.ZERO, + proposerPriority: helpers_1.Long.ZERO, + }; +} +exports.Validator = { + encode(message, writer = _m0.Writer.create()) { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pubKey !== undefined) { + keys_1.PublicKey.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); + } + if (!message.votingPower.isZero()) { + writer.uint32(24).int64(message.votingPower); + } + if (!message.proposerPriority.isZero()) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.bytes(); + break; + case 2: + message.pubKey = keys_1.PublicKey.decode(reader, reader.uint32()); + break; + case 3: + message.votingPower = reader.int64(); + break; + case 4: + message.proposerPriority = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + address: (0, helpers_1.isSet)(object.address) ? (0, helpers_1.bytesFromBase64)(object.address) : new Uint8Array(), + pubKey: (0, helpers_1.isSet)(object.pubKey) ? keys_1.PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: (0, helpers_1.isSet)(object.votingPower) ? helpers_1.Long.fromValue(object.votingPower) : helpers_1.Long.ZERO, + proposerPriority: (0, helpers_1.isSet)(object.proposerPriority) ? helpers_1.Long.fromValue(object.proposerPriority) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && + (obj.address = (0, helpers_1.base64FromBytes)(message.address !== undefined ? message.address : new Uint8Array())); + message.pubKey !== undefined && + (obj.pubKey = message.pubKey ? keys_1.PublicKey.toJSON(message.pubKey) : undefined); + message.votingPower !== undefined && (obj.votingPower = (message.votingPower || helpers_1.Long.ZERO).toString()); + message.proposerPriority !== undefined && + (obj.proposerPriority = (message.proposerPriority || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.pubKey = + object.pubKey !== undefined && object.pubKey !== null + ? keys_1.PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = + object.votingPower !== undefined && object.votingPower !== null + ? helpers_1.Long.fromValue(object.votingPower) + : helpers_1.Long.ZERO; + message.proposerPriority = + object.proposerPriority !== undefined && object.proposerPriority !== null + ? helpers_1.Long.fromValue(object.proposerPriority) + : helpers_1.Long.ZERO; + return message; + }, +}; +function createBaseSimpleValidator() { + return { + pubKey: undefined, + votingPower: helpers_1.Long.ZERO, + }; +} +exports.SimpleValidator = { + encode(message, writer = _m0.Writer.create()) { + if (message.pubKey !== undefined) { + keys_1.PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); + } + if (!message.votingPower.isZero()) { + writer.uint32(16).int64(message.votingPower); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimpleValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pubKey = keys_1.PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.votingPower = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + pubKey: (0, helpers_1.isSet)(object.pubKey) ? keys_1.PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: (0, helpers_1.isSet)(object.votingPower) ? helpers_1.Long.fromValue(object.votingPower) : helpers_1.Long.ZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.pubKey !== undefined && + (obj.pubKey = message.pubKey ? keys_1.PublicKey.toJSON(message.pubKey) : undefined); + message.votingPower !== undefined && (obj.votingPower = (message.votingPower || helpers_1.Long.ZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseSimpleValidator(); + message.pubKey = + object.pubKey !== undefined && object.pubKey !== null + ? keys_1.PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = + object.votingPower !== undefined && object.votingPower !== null + ? helpers_1.Long.fromValue(object.votingPower) + : helpers_1.Long.ZERO; + return message; + }, +}; +//# sourceMappingURL=validator.js.map + +/***/ }), + +/***/ "./node_modules/cosmjs-types/tendermint/version/types.js": +/*!***************************************************************!*\ + !*** ./node_modules/cosmjs-types/tendermint/version/types.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Consensus = exports.App = exports.protobufPackage = void 0; +/* eslint-disable */ +const helpers_1 = __webpack_require__(/*! ../../helpers */ "./node_modules/cosmjs-types/helpers.js"); +const _m0 = __importStar(__webpack_require__(/*! protobufjs/minimal */ "./node_modules/protobufjs/minimal.js")); +exports.protobufPackage = "tendermint.version"; +function createBaseApp() { + return { + protocol: helpers_1.Long.UZERO, + software: "", + }; +} +exports.App = { + encode(message, writer = _m0.Writer.create()) { + if (!message.protocol.isZero()) { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.protocol = reader.uint64(); + break; + case 2: + message.software = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + protocol: (0, helpers_1.isSet)(object.protocol) ? helpers_1.Long.fromValue(object.protocol) : helpers_1.Long.UZERO, + software: (0, helpers_1.isSet)(object.software) ? String(object.software) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.protocol !== undefined && (obj.protocol = (message.protocol || helpers_1.Long.UZERO).toString()); + message.software !== undefined && (obj.software = message.software); + return obj; + }, + fromPartial(object) { + const message = createBaseApp(); + message.protocol = + object.protocol !== undefined && object.protocol !== null + ? helpers_1.Long.fromValue(object.protocol) + : helpers_1.Long.UZERO; + message.software = object.software ?? ""; + return message; + }, +}; +function createBaseConsensus() { + return { + block: helpers_1.Long.UZERO, + app: helpers_1.Long.UZERO, + }; +} +exports.Consensus = { + encode(message, writer = _m0.Writer.create()) { + if (!message.block.isZero()) { + writer.uint32(8).uint64(message.block); + } + if (!message.app.isZero()) { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = reader.uint64(); + break; + case 2: + message.app = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + block: (0, helpers_1.isSet)(object.block) ? helpers_1.Long.fromValue(object.block) : helpers_1.Long.UZERO, + app: (0, helpers_1.isSet)(object.app) ? helpers_1.Long.fromValue(object.app) : helpers_1.Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + message.block !== undefined && (obj.block = (message.block || helpers_1.Long.UZERO).toString()); + message.app !== undefined && (obj.app = (message.app || helpers_1.Long.UZERO).toString()); + return obj; + }, + fromPartial(object) { + const message = createBaseConsensus(); + message.block = + object.block !== undefined && object.block !== null ? helpers_1.Long.fromValue(object.block) : helpers_1.Long.UZERO; + message.app = object.app !== undefined && object.app !== null ? helpers_1.Long.fromValue(object.app) : helpers_1.Long.UZERO; + return message; + }, +}; +//# sourceMappingURL=types.js.map + +/***/ }), + +/***/ "./node_modules/create-ecdh/browser.js": +/*!*********************************************!*\ + !*** ./node_modules/create-ecdh/browser.js ***! + \*********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; +var elliptic = __webpack_require__(/*! elliptic */ "./node_modules/elliptic/lib/elliptic.js") +var BN = __webpack_require__(/*! bn.js */ "./node_modules/create-ecdh/node_modules/bn.js/lib/bn.js") + +module.exports = function createECDH (curve) { + return new ECDH(curve) +} + +var aliases = { + secp256k1: { + name: 'secp256k1', + byteLength: 32 + }, + secp224r1: { + name: 'p224', + byteLength: 28 + }, + prime256v1: { + name: 'p256', + byteLength: 32 + }, + prime192v1: { + name: 'p192', + byteLength: 24 + }, + ed25519: { + name: 'ed25519', + byteLength: 32 + }, + secp384r1: { + name: 'p384', + byteLength: 48 + }, + secp521r1: { + name: 'p521', + byteLength: 66 + } +} + +aliases.p224 = aliases.secp224r1 +aliases.p256 = aliases.secp256r1 = aliases.prime256v1 +aliases.p192 = aliases.secp192r1 = aliases.prime192v1 +aliases.p384 = aliases.secp384r1 +aliases.p521 = aliases.secp521r1 + +function ECDH (curve) { + this.curveType = aliases[curve] + if (!this.curveType) { + this.curveType = { + name: curve + } + } + this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap + this.keys = void 0 +} + +ECDH.prototype.generateKeys = function (enc, format) { + this.keys = this.curve.genKeyPair() + return this.getPublicKey(enc, format) +} + +ECDH.prototype.computeSecret = function (other, inenc, enc) { + inenc = inenc || 'utf8' + if (!Buffer.isBuffer(other)) { + other = new Buffer(other, inenc) + } + var otherPub = this.curve.keyFromPublic(other).getPublic() + var out = otherPub.mul(this.keys.getPrivate()).getX() + return formatReturnValue(out, enc, this.curveType.byteLength) +} + +ECDH.prototype.getPublicKey = function (enc, format) { + var key = this.keys.getPublic(format === 'compressed', true) + if (format === 'hybrid') { + if (key[key.length - 1] % 2) { + key[0] = 7 + } else { + key[0] = 6 + } + } + return formatReturnValue(key, enc) +} + +ECDH.prototype.getPrivateKey = function (enc) { + return formatReturnValue(this.keys.getPrivate(), enc) +} + +ECDH.prototype.setPublicKey = function (pub, enc) { + enc = enc || 'utf8' + if (!Buffer.isBuffer(pub)) { + pub = new Buffer(pub, enc) + } + this.keys._importPublic(pub) + return this +} + +ECDH.prototype.setPrivateKey = function (priv, enc) { + enc = enc || 'utf8' + if (!Buffer.isBuffer(priv)) { + priv = new Buffer(priv, enc) + } + + var _priv = new BN(priv) + _priv = _priv.toString(16) + this.keys = this.curve.genKeyPair() + this.keys._importPrivate(_priv) + return this +} + +function formatReturnValue (bn, enc, len) { + if (!Array.isArray(bn)) { + bn = bn.toArray() + } + var buf = new Buffer(bn) + if (len && buf.length < len) { + var zeros = new Buffer(len - buf.length) + zeros.fill(0) + buf = Buffer.concat([zeros, buf]) + } + if (!enc) { + return buf + } else { + return buf.toString(enc) + } +} + + +/***/ }), + +/***/ "./node_modules/create-ecdh/node_modules/bn.js/lib/bn.js": +/*!***************************************************************!*\ + !*** ./node_modules/create-ecdh/node_modules/bn.js/lib/bn.js ***! + \***************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(/*! buffer */ "?4068").Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [ 0 ]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // 'A' - 'F' + if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + // '0' - '9' + } else { + return (c - 48) & 0xf; + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this.strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + r += c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + r += c - 17 + 0xa; + + // '0' - '9' + } else { + r += c; + } + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this.strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype.strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + BN.prototype.inspect = function inspect () { + return (this.red ? ''; + }; + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16); + }; + + BN.prototype.toBuffer = function toBuffer (endian, length) { + assert(typeof Buffer !== 'undefined'); + return this.toArrayLike(Buffer, endian, length); + }; + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + this.strip(); + var littleEndian = endian === 'le'; + var res = new ArrayType(reqLength); + + var b, i; + var q = this.clone(); + if (!littleEndian) { + // Assume big-endian + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[i] = b; + } + + for (; i < reqLength; i++) { + res[i] = 0; + } + } + + return res; + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] & (1 << wbit)) >>> wbit; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this.strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this.strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this.strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this.strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this.strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this.strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out.strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); + } + + function jumboMulTo (self, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; + + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out.strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this.strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this.strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this.strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) < num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this.strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this.strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q.strip(); + } + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modn = function modn (num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return acc; + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is BN v4 instance + r.strip(); + } else { + // r is BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + return a.umod(this.m)._forceRed(this); + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ "./node_modules/create-hash/browser.js": +/*!*********************************************!*\ + !*** ./node_modules/create-hash/browser.js ***! + \*********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js") +var MD5 = __webpack_require__(/*! md5.js */ "./node_modules/md5.js/index.js") +var RIPEMD160 = __webpack_require__(/*! ripemd160 */ "./node_modules/ripemd160/index.js") +var sha = __webpack_require__(/*! sha.js */ "./node_modules/sha.js/index.js") +var Base = __webpack_require__(/*! cipher-base */ "./node_modules/cipher-base/index.js") + +function Hash (hash) { + Base.call(this, 'digest') + + this._hash = hash +} + +inherits(Hash, Base) + +Hash.prototype._update = function (data) { + this._hash.update(data) +} + +Hash.prototype._final = function () { + return this._hash.digest() +} + +module.exports = function createHash (alg) { + alg = alg.toLowerCase() + if (alg === 'md5') return new MD5() + if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160() + + return new Hash(sha(alg)) +} + + +/***/ }), + +/***/ "./node_modules/create-hash/md5.js": +/*!*****************************************!*\ + !*** ./node_modules/create-hash/md5.js ***! + \*****************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var MD5 = __webpack_require__(/*! md5.js */ "./node_modules/md5.js/index.js") + +module.exports = function (buffer) { + return new MD5().update(buffer).digest() +} + + +/***/ }), + +/***/ "./node_modules/create-hmac/browser.js": +/*!*********************************************!*\ + !*** ./node_modules/create-hmac/browser.js ***! + \*********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js") +var Legacy = __webpack_require__(/*! ./legacy */ "./node_modules/create-hmac/legacy.js") +var Base = __webpack_require__(/*! cipher-base */ "./node_modules/cipher-base/index.js") +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var md5 = __webpack_require__(/*! create-hash/md5 */ "./node_modules/create-hash/md5.js") +var RIPEMD160 = __webpack_require__(/*! ripemd160 */ "./node_modules/ripemd160/index.js") + +var sha = __webpack_require__(/*! sha.js */ "./node_modules/sha.js/index.js") + +var ZEROS = Buffer.alloc(128) + +function Hmac (alg, key) { + Base.call(this, 'digest') + if (typeof key === 'string') { + key = Buffer.from(key) + } + + var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64 + + this._alg = alg + this._key = key + if (key.length > blocksize) { + var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg) + key = hash.update(key).digest() + } else if (key.length < blocksize) { + key = Buffer.concat([key, ZEROS], blocksize) + } + + var ipad = this._ipad = Buffer.allocUnsafe(blocksize) + var opad = this._opad = Buffer.allocUnsafe(blocksize) + + for (var i = 0; i < blocksize; i++) { + ipad[i] = key[i] ^ 0x36 + opad[i] = key[i] ^ 0x5C + } + this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg) + this._hash.update(ipad) +} + +inherits(Hmac, Base) + +Hmac.prototype._update = function (data) { + this._hash.update(data) +} + +Hmac.prototype._final = function () { + var h = this._hash.digest() + var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg) + return hash.update(this._opad).update(h).digest() +} + +module.exports = function createHmac (alg, key) { + alg = alg.toLowerCase() + if (alg === 'rmd160' || alg === 'ripemd160') { + return new Hmac('rmd160', key) + } + if (alg === 'md5') { + return new Legacy(md5, key) + } + return new Hmac(alg, key) +} + + +/***/ }), + +/***/ "./node_modules/create-hmac/legacy.js": +/*!********************************************!*\ + !*** ./node_modules/create-hmac/legacy.js ***! + \********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js") +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) + +var Base = __webpack_require__(/*! cipher-base */ "./node_modules/cipher-base/index.js") + +var ZEROS = Buffer.alloc(128) +var blocksize = 64 + +function Hmac (alg, key) { + Base.call(this, 'digest') + if (typeof key === 'string') { + key = Buffer.from(key) + } + + this._alg = alg + this._key = key + + if (key.length > blocksize) { + key = alg(key) + } else if (key.length < blocksize) { + key = Buffer.concat([key, ZEROS], blocksize) + } + + var ipad = this._ipad = Buffer.allocUnsafe(blocksize) + var opad = this._opad = Buffer.allocUnsafe(blocksize) + + for (var i = 0; i < blocksize; i++) { + ipad[i] = key[i] ^ 0x36 + opad[i] = key[i] ^ 0x5C + } + + this._hash = [ipad] +} + +inherits(Hmac, Base) + +Hmac.prototype._update = function (data) { + this._hash.push(data) +} + +Hmac.prototype._final = function () { + var h = this._alg(Buffer.concat(this._hash)) + return this._alg(Buffer.concat([this._opad, h])) +} +module.exports = Hmac + + +/***/ }), + +/***/ "./node_modules/crypto-browserify/index.js": +/*!*************************************************!*\ + !*** ./node_modules/crypto-browserify/index.js ***! + \*************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(/*! randombytes */ "./node_modules/randombytes/browser.js") +exports.createHash = exports.Hash = __webpack_require__(/*! create-hash */ "./node_modules/create-hash/browser.js") +exports.createHmac = exports.Hmac = __webpack_require__(/*! create-hmac */ "./node_modules/create-hmac/browser.js") + +var algos = __webpack_require__(/*! browserify-sign/algos */ "./node_modules/browserify-sign/algos.js") +var algoKeys = Object.keys(algos) +var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys) +exports.getHashes = function () { + return hashes +} + +var p = __webpack_require__(/*! pbkdf2 */ "./node_modules/pbkdf2/browser.js") +exports.pbkdf2 = p.pbkdf2 +exports.pbkdf2Sync = p.pbkdf2Sync + +var aes = __webpack_require__(/*! browserify-cipher */ "./node_modules/browserify-cipher/browser.js") + +exports.Cipher = aes.Cipher +exports.createCipher = aes.createCipher +exports.Cipheriv = aes.Cipheriv +exports.createCipheriv = aes.createCipheriv +exports.Decipher = aes.Decipher +exports.createDecipher = aes.createDecipher +exports.Decipheriv = aes.Decipheriv +exports.createDecipheriv = aes.createDecipheriv +exports.getCiphers = aes.getCiphers +exports.listCiphers = aes.listCiphers + +var dh = __webpack_require__(/*! diffie-hellman */ "./node_modules/diffie-hellman/browser.js") + +exports.DiffieHellmanGroup = dh.DiffieHellmanGroup +exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup +exports.getDiffieHellman = dh.getDiffieHellman +exports.createDiffieHellman = dh.createDiffieHellman +exports.DiffieHellman = dh.DiffieHellman + +var sign = __webpack_require__(/*! browserify-sign */ "./node_modules/browserify-sign/browser/index.js") + +exports.createSign = sign.createSign +exports.Sign = sign.Sign +exports.createVerify = sign.createVerify +exports.Verify = sign.Verify + +exports.createECDH = __webpack_require__(/*! create-ecdh */ "./node_modules/create-ecdh/browser.js") + +var publicEncrypt = __webpack_require__(/*! public-encrypt */ "./node_modules/public-encrypt/browser.js") + +exports.publicEncrypt = publicEncrypt.publicEncrypt +exports.privateEncrypt = publicEncrypt.privateEncrypt +exports.publicDecrypt = publicEncrypt.publicDecrypt +exports.privateDecrypt = publicEncrypt.privateDecrypt + +// the least I can do is make error messages for the rest of the node.js/crypto api. +// ;[ +// 'createCredentials' +// ].forEach(function (name) { +// exports[name] = function () { +// throw new Error([ +// 'sorry, ' + name + ' is not implemented yet', +// 'we accept pull requests', +// 'https://github.com/crypto-browserify/crypto-browserify' +// ].join('\n')) +// } +// }) + +var rf = __webpack_require__(/*! randomfill */ "./node_modules/randomfill/browser.js") + +exports.randomFill = rf.randomFill +exports.randomFillSync = rf.randomFillSync + +exports.createCredentials = function () { + throw new Error([ + 'sorry, createCredentials is not implemented yet', + 'we accept pull requests', + 'https://github.com/crypto-browserify/crypto-browserify' + ].join('\n')) +} + +exports.constants = { + 'DH_CHECK_P_NOT_SAFE_PRIME': 2, + 'DH_CHECK_P_NOT_PRIME': 1, + 'DH_UNABLE_TO_CHECK_GENERATOR': 4, + 'DH_NOT_SUITABLE_GENERATOR': 8, + 'NPN_ENABLED': 1, + 'ALPN_ENABLED': 1, + 'RSA_PKCS1_PADDING': 1, + 'RSA_SSLV23_PADDING': 2, + 'RSA_NO_PADDING': 3, + 'RSA_PKCS1_OAEP_PADDING': 4, + 'RSA_X931_PADDING': 5, + 'RSA_PKCS1_PSS_PADDING': 6, + 'POINT_CONVERSION_COMPRESSED': 2, + 'POINT_CONVERSION_UNCOMPRESSED': 4, + 'POINT_CONVERSION_HYBRID': 6 +} + + +/***/ }), + +/***/ "./node_modules/debug/src/browser.js": +/*!*******************************************!*\ + !*** ./node_modules/debug/src/browser.js ***! + \*******************************************/ +/***/ (function(module, exports, __webpack_require__) { + +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && "object" !== 'undefined' && 'env' in ({"env":{"NODE_ENV":"production"}})) { + r = ({"NODE_ENV":"production"}).DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = __webpack_require__(/*! ./common */ "./node_modules/debug/src/common.js")(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; + + +/***/ }), + +/***/ "./node_modules/debug/src/common.js": +/*!******************************************!*\ + !*** ./node_modules/debug/src/common.js ***! + \******************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __webpack_require__(/*! ms */ "./node_modules/ms/index.js"); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; + + +/***/ }), + +/***/ "./node_modules/define-properties/index.js": +/*!*************************************************!*\ + !*** ./node_modules/define-properties/index.js ***! + \*************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var keys = __webpack_require__(/*! object-keys */ "./node_modules/object-keys/index.js"); +var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; + +var toStr = Object.prototype.toString; +var concat = Array.prototype.concat; +var origDefineProperty = Object.defineProperty; + +var isFunction = function (fn) { + return typeof fn === 'function' && toStr.call(fn) === '[object Function]'; +}; + +var hasPropertyDescriptors = __webpack_require__(/*! has-property-descriptors */ "./node_modules/has-property-descriptors/index.js")(); + +var supportsDescriptors = origDefineProperty && hasPropertyDescriptors; + +var defineProperty = function (object, name, value, predicate) { + if (name in object && (!isFunction(predicate) || !predicate())) { + return; + } + if (supportsDescriptors) { + origDefineProperty(object, name, { + configurable: true, + enumerable: false, + value: value, + writable: true + }); + } else { + object[name] = value; // eslint-disable-line no-param-reassign + } +}; + +var defineProperties = function (object, map) { + var predicates = arguments.length > 2 ? arguments[2] : {}; + var props = keys(map); + if (hasSymbols) { + props = concat.call(props, Object.getOwnPropertySymbols(map)); + } + for (var i = 0; i < props.length; i += 1) { + defineProperty(object, props[i], map[props[i]], predicates[props[i]]); + } +}; + +defineProperties.supportsDescriptors = !!supportsDescriptors; + +module.exports = defineProperties; + + +/***/ }), + +/***/ "./node_modules/des.js/lib/des.js": +/*!****************************************!*\ + !*** ./node_modules/des.js/lib/des.js ***! + \****************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +exports.utils = __webpack_require__(/*! ./des/utils */ "./node_modules/des.js/lib/des/utils.js"); +exports.Cipher = __webpack_require__(/*! ./des/cipher */ "./node_modules/des.js/lib/des/cipher.js"); +exports.DES = __webpack_require__(/*! ./des/des */ "./node_modules/des.js/lib/des/des.js"); +exports.CBC = __webpack_require__(/*! ./des/cbc */ "./node_modules/des.js/lib/des/cbc.js"); +exports.EDE = __webpack_require__(/*! ./des/ede */ "./node_modules/des.js/lib/des/ede.js"); + + +/***/ }), + +/***/ "./node_modules/des.js/lib/des/cbc.js": +/*!********************************************!*\ + !*** ./node_modules/des.js/lib/des/cbc.js ***! + \********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); + +var proto = {}; + +function CBCState(iv) { + assert.equal(iv.length, 8, 'Invalid IV length'); + + this.iv = new Array(8); + for (var i = 0; i < this.iv.length; i++) + this.iv[i] = iv[i]; +} + +function instantiate(Base) { + function CBC(options) { + Base.call(this, options); + this._cbcInit(); + } + inherits(CBC, Base); + + var keys = Object.keys(proto); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + CBC.prototype[key] = proto[key]; + } + + CBC.create = function create(options) { + return new CBC(options); + }; + + return CBC; +} + +exports.instantiate = instantiate; + +proto._cbcInit = function _cbcInit() { + var state = new CBCState(this.options.iv); + this._cbcState = state; +}; + +proto._update = function _update(inp, inOff, out, outOff) { + var state = this._cbcState; + var superProto = this.constructor.super_.prototype; + + var iv = state.iv; + if (this.type === 'encrypt') { + for (var i = 0; i < this.blockSize; i++) + iv[i] ^= inp[inOff + i]; + + superProto._update.call(this, iv, 0, out, outOff); + + for (var i = 0; i < this.blockSize; i++) + iv[i] = out[outOff + i]; + } else { + superProto._update.call(this, inp, inOff, out, outOff); + + for (var i = 0; i < this.blockSize; i++) + out[outOff + i] ^= iv[i]; + + for (var i = 0; i < this.blockSize; i++) + iv[i] = inp[inOff + i]; + } +}; + + +/***/ }), + +/***/ "./node_modules/des.js/lib/des/cipher.js": +/*!***********************************************!*\ + !*** ./node_modules/des.js/lib/des/cipher.js ***! + \***********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); + +function Cipher(options) { + this.options = options; + + this.type = this.options.type; + this.blockSize = 8; + this._init(); + + this.buffer = new Array(this.blockSize); + this.bufferOff = 0; +} +module.exports = Cipher; + +Cipher.prototype._init = function _init() { + // Might be overrided +}; + +Cipher.prototype.update = function update(data) { + if (data.length === 0) + return []; + + if (this.type === 'decrypt') + return this._updateDecrypt(data); + else + return this._updateEncrypt(data); +}; + +Cipher.prototype._buffer = function _buffer(data, off) { + // Append data to buffer + var min = Math.min(this.buffer.length - this.bufferOff, data.length - off); + for (var i = 0; i < min; i++) + this.buffer[this.bufferOff + i] = data[off + i]; + this.bufferOff += min; + + // Shift next + return min; +}; + +Cipher.prototype._flushBuffer = function _flushBuffer(out, off) { + this._update(this.buffer, 0, out, off); + this.bufferOff = 0; + return this.blockSize; +}; + +Cipher.prototype._updateEncrypt = function _updateEncrypt(data) { + var inputOff = 0; + var outputOff = 0; + + var count = ((this.bufferOff + data.length) / this.blockSize) | 0; + var out = new Array(count * this.blockSize); + + if (this.bufferOff !== 0) { + inputOff += this._buffer(data, inputOff); + + if (this.bufferOff === this.buffer.length) + outputOff += this._flushBuffer(out, outputOff); + } + + // Write blocks + var max = data.length - ((data.length - inputOff) % this.blockSize); + for (; inputOff < max; inputOff += this.blockSize) { + this._update(data, inputOff, out, outputOff); + outputOff += this.blockSize; + } + + // Queue rest + for (; inputOff < data.length; inputOff++, this.bufferOff++) + this.buffer[this.bufferOff] = data[inputOff]; + + return out; +}; + +Cipher.prototype._updateDecrypt = function _updateDecrypt(data) { + var inputOff = 0; + var outputOff = 0; + + var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1; + var out = new Array(count * this.blockSize); + + // TODO(indutny): optimize it, this is far from optimal + for (; count > 0; count--) { + inputOff += this._buffer(data, inputOff); + outputOff += this._flushBuffer(out, outputOff); + } + + // Buffer rest of the input + inputOff += this._buffer(data, inputOff); + + return out; +}; + +Cipher.prototype.final = function final(buffer) { + var first; + if (buffer) + first = this.update(buffer); + + var last; + if (this.type === 'encrypt') + last = this._finalEncrypt(); + else + last = this._finalDecrypt(); + + if (first) + return first.concat(last); + else + return last; +}; + +Cipher.prototype._pad = function _pad(buffer, off) { + if (off === 0) + return false; + + while (off < buffer.length) + buffer[off++] = 0; + + return true; +}; + +Cipher.prototype._finalEncrypt = function _finalEncrypt() { + if (!this._pad(this.buffer, this.bufferOff)) + return []; + + var out = new Array(this.blockSize); + this._update(this.buffer, 0, out, 0); + return out; +}; + +Cipher.prototype._unpad = function _unpad(buffer) { + return buffer; +}; + +Cipher.prototype._finalDecrypt = function _finalDecrypt() { + assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt'); + var out = new Array(this.blockSize); + this._flushBuffer(out, 0); + + return this._unpad(out); +}; + + +/***/ }), + +/***/ "./node_modules/des.js/lib/des/des.js": +/*!********************************************!*\ + !*** ./node_modules/des.js/lib/des/des.js ***! + \********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); + +var utils = __webpack_require__(/*! ./utils */ "./node_modules/des.js/lib/des/utils.js"); +var Cipher = __webpack_require__(/*! ./cipher */ "./node_modules/des.js/lib/des/cipher.js"); + +function DESState() { + this.tmp = new Array(2); + this.keys = null; +} + +function DES(options) { + Cipher.call(this, options); + + var state = new DESState(); + this._desState = state; + + this.deriveKeys(state, options.key); +} +inherits(DES, Cipher); +module.exports = DES; + +DES.create = function create(options) { + return new DES(options); +}; + +var shiftTable = [ + 1, 1, 2, 2, 2, 2, 2, 2, + 1, 2, 2, 2, 2, 2, 2, 1 +]; + +DES.prototype.deriveKeys = function deriveKeys(state, key) { + state.keys = new Array(16 * 2); + + assert.equal(key.length, this.blockSize, 'Invalid key length'); + + var kL = utils.readUInt32BE(key, 0); + var kR = utils.readUInt32BE(key, 4); + + utils.pc1(kL, kR, state.tmp, 0); + kL = state.tmp[0]; + kR = state.tmp[1]; + for (var i = 0; i < state.keys.length; i += 2) { + var shift = shiftTable[i >>> 1]; + kL = utils.r28shl(kL, shift); + kR = utils.r28shl(kR, shift); + utils.pc2(kL, kR, state.keys, i); + } +}; + +DES.prototype._update = function _update(inp, inOff, out, outOff) { + var state = this._desState; + + var l = utils.readUInt32BE(inp, inOff); + var r = utils.readUInt32BE(inp, inOff + 4); + + // Initial Permutation + utils.ip(l, r, state.tmp, 0); + l = state.tmp[0]; + r = state.tmp[1]; + + if (this.type === 'encrypt') + this._encrypt(state, l, r, state.tmp, 0); + else + this._decrypt(state, l, r, state.tmp, 0); + + l = state.tmp[0]; + r = state.tmp[1]; + + utils.writeUInt32BE(out, l, outOff); + utils.writeUInt32BE(out, r, outOff + 4); +}; + +DES.prototype._pad = function _pad(buffer, off) { + var value = buffer.length - off; + for (var i = off; i < buffer.length; i++) + buffer[i] = value; + + return true; +}; + +DES.prototype._unpad = function _unpad(buffer) { + var pad = buffer[buffer.length - 1]; + for (var i = buffer.length - pad; i < buffer.length; i++) + assert.equal(buffer[i], pad); + + return buffer.slice(0, buffer.length - pad); +}; + +DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) { + var l = lStart; + var r = rStart; + + // Apply f() x16 times + for (var i = 0; i < state.keys.length; i += 2) { + var keyL = state.keys[i]; + var keyR = state.keys[i + 1]; + + // f(r, k) + utils.expand(r, state.tmp, 0); + + keyL ^= state.tmp[0]; + keyR ^= state.tmp[1]; + var s = utils.substitute(keyL, keyR); + var f = utils.permute(s); + + var t = r; + r = (l ^ f) >>> 0; + l = t; + } + + // Reverse Initial Permutation + utils.rip(r, l, out, off); +}; + +DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) { + var l = rStart; + var r = lStart; + + // Apply f() x16 times + for (var i = state.keys.length - 2; i >= 0; i -= 2) { + var keyL = state.keys[i]; + var keyR = state.keys[i + 1]; + + // f(r, k) + utils.expand(l, state.tmp, 0); + + keyL ^= state.tmp[0]; + keyR ^= state.tmp[1]; + var s = utils.substitute(keyL, keyR); + var f = utils.permute(s); + + var t = l; + l = (r ^ f) >>> 0; + r = t; + } + + // Reverse Initial Permutation + utils.rip(l, r, out, off); +}; + + +/***/ }), + +/***/ "./node_modules/des.js/lib/des/ede.js": +/*!********************************************!*\ + !*** ./node_modules/des.js/lib/des/ede.js ***! + \********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); + +var Cipher = __webpack_require__(/*! ./cipher */ "./node_modules/des.js/lib/des/cipher.js"); +var DES = __webpack_require__(/*! ./des */ "./node_modules/des.js/lib/des/des.js"); + +function EDEState(type, key) { + assert.equal(key.length, 24, 'Invalid key length'); + + var k1 = key.slice(0, 8); + var k2 = key.slice(8, 16); + var k3 = key.slice(16, 24); + + if (type === 'encrypt') { + this.ciphers = [ + DES.create({ type: 'encrypt', key: k1 }), + DES.create({ type: 'decrypt', key: k2 }), + DES.create({ type: 'encrypt', key: k3 }) + ]; + } else { + this.ciphers = [ + DES.create({ type: 'decrypt', key: k3 }), + DES.create({ type: 'encrypt', key: k2 }), + DES.create({ type: 'decrypt', key: k1 }) + ]; + } +} + +function EDE(options) { + Cipher.call(this, options); + + var state = new EDEState(this.type, this.options.key); + this._edeState = state; +} +inherits(EDE, Cipher); + +module.exports = EDE; + +EDE.create = function create(options) { + return new EDE(options); +}; + +EDE.prototype._update = function _update(inp, inOff, out, outOff) { + var state = this._edeState; + + state.ciphers[0]._update(inp, inOff, out, outOff); + state.ciphers[1]._update(out, outOff, out, outOff); + state.ciphers[2]._update(out, outOff, out, outOff); +}; + +EDE.prototype._pad = DES.prototype._pad; +EDE.prototype._unpad = DES.prototype._unpad; + + +/***/ }), + +/***/ "./node_modules/des.js/lib/des/utils.js": +/*!**********************************************!*\ + !*** ./node_modules/des.js/lib/des/utils.js ***! + \**********************************************/ +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + + +exports.readUInt32BE = function readUInt32BE(bytes, off) { + var res = (bytes[0 + off] << 24) | + (bytes[1 + off] << 16) | + (bytes[2 + off] << 8) | + bytes[3 + off]; + return res >>> 0; +}; + +exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) { + bytes[0 + off] = value >>> 24; + bytes[1 + off] = (value >>> 16) & 0xff; + bytes[2 + off] = (value >>> 8) & 0xff; + bytes[3 + off] = value & 0xff; +}; + +exports.ip = function ip(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + for (var i = 6; i >= 0; i -= 2) { + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inR >>> (j + i)) & 1; + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inL >>> (j + i)) & 1; + } + } + + for (var i = 6; i >= 0; i -= 2) { + for (var j = 1; j <= 25; j += 8) { + outR <<= 1; + outR |= (inR >>> (j + i)) & 1; + } + for (var j = 1; j <= 25; j += 8) { + outR <<= 1; + outR |= (inL >>> (j + i)) & 1; + } + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.rip = function rip(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + for (var i = 0; i < 4; i++) { + for (var j = 24; j >= 0; j -= 8) { + outL <<= 1; + outL |= (inR >>> (j + i)) & 1; + outL <<= 1; + outL |= (inL >>> (j + i)) & 1; + } + } + for (var i = 4; i < 8; i++) { + for (var j = 24; j >= 0; j -= 8) { + outR <<= 1; + outR |= (inR >>> (j + i)) & 1; + outR <<= 1; + outR |= (inL >>> (j + i)) & 1; + } + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.pc1 = function pc1(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + // 7, 15, 23, 31, 39, 47, 55, 63 + // 6, 14, 22, 30, 39, 47, 55, 63 + // 5, 13, 21, 29, 39, 47, 55, 63 + // 4, 12, 20, 28 + for (var i = 7; i >= 5; i--) { + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inR >> (j + i)) & 1; + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inL >> (j + i)) & 1; + } + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inR >> (j + i)) & 1; + } + + // 1, 9, 17, 25, 33, 41, 49, 57 + // 2, 10, 18, 26, 34, 42, 50, 58 + // 3, 11, 19, 27, 35, 43, 51, 59 + // 36, 44, 52, 60 + for (var i = 1; i <= 3; i++) { + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= (inR >> (j + i)) & 1; + } + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= (inL >> (j + i)) & 1; + } + } + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= (inL >> (j + i)) & 1; + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.r28shl = function r28shl(num, shift) { + return ((num << shift) & 0xfffffff) | (num >>> (28 - shift)); +}; + +var pc2table = [ + // inL => outL + 14, 11, 17, 4, 27, 23, 25, 0, + 13, 22, 7, 18, 5, 9, 16, 24, + 2, 20, 12, 21, 1, 8, 15, 26, + + // inR => outR + 15, 4, 25, 19, 9, 1, 26, 16, + 5, 11, 23, 8, 12, 7, 17, 0, + 22, 3, 10, 14, 6, 20, 27, 24 +]; + +exports.pc2 = function pc2(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + var len = pc2table.length >>> 1; + for (var i = 0; i < len; i++) { + outL <<= 1; + outL |= (inL >>> pc2table[i]) & 0x1; + } + for (var i = len; i < pc2table.length; i++) { + outR <<= 1; + outR |= (inR >>> pc2table[i]) & 0x1; + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.expand = function expand(r, out, off) { + var outL = 0; + var outR = 0; + + outL = ((r & 1) << 5) | (r >>> 27); + for (var i = 23; i >= 15; i -= 4) { + outL <<= 6; + outL |= (r >>> i) & 0x3f; + } + for (var i = 11; i >= 3; i -= 4) { + outR |= (r >>> i) & 0x3f; + outR <<= 6; + } + outR |= ((r & 0x1f) << 1) | (r >>> 31); + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +var sTable = [ + 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, + 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, + 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, + 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, + + 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, + 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, + 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, + 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, + + 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, + 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, + 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, + 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, + + 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, + 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, + 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, + 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, + + 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, + 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, + 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, + 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, + + 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, + 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, + 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, + 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, + + 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, + 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, + 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, + 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, + + 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, + 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, + 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, + 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11 +]; + +exports.substitute = function substitute(inL, inR) { + var out = 0; + for (var i = 0; i < 4; i++) { + var b = (inL >>> (18 - i * 6)) & 0x3f; + var sb = sTable[i * 0x40 + b]; + + out <<= 4; + out |= sb; + } + for (var i = 0; i < 4; i++) { + var b = (inR >>> (18 - i * 6)) & 0x3f; + var sb = sTable[4 * 0x40 + i * 0x40 + b]; + + out <<= 4; + out |= sb; + } + return out >>> 0; +}; + +var permuteTable = [ + 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, + 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7 +]; + +exports.permute = function permute(num) { + var out = 0; + for (var i = 0; i < permuteTable.length; i++) { + out <<= 1; + out |= (num >>> permuteTable[i]) & 0x1; + } + return out >>> 0; +}; + +exports.padSplit = function padSplit(num, size, group) { + var str = num.toString(2); + while (str.length < size) + str = '0' + str; + + var out = []; + for (var i = 0; i < size; i += group) + out.push(str.slice(i, i + group)); + return out.join(' '); +}; + + +/***/ }), + +/***/ "./node_modules/diffie-hellman/browser.js": +/*!************************************************!*\ + !*** ./node_modules/diffie-hellman/browser.js ***! + \************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; +var generatePrime = __webpack_require__(/*! ./lib/generatePrime */ "./node_modules/diffie-hellman/lib/generatePrime.js") +var primes = __webpack_require__(/*! ./lib/primes.json */ "./node_modules/diffie-hellman/lib/primes.json") + +var DH = __webpack_require__(/*! ./lib/dh */ "./node_modules/diffie-hellman/lib/dh.js") + +function getDiffieHellman (mod) { + var prime = new Buffer(primes[mod].prime, 'hex') + var gen = new Buffer(primes[mod].gen, 'hex') + + return new DH(prime, gen) +} + +var ENCODINGS = { + 'binary': true, 'hex': true, 'base64': true +} + +function createDiffieHellman (prime, enc, generator, genc) { + if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) { + return createDiffieHellman(prime, 'binary', enc, generator) + } + + enc = enc || 'binary' + genc = genc || 'binary' + generator = generator || new Buffer([2]) + + if (!Buffer.isBuffer(generator)) { + generator = new Buffer(generator, genc) + } + + if (typeof prime === 'number') { + return new DH(generatePrime(prime, generator), generator, true) + } + + if (!Buffer.isBuffer(prime)) { + prime = new Buffer(prime, enc) + } + + return new DH(prime, generator, true) +} + +exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman +exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman + + +/***/ }), + +/***/ "./node_modules/diffie-hellman/lib/dh.js": +/*!***********************************************!*\ + !*** ./node_modules/diffie-hellman/lib/dh.js ***! + \***********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; +var BN = __webpack_require__(/*! bn.js */ "./node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js"); +var MillerRabin = __webpack_require__(/*! miller-rabin */ "./node_modules/miller-rabin/lib/mr.js"); +var millerRabin = new MillerRabin(); +var TWENTYFOUR = new BN(24); +var ELEVEN = new BN(11); +var TEN = new BN(10); +var THREE = new BN(3); +var SEVEN = new BN(7); +var primes = __webpack_require__(/*! ./generatePrime */ "./node_modules/diffie-hellman/lib/generatePrime.js"); +var randomBytes = __webpack_require__(/*! randombytes */ "./node_modules/randombytes/browser.js"); +module.exports = DH; + +function setPublicKey(pub, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(pub)) { + pub = new Buffer(pub, enc); + } + this._pub = new BN(pub); + return this; +} + +function setPrivateKey(priv, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(priv)) { + priv = new Buffer(priv, enc); + } + this._priv = new BN(priv); + return this; +} + +var primeCache = {}; +function checkPrime(prime, generator) { + var gen = generator.toString('hex'); + var hex = [gen, prime.toString(16)].join('_'); + if (hex in primeCache) { + return primeCache[hex]; + } + var error = 0; + + if (prime.isEven() || + !primes.simpleSieve || + !primes.fermatTest(prime) || + !millerRabin.test(prime)) { + //not a prime so +1 + error += 1; + + if (gen === '02' || gen === '05') { + // we'd be able to check the generator + // it would fail so +8 + error += 8; + } else { + //we wouldn't be able to test the generator + // so +4 + error += 4; + } + primeCache[hex] = error; + return error; + } + if (!millerRabin.test(prime.shrn(1))) { + //not a safe prime + error += 2; + } + var rem; + switch (gen) { + case '02': + if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) { + // unsuidable generator + error += 8; + } + break; + case '05': + rem = prime.mod(TEN); + if (rem.cmp(THREE) && rem.cmp(SEVEN)) { + // prime mod 10 needs to equal 3 or 7 + error += 8; + } + break; + default: + error += 4; + } + primeCache[hex] = error; + return error; +} + +function DH(prime, generator, malleable) { + this.setGenerator(generator); + this.__prime = new BN(prime); + this._prime = BN.mont(this.__prime); + this._primeLen = prime.length; + this._pub = undefined; + this._priv = undefined; + this._primeCode = undefined; + if (malleable) { + this.setPublicKey = setPublicKey; + this.setPrivateKey = setPrivateKey; + } else { + this._primeCode = 8; + } +} +Object.defineProperty(DH.prototype, 'verifyError', { + enumerable: true, + get: function () { + if (typeof this._primeCode !== 'number') { + this._primeCode = checkPrime(this.__prime, this.__gen); + } + return this._primeCode; + } +}); +DH.prototype.generateKeys = function () { + if (!this._priv) { + this._priv = new BN(randomBytes(this._primeLen)); + } + this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed(); + return this.getPublicKey(); +}; + +DH.prototype.computeSecret = function (other) { + other = new BN(other); + other = other.toRed(this._prime); + var secret = other.redPow(this._priv).fromRed(); + var out = new Buffer(secret.toArray()); + var prime = this.getPrime(); + if (out.length < prime.length) { + var front = new Buffer(prime.length - out.length); + front.fill(0); + out = Buffer.concat([front, out]); + } + return out; +}; + +DH.prototype.getPublicKey = function getPublicKey(enc) { + return formatReturnValue(this._pub, enc); +}; + +DH.prototype.getPrivateKey = function getPrivateKey(enc) { + return formatReturnValue(this._priv, enc); +}; + +DH.prototype.getPrime = function (enc) { + return formatReturnValue(this.__prime, enc); +}; + +DH.prototype.getGenerator = function (enc) { + return formatReturnValue(this._gen, enc); +}; + +DH.prototype.setGenerator = function (gen, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(gen)) { + gen = new Buffer(gen, enc); + } + this.__gen = gen; + this._gen = new BN(gen); + return this; +}; + +function formatReturnValue(bn, enc) { + var buf = new Buffer(bn.toArray()); + if (!enc) { + return buf; + } else { + return buf.toString(enc); + } +} + + +/***/ }), + +/***/ "./node_modules/diffie-hellman/lib/generatePrime.js": +/*!**********************************************************!*\ + !*** ./node_modules/diffie-hellman/lib/generatePrime.js ***! + \**********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var randomBytes = __webpack_require__(/*! randombytes */ "./node_modules/randombytes/browser.js"); +module.exports = findPrime; +findPrime.simpleSieve = simpleSieve; +findPrime.fermatTest = fermatTest; +var BN = __webpack_require__(/*! bn.js */ "./node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js"); +var TWENTYFOUR = new BN(24); +var MillerRabin = __webpack_require__(/*! miller-rabin */ "./node_modules/miller-rabin/lib/mr.js"); +var millerRabin = new MillerRabin(); +var ONE = new BN(1); +var TWO = new BN(2); +var FIVE = new BN(5); +var SIXTEEN = new BN(16); +var EIGHT = new BN(8); +var TEN = new BN(10); +var THREE = new BN(3); +var SEVEN = new BN(7); +var ELEVEN = new BN(11); +var FOUR = new BN(4); +var TWELVE = new BN(12); +var primes = null; + +function _getPrimes() { + if (primes !== null) + return primes; + + var limit = 0x100000; + var res = []; + res[0] = 2; + for (var i = 1, k = 3; k < limit; k += 2) { + var sqrt = Math.ceil(Math.sqrt(k)); + for (var j = 0; j < i && res[j] <= sqrt; j++) + if (k % res[j] === 0) + break; + + if (i !== j && res[j] <= sqrt) + continue; + + res[i++] = k; + } + primes = res; + return res; +} + +function simpleSieve(p) { + var primes = _getPrimes(); + + for (var i = 0; i < primes.length; i++) + if (p.modn(primes[i]) === 0) { + if (p.cmpn(primes[i]) === 0) { + return true; + } else { + return false; + } + } + + return true; +} + +function fermatTest(p) { + var red = BN.mont(p); + return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0; +} + +function findPrime(bits, gen) { + if (bits < 16) { + // this is what openssl does + if (gen === 2 || gen === 5) { + return new BN([0x8c, 0x7b]); + } else { + return new BN([0x8c, 0x27]); + } + } + gen = new BN(gen); + + var num, n2; + + while (true) { + num = new BN(randomBytes(Math.ceil(bits / 8))); + while (num.bitLength() > bits) { + num.ishrn(1); + } + if (num.isEven()) { + num.iadd(ONE); + } + if (!num.testn(1)) { + num.iadd(TWO); + } + if (!gen.cmp(TWO)) { + while (num.mod(TWENTYFOUR).cmp(ELEVEN)) { + num.iadd(FOUR); + } + } else if (!gen.cmp(FIVE)) { + while (num.mod(TEN).cmp(THREE)) { + num.iadd(FOUR); + } + } + n2 = num.shrn(1); + if (simpleSieve(n2) && simpleSieve(num) && + fermatTest(n2) && fermatTest(num) && + millerRabin.test(n2) && millerRabin.test(num)) { + return num; + } + } + +} + + +/***/ }), + +/***/ "./node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js": +/*!******************************************************************!*\ + !*** ./node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js ***! + \******************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(/*! buffer */ "?e7e4").Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [ 0 ]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // 'A' - 'F' + if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + // '0' - '9' + } else { + return (c - 48) & 0xf; + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this.strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + r += c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + r += c - 17 + 0xa; + + // '0' - '9' + } else { + r += c; + } + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this.strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype.strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + BN.prototype.inspect = function inspect () { + return (this.red ? ''; + }; + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16); + }; + + BN.prototype.toBuffer = function toBuffer (endian, length) { + assert(typeof Buffer !== 'undefined'); + return this.toArrayLike(Buffer, endian, length); + }; + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + this.strip(); + var littleEndian = endian === 'le'; + var res = new ArrayType(reqLength); + + var b, i; + var q = this.clone(); + if (!littleEndian) { + // Assume big-endian + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[i] = b; + } + + for (; i < reqLength; i++) { + res[i] = 0; + } + } + + return res; + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] & (1 << wbit)) >>> wbit; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this.strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this.strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this.strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this.strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this.strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this.strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out.strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); + } + + function jumboMulTo (self, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; + + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out.strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this.strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this.strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this.strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) < num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this.strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this.strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q.strip(); + } + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modn = function modn (num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return acc; + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is BN v4 instance + r.strip(); + } else { + // r is BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + return a.umod(this.m)._forceRed(this); + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic.js": +/*!***********************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic.js ***! + \***********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +var elliptic = exports; + +elliptic.version = (__webpack_require__(/*! ../package.json */ "./node_modules/elliptic/package.json").version); +elliptic.utils = __webpack_require__(/*! ./elliptic/utils */ "./node_modules/elliptic/lib/elliptic/utils.js"); +elliptic.rand = __webpack_require__(/*! brorand */ "./node_modules/brorand/index.js"); +elliptic.curve = __webpack_require__(/*! ./elliptic/curve */ "./node_modules/elliptic/lib/elliptic/curve/index.js"); +elliptic.curves = __webpack_require__(/*! ./elliptic/curves */ "./node_modules/elliptic/lib/elliptic/curves.js"); + +// Protocols +elliptic.ec = __webpack_require__(/*! ./elliptic/ec */ "./node_modules/elliptic/lib/elliptic/ec/index.js"); +elliptic.eddsa = __webpack_require__(/*! ./elliptic/eddsa */ "./node_modules/elliptic/lib/elliptic/eddsa/index.js"); + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic/curve/base.js": +/*!**********************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/curve/base.js ***! + \**********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var BN = __webpack_require__(/*! bn.js */ "./node_modules/elliptic/node_modules/bn.js/lib/bn.js"); +var utils = __webpack_require__(/*! ../utils */ "./node_modules/elliptic/lib/elliptic/utils.js"); +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); + + // Use Montgomery, when there is no fast reduction for the prime + this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p); + + // Useful for many curves + this.zero = new BN(0).toRed(this.red); + this.one = new BN(1).toRed(this.red); + this.two = new BN(2).toRed(this.red); + + // Curve configuration, optional + this.n = conf.n && new BN(conf.n, 16); + this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); + + // Temporary arrays + this._wnafT1 = new Array(4); + this._wnafT2 = new Array(4); + this._wnafT3 = new Array(4); + this._wnafT4 = new Array(4); + + this._bitLength = this.n ? this.n.bitLength() : 0; + + // Generalized Greg Maxwell's trick + var adjustCount = this.n && this.p.div(this.n); + if (!adjustCount || adjustCount.cmpn(100) > 0) { + this.redN = null; + } else { + this._maxwellTrick = true; + this.redN = this.n.toRed(this.red); + } +} +module.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; + + // Translate into more windowed form + var repr = []; + var j; + var nafW; + for (j = 0; j < naf.length; j += doubles.step) { + nafW = 0; + for (var l = j + doubles.step - 1; l >= j; l--) + nafW = (nafW << 1) + naf[l]; + repr.push(nafW); + } + + var a = this.jpoint(null, null, null); + var b = this.jpoint(null, null, null); + for (var i = I; i > 0; i--) { + for (j = 0; j < repr.length; j++) { + nafW = repr[j]; + if (nafW === i) + b = b.mixedAdd(doubles.points[j]); + else if (nafW === -i) + b = b.mixedAdd(doubles.points[j].neg()); + } + a = a.add(b); + } + return a.toP(); +}; + +BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { + var w = 4; + + // Precompute window + var nafPoints = p._getNAFPoints(w); + w = nafPoints.wnd; + var wnd = nafPoints.points; + + // Get NAF form + var naf = getNAF(k, w, this._bitLength); + + // Add `this`*(N+1) for every w-NAF index + var acc = this.jpoint(null, null, null); + for (var i = naf.length - 1; i >= 0; i--) { + // Count zeroes + for (var l = 0; i >= 0 && naf[i] === 0; i--) + l++; + if (i >= 0) + l++; + acc = acc.dblp(l); + + if (i < 0) + break; + var z = naf[i]; + assert(z !== 0); + if (p.type === 'affine') { + // J +- P + if (z > 0) + acc = acc.mixedAdd(wnd[(z - 1) >> 1]); + else + acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg()); + } else { + // J +- J + if (z > 0) + acc = acc.add(wnd[(z - 1) >> 1]); + else + acc = acc.add(wnd[(-z - 1) >> 1].neg()); + } + } + return p.type === 'affine' ? acc.toP() : acc; +}; + +BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, + points, + coeffs, + len, + jacobianResult) { + var wndWidth = this._wnafT1; + var wnd = this._wnafT2; + var naf = this._wnafT3; + + // Fill all arrays + var max = 0; + var i; + var j; + var p; + for (i = 0; i < len; i++) { + p = points[i]; + var nafPoints = p._getNAFPoints(defW); + wndWidth[i] = nafPoints.wnd; + wnd[i] = nafPoints.points; + } + + // Comb small window NAFs + for (i = len - 1; i >= 1; i -= 2) { + var a = i - 1; + var b = i; + if (wndWidth[a] !== 1 || wndWidth[b] !== 1) { + naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength); + naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength); + max = Math.max(naf[a].length, max); + max = Math.max(naf[b].length, max); + continue; + } + + var comb = [ + points[a], /* 1 */ + null, /* 3 */ + null, /* 5 */ + points[b], /* 7 */ + ]; + + // Try to avoid Projective points, if possible + if (points[a].y.cmp(points[b].y) === 0) { + comb[1] = points[a].add(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].add(points[b].neg()); + } else { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } + + var index = [ + -3, /* -1 -1 */ + -1, /* -1 0 */ + -5, /* -1 1 */ + -7, /* 0 -1 */ + 0, /* 0 0 */ + 7, /* 0 1 */ + 5, /* 1 -1 */ + 1, /* 1 0 */ + 3, /* 1 1 */ + ]; + + var jsf = getJSF(coeffs[a], coeffs[b]); + max = Math.max(jsf[0].length, max); + naf[a] = new Array(max); + naf[b] = new Array(max); + for (j = 0; j < max; j++) { + var ja = jsf[0][j] | 0; + var jb = jsf[1][j] | 0; + + naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]; + naf[b][j] = 0; + wnd[a] = comb; + } + } + + var acc = this.jpoint(null, null, null); + var tmp = this._wnafT4; + for (i = max; i >= 0; i--) { + var k = 0; + + while (i >= 0) { + var zero = true; + for (j = 0; j < len; j++) { + tmp[j] = naf[j][i] | 0; + if (tmp[j] !== 0) + zero = false; + } + if (!zero) + break; + k++; + i--; + } + if (i >= 0) + k++; + acc = acc.dblp(k); + if (i < 0) + break; + + for (j = 0; j < len; j++) { + var z = tmp[j]; + p; + if (z === 0) + continue; + else if (z > 0) + p = wnd[j][(z - 1) >> 1]; + else if (z < 0) + p = wnd[j][(-z - 1) >> 1].neg(); + + if (p.type === 'affine') + acc = acc.mixedAdd(p); + else + acc = acc.add(p); + } + } + // Zeroify references + for (i = 0; i < len; i++) + wnd[i] = null; + + if (jacobianResult) + return acc; + else + return acc.toP(); +}; + +function BasePoint(curve, type) { + this.curve = curve; + this.type = type; + this.precomputed = null; +} +BaseCurve.BasePoint = BasePoint; + +BasePoint.prototype.eq = function eq(/*other*/) { + 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(); + + // uncompressed, hybrid-odd, hybrid-even + if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) && + bytes.length - 1 === 2 * len) { + if (bytes[0] === 0x06) + assert(bytes[bytes.length - 1] % 2 === 0); + else if (bytes[0] === 0x07) + 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] === 0x02 || bytes[0] === 0x03) && + bytes.length - 1 === len) { + return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03); + } + throw new Error('Unknown point format'); +}; + +BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) { + return this.encode(enc, true); +}; + +BasePoint.prototype._encode = function _encode(compact) { + var len = this.curve.p.byteLength(); + var x = this.getX().toArray('be', len); + + if (compact) + return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x); + + return [ 0x04 ].concat(x, this.getY().toArray('be', len)); +}; + +BasePoint.prototype.encode = function encode(enc, compact) { + return utils.encode(this._encode(compact), enc); +}; + +BasePoint.prototype.precompute = function precompute(power) { + if (this.precomputed) + return this; + + var precomputed = { + doubles: null, + naf: null, + beta: null, + }; + precomputed.naf = this._getNAFPoints(8); + precomputed.doubles = this._getDoubles(4, power); + precomputed.beta = this._getBeta(); + this.precomputed = precomputed; + + return this; +}; + +BasePoint.prototype._hasDoubles = function _hasDoubles(k) { + if (!this.precomputed) + return false; + + var doubles = this.precomputed.doubles; + if (!doubles) + return false; + + return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step); +}; + +BasePoint.prototype._getDoubles = function _getDoubles(step, power) { + if (this.precomputed && this.precomputed.doubles) + return this.precomputed.doubles; + + var doubles = [ this ]; + var acc = this; + for (var i = 0; i < power; i += step) { + for (var j = 0; j < step; j++) + acc = acc.dbl(); + doubles.push(acc); + } + return { + step: step, + points: doubles, + }; +}; + +BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { + if (this.precomputed && this.precomputed.naf) + return this.precomputed.naf; + + var res = [ this ]; + var max = (1 << wnd) - 1; + var dbl = max === 1 ? null : this.dbl(); + for (var i = 1; i < max; i++) + res[i] = res[i - 1].add(dbl); + return { + wnd: wnd, + points: res, + }; +}; + +BasePoint.prototype._getBeta = function _getBeta() { + return null; +}; + +BasePoint.prototype.dblp = function dblp(k) { + var r = this; + for (var i = 0; i < k; i++) + r = r.dbl(); + return r; +}; + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic/curve/edwards.js": +/*!*************************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/curve/edwards.js ***! + \*************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/elliptic/lib/elliptic/utils.js"); +var BN = __webpack_require__(/*! bn.js */ "./node_modules/elliptic/node_modules/bn.js/lib/bn.js"); +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +var Base = __webpack_require__(/*! ./base */ "./node_modules/elliptic/lib/elliptic/curve/base.js"); + +var assert = utils.assert; + +function EdwardsCurve(conf) { + // NOTE: Important as we are creating point in Base.call() + 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); +module.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); +}; + +// Just for compatibility with Short curve +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); + + // x^2 = (y^2 - c^2) / (c^2 d y^2 - a) + 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; + + // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2) + 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; + + // Use extended coordinates + 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() { + // XXX This code assumes that zero is always zero in red + 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() { + // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html + // #doubling-dbl-2008-hwcd + // 4M + 4S + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = 2 * Z1^2 + var c = this.z.redSqr(); + c = c.redIAdd(c); + // D = a * A + var d = this.curve._mulA(a); + // E = (X1 + Y1)^2 - A - B + var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); + // G = D + B + var g = d.redAdd(b); + // F = G - C + var f = g.redSub(c); + // H = D - B + var h = d.redSub(b); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projDbl = function _projDbl() { + // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html + // #doubling-dbl-2008-bbjlp + // #doubling-dbl-2007-bl + // and others + // Generally 3M + 4S or 2M + 4S + + // B = (X1 + Y1)^2 + var b = this.x.redAdd(this.y).redSqr(); + // C = X1^2 + var c = this.x.redSqr(); + // D = Y1^2 + var d = this.y.redSqr(); + + var nx; + var ny; + var nz; + var e; + var h; + var j; + if (this.curve.twisted) { + // E = a * C + e = this.curve._mulA(c); + // F = E + D + var f = e.redAdd(d); + if (this.zOne) { + // X3 = (B - C - D) * (F - 2) + nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); + // Y3 = F * (E - D) + ny = f.redMul(e.redSub(d)); + // Z3 = F^2 - 2 * F + nz = f.redSqr().redSub(f).redSub(f); + } else { + // H = Z1^2 + h = this.z.redSqr(); + // J = F - 2 * H + j = f.redSub(h).redISub(h); + // X3 = (B-C-D)*J + nx = b.redSub(c).redISub(d).redMul(j); + // Y3 = F * (E - D) + ny = f.redMul(e.redSub(d)); + // Z3 = F * J + nz = f.redMul(j); + } + } else { + // E = C + D + e = c.redAdd(d); + // H = (c * Z1)^2 + h = this.curve._mulC(this.z).redSqr(); + // J = E - 2 * H + j = e.redSub(h).redSub(h); + // X3 = c * (B - E) * J + nx = this.curve._mulC(b.redISub(e)).redMul(j); + // Y3 = c * E * (C - D) + ny = this.curve._mulC(e).redMul(c.redISub(d)); + // Z3 = E * J + nz = e.redMul(j); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + // Double in extended coordinates + if (this.curve.extended) + return this._extDbl(); + else + return this._projDbl(); +}; + +Point.prototype._extAdd = function _extAdd(p) { + // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html + // #addition-add-2008-hwcd-3 + // 8M + + // A = (Y1 - X1) * (Y2 - X2) + var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); + // B = (Y1 + X1) * (Y2 + X2) + var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); + // C = T1 * k * T2 + var c = this.t.redMul(this.curve.dd).redMul(p.t); + // D = Z1 * 2 * Z2 + var d = this.z.redMul(p.z.redAdd(p.z)); + // E = B - A + var e = b.redSub(a); + // F = D - C + var f = d.redSub(c); + // G = D + C + var g = d.redAdd(c); + // H = B + A + var h = b.redAdd(a); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projAdd = function _projAdd(p) { + // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html + // #addition-add-2008-bbjlp + // #addition-add-2007-bl + // 10M + 1S + + // A = Z1 * Z2 + var a = this.z.redMul(p.z); + // B = A^2 + var b = a.redSqr(); + // C = X1 * X2 + var c = this.x.redMul(p.x); + // D = Y1 * Y2 + var d = this.y.redMul(p.y); + // E = d * C * D + var e = this.curve.d.redMul(c).redMul(d); + // F = B - E + var f = b.redSub(e); + // G = B + E + var g = b.redAdd(e); + // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D) + 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) { + // Y3 = A * G * (D - a * C) + ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); + // Z3 = F * G + nz = f.redMul(g); + } else { + // Y3 = A * G * (D - C) + ny = a.redMul(g).redMul(d.redSub(c)); + // Z3 = c * F * G + 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; + + // Normalize coordinates + 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; + } +}; + +// Compatibility with BaseCurve +Point.prototype.toP = Point.prototype.normalize; +Point.prototype.mixedAdd = Point.prototype.add; + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic/curve/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/curve/index.js ***! + \***********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +var curve = exports; + +curve.base = __webpack_require__(/*! ./base */ "./node_modules/elliptic/lib/elliptic/curve/base.js"); +curve.short = __webpack_require__(/*! ./short */ "./node_modules/elliptic/lib/elliptic/curve/short.js"); +curve.mont = __webpack_require__(/*! ./mont */ "./node_modules/elliptic/lib/elliptic/curve/mont.js"); +curve.edwards = __webpack_require__(/*! ./edwards */ "./node_modules/elliptic/lib/elliptic/curve/edwards.js"); + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic/curve/mont.js": +/*!**********************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/curve/mont.js ***! + \**********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var BN = __webpack_require__(/*! bn.js */ "./node_modules/elliptic/node_modules/bn.js/lib/bn.js"); +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +var Base = __webpack_require__(/*! ./base */ "./node_modules/elliptic/lib/elliptic/curve/base.js"); + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/elliptic/lib/elliptic/utils.js"); + +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); +module.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() { + // No-op +}; + +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() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; + +Point.prototype.dbl = function dbl() { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3 + // 2M + 2S + 4A + + // A = X1 + Z1 + var a = this.x.redAdd(this.z); + // AA = A^2 + var aa = a.redSqr(); + // B = X1 - Z1 + var b = this.x.redSub(this.z); + // BB = B^2 + var bb = b.redSqr(); + // C = AA - BB + var c = aa.redSub(bb); + // X3 = AA * BB + var nx = aa.redMul(bb); + // Z3 = C * (BB + A24 * C) + 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) { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3 + // 4M + 2S + 6A + + // A = X2 + Z2 + var a = this.x.redAdd(this.z); + // B = X2 - Z2 + var b = this.x.redSub(this.z); + // C = X3 + Z3 + var c = p.x.redAdd(p.z); + // D = X3 - Z3 + var d = p.x.redSub(p.z); + // DA = D * A + var da = d.redMul(a); + // CB = C * B + var cb = c.redMul(b); + // X5 = Z1 * (DA + CB)^2 + var nx = diff.z.redMul(da.redAdd(cb).redSqr()); + // Z5 = X1 * (DA - CB)^2 + 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; // (N / 2) * Q + Q + var b = this.curve.point(null, null); // (N / 2) * Q + var c = this; // Q + + 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) { + // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q + a = a.diffAdd(b, c); + // N * Q = 2 * ((N / 2) * Q + Q)) + b = b.dbl(); + } else { + // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q) + b = a.diffAdd(b, c); + // N * Q + Q = 2 * ((N / 2) * Q + Q) + 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() { + // Normalize coordinates + this.normalize(); + + return this.x.fromRed(); +}; + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic/curve/short.js": +/*!***********************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/curve/short.js ***! + \***********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/elliptic/lib/elliptic/utils.js"); +var BN = __webpack_require__(/*! bn.js */ "./node_modules/elliptic/node_modules/bn.js/lib/bn.js"); +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +var Base = __webpack_require__(/*! ./base */ "./node_modules/elliptic/lib/elliptic/curve/base.js"); + +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; + + // If the curve is endomorphic, precalculate beta and lambda + this.endo = this._getEndomorphism(conf); + this._endoWnafT1 = new Array(4); + this._endoWnafT2 = new Array(4); +} +inherits(ShortCurve, Base); +module.exports = ShortCurve; + +ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { + // No efficient endomorphism + if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) + return; + + // Compute beta and lambda, that lambda * P = (beta * Px; Py) + var beta; + var lambda; + if (conf.beta) { + beta = new BN(conf.beta, 16).toRed(this.red); + } else { + var betas = this._getEndoRoots(this.p); + // Choose the smallest beta + beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; + beta = beta.toRed(this.red); + } + if (conf.lambda) { + lambda = new BN(conf.lambda, 16); + } else { + // Choose the lambda that is matching selected beta + var lambdas = this._getEndoRoots(this.n); + if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) { + lambda = lambdas[0]; + } else { + lambda = lambdas[1]; + assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); + } + } + + // Get basis vectors, used for balanced length-two representation + var basis; + if (conf.basis) { + basis = conf.basis.map(function(vec) { + return { + a: new BN(vec.a, 16), + b: new BN(vec.b, 16), + }; + }); + } else { + basis = this._getEndoBasis(lambda); + } + + return { + beta: beta, + lambda: lambda, + basis: basis, + }; +}; + +ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { + // Find roots of for x^2 + x + 1 in F + // Root = (-1 +- Sqrt(-3)) / 2 + // + var red = num === this.p ? this.red : BN.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) { + // aprxSqrt >= sqrt(this.n) + var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); + + // 3.74 + // Run EGCD, until r(L + 1) < aprxSqrt + var u = lambda; + var v = this.n.clone(); + var x1 = new BN(1); + var y1 = new BN(0); + var x2 = new BN(0); + var y2 = new BN(1); + + // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n) + var a0; + var b0; + // First vector + var a1; + var b1; + // Second vector + var a2; + var b2; + + var prevR; + var i = 0; + var r; + var x; + while (u.cmpn(0) !== 0) { + var q = v.div(u); + r = v.sub(q.mul(u)); + x = x2.sub(q.mul(x1)); + var y = y2.sub(q.mul(y1)); + + if (!a1 && r.cmp(aprxSqrt) < 0) { + a0 = prevR.neg(); + b0 = x1; + a1 = r.neg(); + b1 = x; + } else if (a1 && ++i === 2) { + break; + } + prevR = r; + + v = u; + u = r; + x2 = x1; + x1 = x; + y2 = y1; + y1 = y; + } + a2 = r.neg(); + b2 = x; + + var len1 = a1.sqr().add(b1.sqr()); + var len2 = a2.sqr().add(b2.sqr()); + if (len2.cmp(len1) >= 0) { + a2 = a0; + b2 = b0; + } + + // Normalize signs + if (a1.negative) { + a1 = a1.neg(); + b1 = b1.neg(); + } + if (a2.negative) { + a2 = a2.neg(); + b2 = b2.neg(); + } + + return [ + { a: a1, b: b1 }, + { a: a2, b: b2 }, + ]; +}; + +ShortCurve.prototype._endoSplit = function _endoSplit(k) { + var basis = this.endo.basis; + var v1 = basis[0]; + var v2 = basis[1]; + + var c1 = v2.b.mul(k).divRound(this.n); + var c2 = v1.b.neg().mul(k).divRound(this.n); + + var p1 = c1.mul(v1.a); + var p2 = c2.mul(v2.a); + var q1 = c1.mul(v1.b); + var q2 = c2.mul(v2.b); + + // Calculate answer + var k1 = k.sub(p1).sub(p2); + var k2 = q1.add(q2).neg(); + return { k1: k1, k2: k2 }; +}; + +ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(x, 16); + if (!x.red) + x = x.toRed(this.red); + + var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error('invalid point'); + + // XXX Is there any way to tell if the number is odd without converting it + // to non-red form? + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + + return this.point(x, y); +}; + +ShortCurve.prototype.validate = function validate(point) { + if (point.inf) + return true; + + var x = point.x; + var y = point.y; + + var ax = this.a.redMul(x); + var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b); + return y.redSqr().redISub(rhs).cmpn(0) === 0; +}; + +ShortCurve.prototype._endoWnafMulAdd = + function _endoWnafMulAdd(points, coeffs, jacobianResult) { + var npoints = this._endoWnafT1; + var ncoeffs = this._endoWnafT2; + for (var i = 0; i < points.length; i++) { + var split = this._endoSplit(coeffs[i]); + var p = points[i]; + var beta = p._getBeta(); + + if (split.k1.negative) { + split.k1.ineg(); + p = p.neg(true); + } + if (split.k2.negative) { + split.k2.ineg(); + beta = beta.neg(true); + } + + npoints[i * 2] = p; + npoints[i * 2 + 1] = beta; + ncoeffs[i * 2] = split.k1; + ncoeffs[i * 2 + 1] = split.k2; + } + var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult); + + // Clean-up references to points and coefficients + for (var j = 0; j < i * 2; j++) { + npoints[j] = null; + ncoeffs[j] = null; + } + return res; + }; + +function Point(curve, x, y, isRed) { + Base.BasePoint.call(this, curve, 'affine'); + if (x === null && y === null) { + this.x = null; + this.y = null; + this.inf = true; + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + // Force redgomery representation when loading from JSON + if (isRed) { + this.x.forceRed(this.curve.red); + this.y.forceRed(this.curve.red); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + this.inf = false; + } +} +inherits(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(obj) { + return curve.point(obj[0], obj[1], red); + } + + var pre = obj[2]; + res.precomputed = { + beta: null, + doubles: pre.doubles && { + step: pre.doubles.step, + points: [ res ].concat(pre.doubles.points.map(obj2point)), + }, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: [ res ].concat(pre.naf.points.map(obj2point)), + }, + }; + return res; +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + return this.inf; +}; + +Point.prototype.add = function add(p) { + // O + P = P + if (this.inf) + return p; + + // P + O = P + if (p.inf) + return this; + + // P + P = 2P + if (this.eq(p)) + return this.dbl(); + + // P + (-P) = O + if (this.neg().eq(p)) + return this.curve.point(null, null); + + // P + Q = O + if (this.x.cmp(p.x) === 0) + return this.curve.point(null, null); + + var c = this.y.redSub(p.y); + if (c.cmpn(0) !== 0) + c = c.redMul(this.x.redSub(p.x).redInvm()); + var nx = c.redSqr().redISub(this.x).redISub(p.x); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.dbl = function dbl() { + if (this.inf) + return this; + + // 2P = O + var ys1 = this.y.redAdd(this.y); + if (ys1.cmpn(0) === 0) + return this.curve.point(null, null); + + var a = this.curve.a; + + var x2 = this.x.redSqr(); + var dyinv = ys1.redInvm(); + var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv); + + var nx = c.redSqr().redISub(this.x.redAdd(this.x)); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.getX = function getX() { + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + return this.y.fromRed(); +}; + +Point.prototype.mul = function mul(k) { + k = new BN(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) { + // O + P = P + if (this.isInfinity()) + return p; + + // P + O = P + if (p.isInfinity()) + return this; + + // 12M + 4S + 7A + var pz2 = p.z.redSqr(); + var z2 = this.z.redSqr(); + var u1 = this.x.redMul(pz2); + var u2 = p.x.redMul(z2); + var s1 = this.y.redMul(pz2.redMul(p.z)); + var s2 = p.y.redMul(z2.redMul(this.z)); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(p.z).redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mixedAdd = function mixedAdd(p) { + // O + P = P + if (this.isInfinity()) + return p.toJ(); + + // P + O = P + if (p.isInfinity()) + return this; + + // 8M + 3S + 7A + var z2 = this.z.redSqr(); + var u1 = this.x; + var u2 = p.x.redMul(z2); + var s1 = this.y; + var s2 = p.y.redMul(z2).redMul(this.z); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.dblp = function dblp(pow) { + if (pow === 0) + return this; + if (this.isInfinity()) + return this; + if (!pow) + return this.dbl(); + + var i; + if (this.curve.zeroA || this.curve.threeA) { + var r = this; + for (i = 0; i < pow; i++) + r = r.dbl(); + return r; + } + + // 1M + 2S + 1A + N * (4S + 5M + 8A) + // N = 1 => 6M + 6S + 9A + var a = this.curve.a; + var tinv = this.curve.tinv; + + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + // Reuse results + var jyd = jy.redAdd(jy); + for (i = 0; i < pow; i++) { + var jx2 = jx.redSqr(); + var jyd2 = jyd.redSqr(); + var jyd4 = jyd2.redSqr(); + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var t1 = jx.redMul(jyd2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + var dny = c.redMul(t2); + dny = dny.redIAdd(dny).redISub(jyd4); + var nz = jyd.redMul(jz); + if (i + 1 < pow) + jz4 = jz4.redMul(jyd4); + + jx = nx; + jz = nz; + jyd = dny; + } + + return this.curve.jpoint(jx, jyd.redMul(tinv), jz); +}; + +JPoint.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + if (this.curve.zeroA) + return this._zeroDbl(); + else if (this.curve.threeA) + return this._threeDbl(); + else + return this._dbl(); +}; + +JPoint.prototype._zeroDbl = function _zeroDbl() { + var nx; + var ny; + var nz; + // Z = 1 + if (this.zOne) { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html + // #doubling-mdbl-2007-bl + // 1M + 5S + 14A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // T = M ^ 2 - 2*S + var t = m.redSqr().redISub(s).redISub(s); + + // 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + + // X3 = T + nx = t; + // Y3 = M * (S - T) - 8 * YYYY + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2*Y1 + nz = this.y.redAdd(this.y); + } else { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html + // #doubling-dbl-2009-l + // 2M + 5S + 13A + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = B^2 + var c = b.redSqr(); + // D = 2 * ((X1 + B)^2 - A - C) + var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); + d = d.redIAdd(d); + // E = 3 * A + var e = a.redAdd(a).redIAdd(a); + // F = E^2 + var f = e.redSqr(); + + // 8 * C + var c8 = c.redIAdd(c); + c8 = c8.redIAdd(c8); + c8 = c8.redIAdd(c8); + + // X3 = F - 2 * D + nx = f.redISub(d).redISub(d); + // Y3 = E * (D - X3) - 8 * C + ny = e.redMul(d.redISub(nx)).redISub(c8); + // Z3 = 2 * Y1 * Z1 + nz = this.y.redMul(this.z); + nz = nz.redIAdd(nz); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._threeDbl = function _threeDbl() { + var nx; + var ny; + var nz; + // Z = 1 + if (this.zOne) { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html + // #doubling-mdbl-2007-bl + // 1M + 5S + 15A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a + var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); + // T = M^2 - 2 * S + var t = m.redSqr().redISub(s).redISub(s); + // X3 = T + nx = t; + // Y3 = M * (S - T) - 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2 * Y1 + nz = this.y.redAdd(this.y); + } else { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b + // 3M + 5S + + // delta = Z1^2 + var delta = this.z.redSqr(); + // gamma = Y1^2 + var gamma = this.y.redSqr(); + // beta = X1 * gamma + var beta = this.x.redMul(gamma); + // alpha = 3 * (X1 - delta) * (X1 + delta) + var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); + alpha = alpha.redAdd(alpha).redIAdd(alpha); + // X3 = alpha^2 - 8 * beta + var beta4 = beta.redIAdd(beta); + beta4 = beta4.redIAdd(beta4); + var beta8 = beta4.redAdd(beta4); + nx = alpha.redSqr().redISub(beta8); + // Z3 = (Y1 + Z1)^2 - gamma - delta + nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); + // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2 + var ggamma8 = gamma.redSqr(); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._dbl = function _dbl() { + var a = this.curve.a; + + // 4M + 6S + 10A + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + var jx2 = jx.redSqr(); + var jy2 = jy.redSqr(); + + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var jxd4 = jx.redAdd(jx); + jxd4 = jxd4.redIAdd(jxd4); + var t1 = jxd4.redMul(jy2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + + var jyd8 = jy2.redSqr(); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + var ny = c.redMul(t2).redISub(jyd8); + var nz = jy.redAdd(jy).redMul(jz); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.trpl = function trpl() { + if (!this.curve.zeroA) + return this.dbl().add(this); + + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl + // 5M + 10S + ... + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // ZZ = Z1^2 + var zz = this.z.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // M = 3 * XX + a * ZZ2; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // MM = M^2 + var mm = m.redSqr(); + // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM + var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + e = e.redIAdd(e); + e = e.redAdd(e).redIAdd(e); + e = e.redISub(mm); + // EE = E^2 + var ee = e.redSqr(); + // T = 16*YYYY + var t = yyyy.redIAdd(yyyy); + t = t.redIAdd(t); + t = t.redIAdd(t); + t = t.redIAdd(t); + // U = (M + E)^2 - MM - EE - T + var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); + // X3 = 4 * (X1 * EE - 4 * YY * U) + var yyu4 = yy.redMul(u); + yyu4 = yyu4.redIAdd(yyu4); + yyu4 = yyu4.redIAdd(yyu4); + var nx = this.x.redMul(ee).redISub(yyu4); + nx = nx.redIAdd(nx); + nx = nx.redIAdd(nx); + // Y3 = 8 * Y1 * (U * (T - U) - E * EE) + var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee))); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + // Z3 = (Z1 + E)^2 - ZZ - EE + var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mul = function mul(k, kbase) { + k = new BN(k, kbase); + + return this.curve._wnafMul(this, k); +}; + +JPoint.prototype.eq = function eq(p) { + if (p.type === 'affine') + return this.eq(p.toJ()); + + if (this === p) + return true; + + // x1 * z2^2 == x2 * z1^2 + var z2 = this.z.redSqr(); + var pz2 = p.z.redSqr(); + if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) + return false; + + // y1 * z2^3 == y2 * z1^3 + var z3 = z2.redMul(this.z); + var pz3 = pz2.redMul(p.z); + return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0; +}; + +JPoint.prototype.eqXToP = function eqXToP(x) { + var zs = this.z.redSqr(); + var rx = x.toRed(this.curve.red).redMul(zs); + if (this.x.cmp(rx) === 0) + return true; + + var xc = x.clone(); + var t = this.curve.redN.redMul(zs); + for (;;) { + xc.iadd(this.curve.n); + if (xc.cmp(this.curve.p) >= 0) + return false; + + rx.redIAdd(t); + if (this.x.cmp(rx) === 0) + return true; + } +}; + +JPoint.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +JPoint.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic/curves.js": +/*!******************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/curves.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +var curves = exports; + +var hash = __webpack_require__(/*! hash.js */ "./node_modules/hash.js/lib/hash.js"); +var curve = __webpack_require__(/*! ./curve */ "./node_modules/elliptic/lib/elliptic/curve/index.js"); +var utils = __webpack_require__(/*! ./utils */ "./node_modules/elliptic/lib/elliptic/utils.js"); + +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(name, options) { + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + get: function() { + var curve = new PresetCurve(options); + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + value: curve, + }); + return curve; + }, + }); +} + +defineCurve('p192', { + type: 'short', + prime: 'p192', + p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc', + b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1', + n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831', + hash: hash.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 = __webpack_require__(/*! ./precomputed/secp256k1 */ "./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js"); +} catch (e) { + pre = undefined; +} + +defineCurve('secp256k1', { + type: 'short', + prime: 'k256', + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + a: '0', + b: '7', + n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141', + h: '1', + hash: hash.sha256, + + // Precomputed endomorphism + beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee', + lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72', + basis: [ + { + a: '3086d221a7d46bcde86c90e49284eb15', + b: '-e4437ed6010e88286f547fa90abfe4c3', + }, + { + a: '114ca50f7a8e2f3f657c1108d9d44cfd8', + b: '3086d221a7d46bcde86c90e49284eb15', + }, + ], + + gRed: false, + g: [ + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', + pre, + ], +}); + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic/ec/index.js": +/*!********************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/ec/index.js ***! + \********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var BN = __webpack_require__(/*! bn.js */ "./node_modules/elliptic/node_modules/bn.js/lib/bn.js"); +var HmacDRBG = __webpack_require__(/*! hmac-drbg */ "./node_modules/hmac-drbg/lib/hmac-drbg.js"); +var utils = __webpack_require__(/*! ../utils */ "./node_modules/elliptic/lib/elliptic/utils.js"); +var curves = __webpack_require__(/*! ../curves */ "./node_modules/elliptic/lib/elliptic/curves.js"); +var rand = __webpack_require__(/*! brorand */ "./node_modules/brorand/index.js"); +var assert = utils.assert; + +var KeyPair = __webpack_require__(/*! ./key */ "./node_modules/elliptic/lib/elliptic/ec/key.js"); +var Signature = __webpack_require__(/*! ./signature */ "./node_modules/elliptic/lib/elliptic/ec/signature.js"); + +function EC(options) { + if (!(this instanceof EC)) + return new EC(options); + + // Shortcut `elliptic.ec(curve-name)` + if (typeof options === 'string') { + assert(Object.prototype.hasOwnProperty.call(curves, options), + 'Unknown curve ' + options); + + options = curves[options]; + } + + // Shortcut for `elliptic.ec(elliptic.curves.curveName)` + 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; + + // Point on curve + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); + + // Hash for function for DRBG + this.hash = options.hash || options.curve.hash; +} +module.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 = {}; + + // Instantiate Hmac_DRBG + var drbg = new HmacDRBG({ + hash: this.hash, + pers: options.pers, + persEnc: options.persEnc || 'utf8', + entropy: options.entropy || rand(this.hash.hmacStrength), + entropyEnc: options.entropy && options.entropyEnc || 'utf8', + nonce: this.n.toArray(), + }); + + var bytes = this.n.byteLength(); + var ns2 = this.n.sub(new BN(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)); + + // Zero-extend key to provide enough entropy + var bytes = this.n.byteLength(); + var bkey = key.getPrivate().toArray('be', bytes); + + // Zero-extend nonce to have the same byte size as N + var nonce = msg.toArray('be', bytes); + + // Instantiate Hmac_DRBG + var drbg = new HmacDRBG({ + hash: this.hash, + entropy: bkey, + nonce: nonce, + pers: options.pers, + persEnc: options.persEnc || 'utf8', + }); + + // Number of bytes to generate + var ns1 = this.n.sub(new BN(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); + + // Use complement of `s`, if it is > `n / 2` + if (options.canonical && s.cmp(this.nh) > 0) { + s = this.n.sub(s); + recoveryParam ^= 1; + } + + return new Signature({ r: r, s: s, recoveryParam: recoveryParam }); + } +}; + +EC.prototype.verify = function verify(msg, signature, key, enc) { + msg = this._truncateToN(new BN(msg, 16)); + key = this.keyFromPublic(key, enc); + signature = new Signature(signature, 'hex'); + + // Perform primitive values validation + 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; + + // Validate signature + var sinv = s.invm(this.n); + var u1 = sinv.mul(msg).umod(this.n); + var u2 = sinv.mul(r).umod(this.n); + var p; + + if (!this.curve._maxwellTrick) { + p = this.g.mulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + return p.getX().umod(this.n).cmp(r) === 0; + } + + // NOTE: Greg Maxwell's trick, inspired by: + // https://git.io/vad3K + + p = this.g.jmulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + // Compare `p.x` of Jacobian point with `r`, + // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the + // inverse of `p.z^2` + return p.eqXToP(r); +}; + +EC.prototype.recoverPubKey = function(msg, signature, 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; + + // A set LSB signifies that the y-coordinate is odd + var isYOdd = j & 1; + var isSecondKey = j >> 1; + if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) + throw new Error('Unable to find sencond key candinate'); + + // 1.1. Let x = r + jn. + if (isSecondKey) + r = this.curve.pointFromX(r.add(this.curve.n), isYOdd); + else + r = this.curve.pointFromX(r, isYOdd); + + var rInv = signature.r.invm(n); + var s1 = n.sub(e).mul(rInv).umod(n); + var s2 = s.mul(rInv).umod(n); + + // 1.6.1 Compute Q = r^-1 (sR - eG) + // Q = r^-1 (sR + -eG) + return this.g.mulAdd(s1, r, s2); +}; + +EC.prototype.getKeyRecoveryParam = function(e, signature, 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 (e) { + continue; + } + + if (Qprime.eq(Q)) + return i; + } + throw new Error('Unable to find valid recovery factor'); +}; + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic/ec/key.js": +/*!******************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/ec/key.js ***! + \******************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var BN = __webpack_require__(/*! bn.js */ "./node_modules/elliptic/node_modules/bn.js/lib/bn.js"); +var utils = __webpack_require__(/*! ../utils */ "./node_modules/elliptic/lib/elliptic/utils.js"); +var assert = utils.assert; + +function KeyPair(ec, options) { + this.ec = ec; + this.priv = null; + this.pub = null; + + // KeyPair(ec, { priv: ..., pub: ... }) + if (options.priv) + this._importPrivate(options.priv, options.privEnc); + if (options.pub) + this._importPublic(options.pub, options.pubEnc); +} +module.exports = KeyPair; + +KeyPair.fromPublic = function fromPublic(ec, pub, enc) { + if (pub instanceof KeyPair) + return pub; + + return new KeyPair(ec, { + pub: pub, + pubEnc: enc, + }); +}; + +KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) { + if (priv instanceof KeyPair) + return priv; + + return new KeyPair(ec, { + priv: priv, + privEnc: enc, + }); +}; + +KeyPair.prototype.validate = function validate() { + var pub = this.getPublic(); + + if (pub.isInfinity()) + return { result: false, reason: 'Invalid public key' }; + if (!pub.validate()) + return { result: false, reason: 'Public key is not a point' }; + if (!pub.mul(this.ec.curve.n).isInfinity()) + return { result: false, reason: 'Public key * N != O' }; + + return { result: true, reason: null }; +}; + +KeyPair.prototype.getPublic = function getPublic(compact, enc) { + // compact is optional argument + if (typeof compact === 'string') { + enc = compact; + compact = null; + } + + if (!this.pub) + this.pub = this.ec.g.mul(this.priv); + + if (!enc) + return this.pub; + + return this.pub.encode(enc, compact); +}; + +KeyPair.prototype.getPrivate = function getPrivate(enc) { + if (enc === 'hex') + return this.priv.toString(16, 2); + else + return this.priv; +}; + +KeyPair.prototype._importPrivate = function _importPrivate(key, enc) { + this.priv = new BN(key, enc || 16); + + // Ensure that the priv won't be bigger than n, otherwise we may fail + // in fixed multiplication method + this.priv = this.priv.umod(this.ec.curve.n); +}; + +KeyPair.prototype._importPublic = function _importPublic(key, enc) { + if (key.x || key.y) { + // Montgomery points only have an `x` coordinate. + // Weierstrass/Edwards points on the other hand have both `x` and + // `y` coordinates. + if (this.ec.curve.type === 'mont') { + assert(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); +}; + +// ECDH +KeyPair.prototype.derive = function derive(pub) { + if(!pub.validate()) { + assert(pub.validate(), 'public point not validated'); + } + return pub.mul(this.priv).getX(); +}; + +// ECDSA +KeyPair.prototype.sign = function sign(msg, enc, options) { + return this.ec.sign(msg, this, enc, options); +}; + +KeyPair.prototype.verify = function verify(msg, signature) { + return this.ec.verify(msg, signature, this); +}; + +KeyPair.prototype.inspect = function inspect() { + return ''; +}; + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic/ec/signature.js": +/*!************************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/ec/signature.js ***! + \************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var BN = __webpack_require__(/*! bn.js */ "./node_modules/elliptic/node_modules/bn.js/lib/bn.js"); + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/elliptic/lib/elliptic/utils.js"); +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 === undefined) + this.recoveryParam = null; + else + this.recoveryParam = options.recoveryParam; +} +module.exports = Signature; + +function Position() { + this.place = 0; +} + +function getLength(buf, p) { + var initial = buf[p.place++]; + if (!(initial & 0x80)) { + return initial; + } + var octetLen = initial & 0xf; + + // Indefinite length or overflow + if (octetLen === 0 || octetLen > 4) { + return false; + } + + var val = 0; + for (var i = 0, off = p.place; i < octetLen; i++, off++) { + val <<= 8; + val |= buf[off]; + val >>>= 0; + } + + // Leading zeroes + if (val <= 0x7f) { + return false; + } + + p.place = off; + return val; +} + +function rmPadding(buf) { + var i = 0; + var len = buf.length - 1; + while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) { + i++; + } + if (i === 0) { + return buf; + } + return buf.slice(i); +} + +Signature.prototype._importDER = function _importDER(data, enc) { + data = utils.toArray(data, enc); + var p = new Position(); + if (data[p.place++] !== 0x30) { + return false; + } + var len = getLength(data, p); + if (len === false) { + return false; + } + if ((len + p.place) !== data.length) { + return false; + } + if (data[p.place++] !== 0x02) { + return false; + } + var rlen = getLength(data, p); + if (rlen === false) { + return false; + } + var r = data.slice(p.place, rlen + p.place); + p.place += rlen; + if (data[p.place++] !== 0x02) { + return false; + } + var slen = getLength(data, p); + if (slen === false) { + return false; + } + if (data.length !== slen + p.place) { + return false; + } + var s = data.slice(p.place, slen + p.place); + if (r[0] === 0) { + if (r[1] & 0x80) { + r = r.slice(1); + } else { + // Leading zeroes + return false; + } + } + if (s[0] === 0) { + if (s[1] & 0x80) { + s = s.slice(1); + } else { + // Leading zeroes + return false; + } + } + + this.r = new BN(r); + this.s = new BN(s); + this.recoveryParam = null; + + return true; +}; + +function constructLength(arr, len) { + if (len < 0x80) { + arr.push(len); + return; + } + var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); + arr.push(octets | 0x80); + while (--octets) { + arr.push((len >>> (octets << 3)) & 0xff); + } + arr.push(len); +} + +Signature.prototype.toDER = function toDER(enc) { + var r = this.r.toArray(); + var s = this.s.toArray(); + + // Pad values + if (r[0] & 0x80) + r = [ 0 ].concat(r); + // Pad values + if (s[0] & 0x80) + s = [ 0 ].concat(s); + + r = rmPadding(r); + s = rmPadding(s); + + while (!s[0] && !(s[1] & 0x80)) { + s = s.slice(1); + } + var arr = [ 0x02 ]; + constructLength(arr, r.length); + arr = arr.concat(r); + arr.push(0x02); + constructLength(arr, s.length); + var backHalf = arr.concat(s); + var res = [ 0x30 ]; + constructLength(res, backHalf.length); + res = res.concat(backHalf); + return utils.encode(res, enc); +}; + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic/eddsa/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/eddsa/index.js ***! + \***********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var hash = __webpack_require__(/*! hash.js */ "./node_modules/hash.js/lib/hash.js"); +var curves = __webpack_require__(/*! ../curves */ "./node_modules/elliptic/lib/elliptic/curves.js"); +var utils = __webpack_require__(/*! ../utils */ "./node_modules/elliptic/lib/elliptic/utils.js"); +var assert = utils.assert; +var parseBytes = utils.parseBytes; +var KeyPair = __webpack_require__(/*! ./key */ "./node_modules/elliptic/lib/elliptic/eddsa/key.js"); +var Signature = __webpack_require__(/*! ./signature */ "./node_modules/elliptic/lib/elliptic/eddsa/signature.js"); + +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; +} + +module.exports = EDDSA; + +/** +* @param {Array|String} message - message bytes +* @param {Array|String|KeyPair} secret - secret bytes or a keypair +* @returns {Signature} - signature +*/ +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: R, S: S, Rencoded: Rencoded }); +}; + +/** +* @param {Array} message - message bytes +* @param {Array|String|Signature} sig - sig bytes +* @param {Array|String|Point|KeyPair} pub - public key +* @returns {Boolean} - true if public key matches sig of message +*/ +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 hash = this.hash(); + for (var i = 0; i < arguments.length; i++) + hash.update(arguments[i]); + return utils.intFromLE(hash.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); +}; + +/** +* * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2 +* +* EDDSA defines methods for encoding and decoding points and integers. These are +* helper convenience methods, that pass along to utility functions implied +* parameters. +* +*/ +EDDSA.prototype.encodePoint = function encodePoint(point) { + var enc = point.getY().toArray('le', this.encodingLength); + enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 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] & ~0x80); + var xIsOdd = (bytes[lastIx] & 0x80) !== 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/eddsa/key.js": +/*!*********************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/eddsa/key.js ***! + \*********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/elliptic/lib/elliptic/utils.js"); +var assert = utils.assert; +var parseBytes = utils.parseBytes; +var cachedProperty = utils.cachedProperty; + +/** +* @param {EDDSA} eddsa - instance +* @param {Object} params - public/private key parameters +* +* @param {Array} [params.secret] - secret seed bytes +* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms) +* @param {Array} [params.pub] - public key point encoded as bytes +* +*/ +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: pub }); +}; + +KeyPair.fromSecret = function fromSecret(eddsa, secret) { + if (secret instanceof KeyPair) + return secret; + return new KeyPair(eddsa, { secret: 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); +}; + +module.exports = KeyPair; + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic/eddsa/signature.js": +/*!***************************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/eddsa/signature.js ***! + \***************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var BN = __webpack_require__(/*! bn.js */ "./node_modules/elliptic/node_modules/bn.js/lib/bn.js"); +var utils = __webpack_require__(/*! ../utils */ "./node_modules/elliptic/lib/elliptic/utils.js"); +var assert = utils.assert; +var cachedProperty = utils.cachedProperty; +var parseBytes = utils.parseBytes; + +/** +* @param {EDDSA} eddsa - eddsa instance +* @param {Array|Object} sig - +* @param {Array|Point} [sig.R] - R point as Point or bytes +* @param {Array|bn} [sig.S] - S scalar as bn or bytes +* @param {Array} [sig.Rencoded] - R point encoded +* @param {Array} [sig.Sencoded] - S scalar encoded +*/ +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(); +}; + +module.exports = Signature; + + +/***/ }), + +/***/ "./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js": +/*!*********************************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js ***! + \*********************************************************************/ +/***/ (function(module) { + +module.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/utils.js": +/*!*****************************************************!*\ + !*** ./node_modules/elliptic/lib/elliptic/utils.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +var utils = exports; +var BN = __webpack_require__(/*! bn.js */ "./node_modules/elliptic/node_modules/bn.js/lib/bn.js"); +var minAssert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); +var minUtils = __webpack_require__(/*! minimalistic-crypto-utils */ "./node_modules/minimalistic-crypto-utils/lib/utils.js"); + +utils.assert = minAssert; +utils.toArray = minUtils.toArray; +utils.zero2 = minUtils.zero2; +utils.toHex = minUtils.toHex; +utils.encode = minUtils.encode; + +// Represent num in a w-NAF form +function getNAF(num, w, bits) { + var naf = new Array(Math.max(num.bitLength(), bits) + 1); + naf.fill(0); + + var ws = 1 << (w + 1); + var k = num.clone(); + + for (var i = 0; i < naf.length; i++) { + var z; + var mod = k.andln(ws - 1); + if (k.isOdd()) { + if (mod > (ws >> 1) - 1) + z = (ws >> 1) - mod; + else + z = mod; + k.isubn(z); + } else { + z = 0; + } + + naf[i] = z; + k.iushrn(1); + } + + return naf; +} +utils.getNAF = getNAF; + +// Represent k1, k2 in a Joint Sparse Form +function getJSF(k1, k2) { + var jsf = [ + [], + [], + ]; + + k1 = k1.clone(); + k2 = k2.clone(); + var d1 = 0; + var d2 = 0; + var m8; + while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { + // First phase + var m14 = (k1.andln(3) + d1) & 3; + var m24 = (k2.andln(3) + d2) & 3; + if (m14 === 3) + m14 = -1; + if (m24 === 3) + m24 = -1; + var u1; + if ((m14 & 1) === 0) { + u1 = 0; + } else { + m8 = (k1.andln(7) + d1) & 7; + if ((m8 === 3 || m8 === 5) && m24 === 2) + u1 = -m14; + else + u1 = m14; + } + jsf[0].push(u1); + + var u2; + if ((m24 & 1) === 0) { + u2 = 0; + } else { + m8 = (k2.andln(7) + d2) & 7; + if ((m8 === 3 || m8 === 5) && m14 === 2) + u2 = -m24; + else + u2 = m24; + } + jsf[1].push(u2); + + // Second phase + if (2 * d1 === u1 + 1) + d1 = 1 - d1; + if (2 * d2 === u2 + 1) + d2 = 1 - d2; + k1.iushrn(1); + k2.iushrn(1); + } + + return jsf; +} +utils.getJSF = getJSF; + +function cachedProperty(obj, name, computer) { + var key = '_' + name; + obj.prototype[name] = function cachedProperty() { + return this[key] !== undefined ? this[key] : + this[key] = computer.call(this); + }; +} +utils.cachedProperty = cachedProperty; + +function parseBytes(bytes) { + return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : + bytes; +} +utils.parseBytes = parseBytes; + +function intFromLE(bytes) { + return new BN(bytes, 'hex', 'le'); +} +utils.intFromLE = intFromLE; + + + +/***/ }), + +/***/ "./node_modules/elliptic/node_modules/bn.js/lib/bn.js": +/*!************************************************************!*\ + !*** ./node_modules/elliptic/node_modules/bn.js/lib/bn.js ***! + \************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(/*! buffer */ "?7bec").Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [ 0 ]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // 'A' - 'F' + if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + // '0' - '9' + } else { + return (c - 48) & 0xf; + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this.strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + r += c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + r += c - 17 + 0xa; + + // '0' - '9' + } else { + r += c; + } + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this.strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype.strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + BN.prototype.inspect = function inspect () { + return (this.red ? ''; + }; + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16); + }; + + BN.prototype.toBuffer = function toBuffer (endian, length) { + assert(typeof Buffer !== 'undefined'); + return this.toArrayLike(Buffer, endian, length); + }; + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + this.strip(); + var littleEndian = endian === 'le'; + var res = new ArrayType(reqLength); + + var b, i; + var q = this.clone(); + if (!littleEndian) { + // Assume big-endian + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[i] = b; + } + + for (; i < reqLength; i++) { + res[i] = 0; + } + } + + return res; + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] & (1 << wbit)) >>> wbit; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this.strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this.strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this.strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this.strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this.strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this.strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out.strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); + } + + function jumboMulTo (self, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; + + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out.strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this.strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this.strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this.strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) < num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this.strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this.strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q.strip(); + } + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modn = function modn (num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return acc; + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is BN v4 instance + r.strip(); + } else { + // r is BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + return a.umod(this.m)._forceRed(this); + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ "./node_modules/es6-object-assign/index.js": +/*!*************************************************!*\ + !*** ./node_modules/es6-object-assign/index.js ***! + \*************************************************/ +/***/ (function(module) { + +"use strict"; +/** + * Code refactored from Mozilla Developer Network: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign + */ + + + +function assign(target, firstSource) { + if (target === undefined || target === null) { + throw new TypeError('Cannot convert first argument to object'); + } + + var to = Object(target); + for (var i = 1; i < arguments.length; i++) { + var nextSource = arguments[i]; + if (nextSource === undefined || nextSource === null) { + continue; + } + + var keysArray = Object.keys(Object(nextSource)); + for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { + var nextKey = keysArray[nextIndex]; + var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); + if (desc !== undefined && desc.enumerable) { + to[nextKey] = nextSource[nextKey]; + } + } + } + return to; +} + +function polyfill() { + if (!Object.assign) { + Object.defineProperty(Object, 'assign', { + enumerable: false, + configurable: true, + writable: true, + value: assign + }); + } +} + +module.exports = { + assign: assign, + polyfill: polyfill +}; + + +/***/ }), + +/***/ "./node_modules/ethereum-cryptography/keccak.js": +/*!******************************************************!*\ + !*** ./node_modules/ethereum-cryptography/keccak.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.keccak512 = exports.keccak384 = exports.keccak256 = exports.keccak224 = void 0; +const sha3_1 = __webpack_require__(/*! @noble/hashes/sha3 */ "./node_modules/@noble/hashes/sha3.js"); +const utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/ethereum-cryptography/utils.js"); +exports.keccak224 = (0, utils_1.wrapHash)(sha3_1.keccak_224); +exports.keccak256 = (() => { + const k = (0, utils_1.wrapHash)(sha3_1.keccak_256); + k.create = sha3_1.keccak_256.create; + return k; +})(); +exports.keccak384 = (0, utils_1.wrapHash)(sha3_1.keccak_384); +exports.keccak512 = (0, utils_1.wrapHash)(sha3_1.keccak_512); + + +/***/ }), + +/***/ "./node_modules/ethereum-cryptography/utils.js": +/*!*****************************************************!*\ + !*** ./node_modules/ethereum-cryptography/utils.js ***! + \*****************************************************/ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* module decorator */ module = __webpack_require__.nmd(module); + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.crypto = exports.wrapHash = exports.equalsBytes = exports.hexToBytes = exports.bytesToUtf8 = exports.utf8ToBytes = exports.createView = exports.concatBytes = exports.toHex = exports.bytesToHex = exports.assertBytes = exports.assertBool = void 0; +// buf.toString('hex') -> toHex(buf) +const _assert_1 = __importDefault(__webpack_require__(/*! @noble/hashes/_assert */ "./node_modules/@noble/hashes/_assert.js")); +const utils_1 = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js"); +const assertBool = _assert_1.default.bool; +exports.assertBool = assertBool; +const assertBytes = _assert_1.default.bytes; +exports.assertBytes = assertBytes; +var utils_2 = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js"); +Object.defineProperty(exports, "bytesToHex", ({ enumerable: true, get: function () { return utils_2.bytesToHex; } })); +Object.defineProperty(exports, "toHex", ({ enumerable: true, get: function () { return utils_2.bytesToHex; } })); +Object.defineProperty(exports, "concatBytes", ({ enumerable: true, get: function () { return utils_2.concatBytes; } })); +Object.defineProperty(exports, "createView", ({ enumerable: true, get: function () { return utils_2.createView; } })); +Object.defineProperty(exports, "utf8ToBytes", ({ enumerable: true, get: function () { return utils_2.utf8ToBytes; } })); +// buf.toString('utf8') -> bytesToUtf8(buf) +function bytesToUtf8(data) { + if (!(data instanceof Uint8Array)) { + throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof data}`); + } + return new TextDecoder().decode(data); +} +exports.bytesToUtf8 = bytesToUtf8; +function hexToBytes(data) { + const sliced = data.startsWith("0x") ? data.substring(2) : data; + return (0, utils_1.hexToBytes)(sliced); +} +exports.hexToBytes = hexToBytes; +// buf.equals(buf2) -> equalsBytes(buf, buf2) +function equalsBytes(a, b) { + if (a.length !== b.length) { + return false; + } + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { + return false; + } + } + return true; +} +exports.equalsBytes = equalsBytes; +// Internal utils +function wrapHash(hash) { + return (msg) => { + _assert_1.default.bytes(msg); + return hash(msg); + }; +} +exports.wrapHash = wrapHash; +exports.crypto = (() => { + const webCrypto = typeof self === "object" && "crypto" in self ? self.crypto : undefined; + const nodeRequire = true && + typeof module.require === "function" && + module.require.bind(module); + return { + node: nodeRequire && !webCrypto ? nodeRequire("crypto") : undefined, + web: webCrypto + }; +})(); + + +/***/ }), + +/***/ "./node_modules/events/events.js": +/*!***************************************!*\ + !*** ./node_modules/events/events.js ***! + \***************************************/ +/***/ (function(module) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); +} +module.exports = EventEmitter; +module.exports.once = once; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); + + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + + checkListener(listener); + + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; + + checkListener(listener); + + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + var events = target._events; + + if (events === undefined) + return []; + + var evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; +} + +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function errorListener(err) { + emitter.removeListener(name, resolver); + reject(err); + } + + function resolver() { + if (typeof emitter.removeListener === 'function') { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + + eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); + if (name !== 'error') { + addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); + } + }); +} + +function addErrorHandlerIfEventEmitter(emitter, handler, flags) { + if (typeof emitter.on === 'function') { + eventTargetAgnosticAddListener(emitter, 'error', handler, flags); + } +} + +function eventTargetAgnosticAddListener(emitter, name, listener, flags) { + if (typeof emitter.on === 'function') { + if (flags.once) { + emitter.once(name, listener); + } else { + emitter.on(name, listener); + } + } else if (typeof emitter.addEventListener === 'function') { + // EventTarget does not have `error` event semantics like Node + // EventEmitters, we do not listen for `error` events here. + emitter.addEventListener(name, function wrapListener(arg) { + // IE does not have builtin `{ once: true }` support so we + // have to do it manually. + if (flags.once) { + emitter.removeEventListener(name, wrapListener); + } + listener(arg); + }); + } else { + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); + } +} + + +/***/ }), + +/***/ "./node_modules/evp_bytestokey/index.js": +/*!**********************************************!*\ + !*** ./node_modules/evp_bytestokey/index.js ***! + \**********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var MD5 = __webpack_require__(/*! md5.js */ "./node_modules/md5.js/index.js") + +/* eslint-disable camelcase */ +function EVP_BytesToKey (password, salt, keyBits, ivLen) { + if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary') + if (salt) { + if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary') + if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length') + } + + var keyLen = keyBits / 8 + var key = Buffer.alloc(keyLen) + var iv = Buffer.alloc(ivLen || 0) + var tmp = Buffer.alloc(0) + + while (keyLen > 0 || ivLen > 0) { + var hash = new MD5() + hash.update(tmp) + hash.update(password) + if (salt) hash.update(salt) + tmp = hash.digest() + + var used = 0 + + if (keyLen > 0) { + var keyStart = key.length - keyLen + used = Math.min(keyLen, tmp.length) + tmp.copy(key, keyStart, 0, used) + keyLen -= used + } + + if (used < tmp.length && ivLen > 0) { + var ivStart = iv.length - ivLen + var length = Math.min(ivLen, tmp.length - used) + tmp.copy(iv, ivStart, used, used + length) + ivLen -= length + } + } + + tmp.fill(0) + return { key: key, iv: iv } +} + +module.exports = EVP_BytesToKey + + +/***/ }), + +/***/ "./node_modules/follow-redirects/debug.js": +/*!************************************************!*\ + !*** ./node_modules/follow-redirects/debug.js ***! + \************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var debug; + +module.exports = function () { + if (!debug) { + try { + /* eslint global-require: off */ + debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")("follow-redirects"); + } + catch (error) { /* */ } + if (typeof debug !== "function") { + debug = function () { /* */ }; + } + } + debug.apply(null, arguments); +}; + + +/***/ }), + +/***/ "./node_modules/follow-redirects/index.js": +/*!************************************************!*\ + !*** ./node_modules/follow-redirects/index.js ***! + \************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var url = __webpack_require__(/*! url */ "./node_modules/url/url.js"); +var URL = url.URL; +var http = __webpack_require__(/*! http */ "./node_modules/stream-http/index.js"); +var https = __webpack_require__(/*! https */ "./node_modules/https-browserify/index.js"); +var Writable = (__webpack_require__(/*! stream */ "./node_modules/stream-browserify/index.js").Writable); +var assert = __webpack_require__(/*! assert */ "./node_modules/assert/build/assert.js"); +var debug = __webpack_require__(/*! ./debug */ "./node_modules/follow-redirects/debug.js"); + +// Create handlers that pass events from native requests +var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; +var eventHandlers = Object.create(null); +events.forEach(function (event) { + eventHandlers[event] = function (arg1, arg2, arg3) { + this._redirectable.emit(event, arg1, arg2, arg3); + }; +}); + +var InvalidUrlError = createErrorType( + "ERR_INVALID_URL", + "Invalid URL", + TypeError +); +// Error types with codes +var RedirectionError = createErrorType( + "ERR_FR_REDIRECTION_FAILURE", + "Redirected request failed" +); +var TooManyRedirectsError = createErrorType( + "ERR_FR_TOO_MANY_REDIRECTS", + "Maximum number of redirects exceeded" +); +var MaxBodyLengthExceededError = createErrorType( + "ERR_FR_MAX_BODY_LENGTH_EXCEEDED", + "Request body larger than maxBodyLength limit" +); +var WriteAfterEndError = createErrorType( + "ERR_STREAM_WRITE_AFTER_END", + "write after end" +); + +// An HTTP(S) request that can be redirected +function RedirectableRequest(options, responseCallback) { + // Initialize the request + Writable.call(this); + this._sanitizeOptions(options); + this._options = options; + this._ended = false; + this._ending = false; + this._redirectCount = 0; + this._redirects = []; + this._requestBodyLength = 0; + this._requestBodyBuffers = []; + + // Attach a callback if passed + if (responseCallback) { + this.on("response", responseCallback); + } + + // React to responses of native requests + var self = this; + this._onNativeResponse = function (response) { + self._processResponse(response); + }; + + // Perform the first request + this._performRequest(); +} +RedirectableRequest.prototype = Object.create(Writable.prototype); + +RedirectableRequest.prototype.abort = function () { + abortRequest(this._currentRequest); + this.emit("abort"); +}; + +// Writes buffered data to the current native request +RedirectableRequest.prototype.write = function (data, encoding, callback) { + // Writing is not allowed if end has been called + if (this._ending) { + throw new WriteAfterEndError(); + } + + // Validate input and shift parameters if necessary + if (!isString(data) && !isBuffer(data)) { + throw new TypeError("data should be a string, Buffer or Uint8Array"); + } + if (isFunction(encoding)) { + callback = encoding; + encoding = null; + } + + // Ignore empty buffers, since writing them doesn't invoke the callback + // https://github.com/nodejs/node/issues/22066 + if (data.length === 0) { + if (callback) { + callback(); + } + return; + } + // Only write when we don't exceed the maximum body length + if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { + this._requestBodyLength += data.length; + this._requestBodyBuffers.push({ data: data, encoding: encoding }); + this._currentRequest.write(data, encoding, callback); + } + // Error when we exceed the maximum body length + else { + this.emit("error", new MaxBodyLengthExceededError()); + this.abort(); + } +}; + +// Ends the current native request +RedirectableRequest.prototype.end = function (data, encoding, callback) { + // Shift parameters if necessary + if (isFunction(data)) { + callback = data; + data = encoding = null; + } + else if (isFunction(encoding)) { + callback = encoding; + encoding = null; + } + + // Write data if needed and end + if (!data) { + this._ended = this._ending = true; + this._currentRequest.end(null, null, callback); + } + else { + var self = this; + var currentRequest = this._currentRequest; + this.write(data, encoding, function () { + self._ended = true; + currentRequest.end(null, null, callback); + }); + this._ending = true; + } +}; + +// Sets a header value on the current native request +RedirectableRequest.prototype.setHeader = function (name, value) { + this._options.headers[name] = value; + this._currentRequest.setHeader(name, value); +}; + +// Clears a header value on the current native request +RedirectableRequest.prototype.removeHeader = function (name) { + delete this._options.headers[name]; + this._currentRequest.removeHeader(name); +}; + +// Global timeout for all underlying requests +RedirectableRequest.prototype.setTimeout = function (msecs, callback) { + var self = this; + + // Destroys the socket on timeout + function destroyOnTimeout(socket) { + socket.setTimeout(msecs); + socket.removeListener("timeout", socket.destroy); + socket.addListener("timeout", socket.destroy); + } + + // Sets up a timer to trigger a timeout event + function startTimer(socket) { + if (self._timeout) { + clearTimeout(self._timeout); + } + self._timeout = setTimeout(function () { + self.emit("timeout"); + clearTimer(); + }, msecs); + destroyOnTimeout(socket); + } + + // Stops a timeout from triggering + function clearTimer() { + // Clear the timeout + if (self._timeout) { + clearTimeout(self._timeout); + self._timeout = null; + } + + // Clean up all attached listeners + self.removeListener("abort", clearTimer); + self.removeListener("error", clearTimer); + self.removeListener("response", clearTimer); + if (callback) { + self.removeListener("timeout", callback); + } + if (!self.socket) { + self._currentRequest.removeListener("socket", startTimer); + } + } + + // Attach callback if passed + if (callback) { + this.on("timeout", callback); + } + + // Start the timer if or when the socket is opened + if (this.socket) { + startTimer(this.socket); + } + else { + this._currentRequest.once("socket", startTimer); + } + + // Clean up on events + this.on("socket", destroyOnTimeout); + this.on("abort", clearTimer); + this.on("error", clearTimer); + this.on("response", clearTimer); + + return this; +}; + +// Proxy all other public ClientRequest methods +[ + "flushHeaders", "getHeader", + "setNoDelay", "setSocketKeepAlive", +].forEach(function (method) { + RedirectableRequest.prototype[method] = function (a, b) { + return this._currentRequest[method](a, b); + }; +}); + +// Proxy all public ClientRequest properties +["aborted", "connection", "socket"].forEach(function (property) { + Object.defineProperty(RedirectableRequest.prototype, property, { + get: function () { return this._currentRequest[property]; }, + }); +}); + +RedirectableRequest.prototype._sanitizeOptions = function (options) { + // Ensure headers are always present + if (!options.headers) { + options.headers = {}; + } + + // Since http.request treats host as an alias of hostname, + // but the url module interprets host as hostname plus port, + // eliminate the host property to avoid confusion. + if (options.host) { + // Use hostname if set, because it has precedence + if (!options.hostname) { + options.hostname = options.host; + } + delete options.host; + } + + // Complete the URL object when necessary + if (!options.pathname && options.path) { + var searchPos = options.path.indexOf("?"); + if (searchPos < 0) { + options.pathname = options.path; + } + else { + options.pathname = options.path.substring(0, searchPos); + options.search = options.path.substring(searchPos); + } + } +}; + + +// Executes the next native request (initial or redirect) +RedirectableRequest.prototype._performRequest = function () { + // Load the native protocol + var protocol = this._options.protocol; + var nativeProtocol = this._options.nativeProtocols[protocol]; + if (!nativeProtocol) { + this.emit("error", new TypeError("Unsupported protocol " + protocol)); + return; + } + + // If specified, use the agent corresponding to the protocol + // (HTTP and HTTPS use different types of agents) + if (this._options.agents) { + var scheme = protocol.slice(0, -1); + this._options.agent = this._options.agents[scheme]; + } + + // Create the native request and set up its event handlers + var request = this._currentRequest = + nativeProtocol.request(this._options, this._onNativeResponse); + request._redirectable = this; + for (var event of events) { + request.on(event, eventHandlers[event]); + } + + // RFC7230§5.3.1: When making a request directly to an origin server, […] + // a client MUST send only the absolute path […] as the request-target. + this._currentUrl = /^\//.test(this._options.path) ? + url.format(this._options) : + // When making a request to a proxy, […] + // a client MUST send the target URI in absolute-form […]. + this._options.path; + + // End a redirected request + // (The first request must be ended explicitly with RedirectableRequest#end) + if (this._isRedirect) { + // Write the request entity and end + var i = 0; + var self = this; + var buffers = this._requestBodyBuffers; + (function writeNext(error) { + // Only write if this request has not been redirected yet + /* istanbul ignore else */ + if (request === self._currentRequest) { + // Report any write errors + /* istanbul ignore if */ + if (error) { + self.emit("error", error); + } + // Write the next buffer if there are still left + else if (i < buffers.length) { + var buffer = buffers[i++]; + /* istanbul ignore else */ + if (!request.finished) { + request.write(buffer.data, buffer.encoding, writeNext); + } + } + // End the request if `end` has been called on us + else if (self._ended) { + request.end(); + } + } + }()); + } +}; + +// Processes a response from the current native request +RedirectableRequest.prototype._processResponse = function (response) { + // Store the redirected response + var statusCode = response.statusCode; + if (this._options.trackRedirects) { + this._redirects.push({ + url: this._currentUrl, + headers: response.headers, + statusCode: statusCode, + }); + } + + // RFC7231§6.4: The 3xx (Redirection) class of status code indicates + // that further action needs to be taken by the user agent in order to + // fulfill the request. If a Location header field is provided, + // the user agent MAY automatically redirect its request to the URI + // referenced by the Location field value, + // even if the specific status code is not understood. + + // If the response is not a redirect; return it as-is + var location = response.headers.location; + if (!location || this._options.followRedirects === false || + statusCode < 300 || statusCode >= 400) { + response.responseUrl = this._currentUrl; + response.redirects = this._redirects; + this.emit("response", response); + + // Clean up + this._requestBodyBuffers = []; + return; + } + + // The response is a redirect, so abort the current request + abortRequest(this._currentRequest); + // Discard the remainder of the response to avoid waiting for data + response.destroy(); + + // RFC7231§6.4: A client SHOULD detect and intervene + // in cyclical redirections (i.e., "infinite" redirection loops). + if (++this._redirectCount > this._options.maxRedirects) { + this.emit("error", new TooManyRedirectsError()); + return; + } + + // Store the request headers if applicable + var requestHeaders; + var beforeRedirect = this._options.beforeRedirect; + if (beforeRedirect) { + requestHeaders = Object.assign({ + // The Host header was set by nativeProtocol.request + Host: response.req.getHeader("host"), + }, this._options.headers); + } + + // RFC7231§6.4: Automatic redirection needs to done with + // care for methods not known to be safe, […] + // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change + // the request method from POST to GET for the subsequent request. + var method = this._options.method; + if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || + // RFC7231§6.4.4: The 303 (See Other) status code indicates that + // the server is redirecting the user agent to a different resource […] + // A user agent can perform a retrieval request targeting that URI + // (a GET or HEAD request if using HTTP) […] + (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) { + this._options.method = "GET"; + // Drop a possible entity and headers related to it + this._requestBodyBuffers = []; + removeMatchingHeaders(/^content-/i, this._options.headers); + } + + // Drop the Host header, as the redirect might lead to a different host + var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers); + + // If the redirect is relative, carry over the host of the last request + var currentUrlParts = url.parse(this._currentUrl); + var currentHost = currentHostHeader || currentUrlParts.host; + var currentUrl = /^\w+:/.test(location) ? this._currentUrl : + url.format(Object.assign(currentUrlParts, { host: currentHost })); + + // Determine the URL of the redirection + var redirectUrl; + try { + redirectUrl = url.resolve(currentUrl, location); + } + catch (cause) { + this.emit("error", new RedirectionError({ cause: cause })); + return; + } + + // Create the redirected request + debug("redirecting to", redirectUrl); + this._isRedirect = true; + var redirectUrlParts = url.parse(redirectUrl); + Object.assign(this._options, redirectUrlParts); + + // Drop confidential headers when redirecting to a less secure protocol + // or to a different domain that is not a superdomain + if (redirectUrlParts.protocol !== currentUrlParts.protocol && + redirectUrlParts.protocol !== "https:" || + redirectUrlParts.host !== currentHost && + !isSubdomain(redirectUrlParts.host, currentHost)) { + removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers); + } + + // Evaluate the beforeRedirect callback + if (isFunction(beforeRedirect)) { + var responseDetails = { + headers: response.headers, + statusCode: statusCode, + }; + var requestDetails = { + url: currentUrl, + method: method, + headers: requestHeaders, + }; + try { + beforeRedirect(this._options, responseDetails, requestDetails); + } + catch (err) { + this.emit("error", err); + return; + } + this._sanitizeOptions(this._options); + } + + // Perform the redirected request + try { + this._performRequest(); + } + catch (cause) { + this.emit("error", new RedirectionError({ cause: cause })); + } +}; + +// Wraps the key/value object of protocols with redirect functionality +function wrap(protocols) { + // Default settings + var exports = { + maxRedirects: 21, + maxBodyLength: 10 * 1024 * 1024, + }; + + // Wrap each protocol + var nativeProtocols = {}; + Object.keys(protocols).forEach(function (scheme) { + var protocol = scheme + ":"; + var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; + var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); + + // Executes a request, following redirects + function request(input, options, callback) { + // Parse parameters + if (isString(input)) { + var parsed; + try { + parsed = urlToOptions(new URL(input)); + } + catch (err) { + /* istanbul ignore next */ + parsed = url.parse(input); + } + if (!isString(parsed.protocol)) { + throw new InvalidUrlError({ input }); + } + input = parsed; + } + else if (URL && (input instanceof URL)) { + input = urlToOptions(input); + } + else { + callback = options; + options = input; + input = { protocol: protocol }; + } + if (isFunction(options)) { + callback = options; + options = null; + } + + // Set defaults + options = Object.assign({ + maxRedirects: exports.maxRedirects, + maxBodyLength: exports.maxBodyLength, + }, input, options); + options.nativeProtocols = nativeProtocols; + if (!isString(options.host) && !isString(options.hostname)) { + options.hostname = "::1"; + } + + assert.equal(options.protocol, protocol, "protocol mismatch"); + debug("options", options); + return new RedirectableRequest(options, callback); + } + + // Executes a GET request, following redirects + function get(input, options, callback) { + var wrappedRequest = wrappedProtocol.request(input, options, callback); + wrappedRequest.end(); + return wrappedRequest; + } + + // Expose the properties on the wrapped protocol + Object.defineProperties(wrappedProtocol, { + request: { value: request, configurable: true, enumerable: true, writable: true }, + get: { value: get, configurable: true, enumerable: true, writable: true }, + }); + }); + return exports; +} + +/* istanbul ignore next */ +function noop() { /* empty */ } + +// from https://github.com/nodejs/node/blob/master/lib/internal/url.js +function urlToOptions(urlObject) { + var options = { + protocol: urlObject.protocol, + hostname: urlObject.hostname.startsWith("[") ? + /* istanbul ignore next */ + urlObject.hostname.slice(1, -1) : + urlObject.hostname, + hash: urlObject.hash, + search: urlObject.search, + pathname: urlObject.pathname, + path: urlObject.pathname + urlObject.search, + href: urlObject.href, + }; + if (urlObject.port !== "") { + options.port = Number(urlObject.port); + } + return options; +} + +function removeMatchingHeaders(regex, headers) { + var lastValue; + for (var header in headers) { + if (regex.test(header)) { + lastValue = headers[header]; + delete headers[header]; + } + } + return (lastValue === null || typeof lastValue === "undefined") ? + undefined : String(lastValue).trim(); +} + +function createErrorType(code, message, baseClass) { + // Create constructor + function CustomError(properties) { + Error.captureStackTrace(this, this.constructor); + Object.assign(this, properties || {}); + this.code = code; + this.message = this.cause ? message + ": " + this.cause.message : message; + } + + // Attach constructor and set default properties + CustomError.prototype = new (baseClass || Error)(); + CustomError.prototype.constructor = CustomError; + CustomError.prototype.name = "Error [" + code + "]"; + return CustomError; +} + +function abortRequest(request) { + for (var event of events) { + request.removeListener(event, eventHandlers[event]); + } + request.on("error", noop); + request.abort(); +} + +function isSubdomain(subdomain, domain) { + assert(isString(subdomain) && isString(domain)); + var dot = subdomain.length - domain.length - 1; + return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain); +} + +function isString(value) { + return typeof value === "string" || value instanceof String; +} + +function isFunction(value) { + return typeof value === "function"; +} + +function isBuffer(value) { + return typeof value === "object" && ("length" in value); +} + +// Exports +module.exports = wrap({ http: http, https: https }); +module.exports.wrap = wrap; + + +/***/ }), + +/***/ "./node_modules/for-each/index.js": +/*!****************************************!*\ + !*** ./node_modules/for-each/index.js ***! + \****************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var isCallable = __webpack_require__(/*! is-callable */ "./node_modules/is-callable/index.js"); + +var toStr = Object.prototype.toString; +var hasOwnProperty = Object.prototype.hasOwnProperty; + +var forEachArray = function forEachArray(array, iterator, receiver) { + for (var i = 0, len = array.length; i < len; i++) { + if (hasOwnProperty.call(array, i)) { + if (receiver == null) { + iterator(array[i], i, array); + } else { + iterator.call(receiver, array[i], i, array); + } + } + } +}; + +var forEachString = function forEachString(string, iterator, receiver) { + for (var i = 0, len = string.length; i < len; i++) { + // no such thing as a sparse string. + if (receiver == null) { + iterator(string.charAt(i), i, string); + } else { + iterator.call(receiver, string.charAt(i), i, string); + } + } +}; + +var forEachObject = function forEachObject(object, iterator, receiver) { + for (var k in object) { + if (hasOwnProperty.call(object, k)) { + if (receiver == null) { + iterator(object[k], k, object); + } else { + iterator.call(receiver, object[k], k, object); + } + } + } +}; + +var forEach = function forEach(list, iterator, thisArg) { + if (!isCallable(iterator)) { + throw new TypeError('iterator must be a function'); + } + + var receiver; + if (arguments.length >= 3) { + receiver = thisArg; + } + + if (toStr.call(list) === '[object Array]') { + forEachArray(list, iterator, receiver); + } else if (typeof list === 'string') { + forEachString(list, iterator, receiver); + } else { + forEachObject(list, iterator, receiver); + } +}; + +module.exports = forEach; + + +/***/ }), + +/***/ "./node_modules/function-bind/implementation.js": +/*!******************************************************!*\ + !*** ./node_modules/function-bind/implementation.js ***! + \******************************************************/ +/***/ (function(module) { + +"use strict"; + + +/* eslint no-invalid-this: 1 */ + +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var slice = Array.prototype.slice; +var toStr = Object.prototype.toString; +var funcType = '[object Function]'; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.call(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slice.call(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + args.concat(slice.call(arguments)) + ); + if (Object(result) === result) { + return result; + } + return this; + } else { + return target.apply( + that, + args.concat(slice.call(arguments)) + ); + } + }; + + var boundLength = Math.max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs.push('$' + i); + } + + bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; + + +/***/ }), + +/***/ "./node_modules/function-bind/index.js": +/*!*********************************************!*\ + !*** ./node_modules/function-bind/index.js ***! + \*********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/function-bind/implementation.js"); + +module.exports = Function.prototype.bind || implementation; + + +/***/ }), + +/***/ "./node_modules/get-intrinsic/index.js": +/*!*********************************************!*\ + !*** ./node_modules/get-intrinsic/index.js ***! + \*********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var undefined; + +var $SyntaxError = SyntaxError; +var $Function = Function; +var $TypeError = TypeError; + +// eslint-disable-next-line consistent-return +var getEvalledConstructor = function (expressionSyntax) { + try { + return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); + } catch (e) {} +}; + +var $gOPD = Object.getOwnPropertyDescriptor; +if ($gOPD) { + try { + $gOPD({}, ''); + } catch (e) { + $gOPD = null; // this is IE 8, which has a broken gOPD + } +} + +var throwTypeError = function () { + throw new $TypeError(); +}; +var ThrowTypeError = $gOPD + ? (function () { + try { + // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties + arguments.callee; // IE 8 does not throw here + return throwTypeError; + } catch (calleeThrows) { + try { + // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') + return $gOPD(arguments, 'callee').get; + } catch (gOPDthrows) { + return throwTypeError; + } + } + }()) + : throwTypeError; + +var hasSymbols = __webpack_require__(/*! has-symbols */ "./node_modules/has-symbols/index.js")(); + +var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto + +var needsEval = {}; + +var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); + +var INTRINSICS = { + '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, + '%Array%': Array, + '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, + '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, + '%AsyncFromSyncIteratorPrototype%': undefined, + '%AsyncFunction%': needsEval, + '%AsyncGenerator%': needsEval, + '%AsyncGeneratorFunction%': needsEval, + '%AsyncIteratorPrototype%': needsEval, + '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, + '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, + '%Boolean%': Boolean, + '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, + '%Date%': Date, + '%decodeURI%': decodeURI, + '%decodeURIComponent%': decodeURIComponent, + '%encodeURI%': encodeURI, + '%encodeURIComponent%': encodeURIComponent, + '%Error%': Error, + '%eval%': eval, // eslint-disable-line no-eval + '%EvalError%': EvalError, + '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, + '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, + '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, + '%Function%': $Function, + '%GeneratorFunction%': needsEval, + '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, + '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, + '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, + '%isFinite%': isFinite, + '%isNaN%': isNaN, + '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%JSON%': typeof JSON === 'object' ? JSON : undefined, + '%Map%': typeof Map === 'undefined' ? undefined : Map, + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), + '%Math%': Math, + '%Number%': Number, + '%Object%': Object, + '%parseFloat%': parseFloat, + '%parseInt%': parseInt, + '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, + '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, + '%RangeError%': RangeError, + '%ReferenceError%': ReferenceError, + '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, + '%RegExp%': RegExp, + '%Set%': typeof Set === 'undefined' ? undefined : Set, + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, + '%String%': String, + '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, + '%Symbol%': hasSymbols ? Symbol : undefined, + '%SyntaxError%': $SyntaxError, + '%ThrowTypeError%': ThrowTypeError, + '%TypedArray%': TypedArray, + '%TypeError%': $TypeError, + '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, + '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, + '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, + '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, + '%URIError%': URIError, + '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, + '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, + '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet +}; + +var doEval = function doEval(name) { + var value; + if (name === '%AsyncFunction%') { + value = getEvalledConstructor('async function () {}'); + } else if (name === '%GeneratorFunction%') { + value = getEvalledConstructor('function* () {}'); + } else if (name === '%AsyncGeneratorFunction%') { + value = getEvalledConstructor('async function* () {}'); + } else if (name === '%AsyncGenerator%') { + var fn = doEval('%AsyncGeneratorFunction%'); + if (fn) { + value = fn.prototype; + } + } else if (name === '%AsyncIteratorPrototype%') { + var gen = doEval('%AsyncGenerator%'); + if (gen) { + value = getProto(gen.prototype); + } + } + + INTRINSICS[name] = value; + + return value; +}; + +var LEGACY_ALIASES = { + '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], + '%ArrayPrototype%': ['Array', 'prototype'], + '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], + '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], + '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], + '%ArrayProto_values%': ['Array', 'prototype', 'values'], + '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], + '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], + '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'], + '%BooleanPrototype%': ['Boolean', 'prototype'], + '%DataViewPrototype%': ['DataView', 'prototype'], + '%DatePrototype%': ['Date', 'prototype'], + '%ErrorPrototype%': ['Error', 'prototype'], + '%EvalErrorPrototype%': ['EvalError', 'prototype'], + '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], + '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], + '%FunctionPrototype%': ['Function', 'prototype'], + '%Generator%': ['GeneratorFunction', 'prototype'], + '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'], + '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], + '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], + '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], + '%JSONParse%': ['JSON', 'parse'], + '%JSONStringify%': ['JSON', 'stringify'], + '%MapPrototype%': ['Map', 'prototype'], + '%NumberPrototype%': ['Number', 'prototype'], + '%ObjectPrototype%': ['Object', 'prototype'], + '%ObjProto_toString%': ['Object', 'prototype', 'toString'], + '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], + '%PromisePrototype%': ['Promise', 'prototype'], + '%PromiseProto_then%': ['Promise', 'prototype', 'then'], + '%Promise_all%': ['Promise', 'all'], + '%Promise_reject%': ['Promise', 'reject'], + '%Promise_resolve%': ['Promise', 'resolve'], + '%RangeErrorPrototype%': ['RangeError', 'prototype'], + '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], + '%RegExpPrototype%': ['RegExp', 'prototype'], + '%SetPrototype%': ['Set', 'prototype'], + '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], + '%StringPrototype%': ['String', 'prototype'], + '%SymbolPrototype%': ['Symbol', 'prototype'], + '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], + '%TypedArrayPrototype%': ['TypedArray', 'prototype'], + '%TypeErrorPrototype%': ['TypeError', 'prototype'], + '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], + '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], + '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], + '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], + '%URIErrorPrototype%': ['URIError', 'prototype'], + '%WeakMapPrototype%': ['WeakMap', 'prototype'], + '%WeakSetPrototype%': ['WeakSet', 'prototype'] +}; + +var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js"); +var hasOwn = __webpack_require__(/*! has */ "./node_modules/has/src/index.js"); +var $concat = bind.call(Function.call, Array.prototype.concat); +var $spliceApply = bind.call(Function.apply, Array.prototype.splice); +var $replace = bind.call(Function.call, String.prototype.replace); +var $strSlice = bind.call(Function.call, String.prototype.slice); +var $exec = bind.call(Function.call, RegExp.prototype.exec); + +/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ +var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; +var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ +var stringToPath = function stringToPath(string) { + var first = $strSlice(string, 0, 1); + var last = $strSlice(string, -1); + if (first === '%' && last !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); + } else if (last === '%' && first !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); + } + var result = []; + $replace(string, rePropName, function (match, number, quote, subString) { + result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; + }); + return result; +}; +/* end adaptation */ + +var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { + var intrinsicName = name; + var alias; + if (hasOwn(LEGACY_ALIASES, intrinsicName)) { + alias = LEGACY_ALIASES[intrinsicName]; + intrinsicName = '%' + alias[0] + '%'; + } + + if (hasOwn(INTRINSICS, intrinsicName)) { + var value = INTRINSICS[intrinsicName]; + if (value === needsEval) { + value = doEval(intrinsicName); + } + if (typeof value === 'undefined' && !allowMissing) { + throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); + } + + return { + alias: alias, + name: intrinsicName, + value: value + }; + } + + throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); +}; + +module.exports = function GetIntrinsic(name, allowMissing) { + if (typeof name !== 'string' || name.length === 0) { + throw new $TypeError('intrinsic name must be a non-empty string'); + } + if (arguments.length > 1 && typeof allowMissing !== 'boolean') { + throw new $TypeError('"allowMissing" argument must be a boolean'); + } + + if ($exec(/^%?[^%]*%?$/, name) === null) { + throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); + } + var parts = stringToPath(name); + var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; + + var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); + var intrinsicRealName = intrinsic.name; + var value = intrinsic.value; + var skipFurtherCaching = false; + + var alias = intrinsic.alias; + if (alias) { + intrinsicBaseName = alias[0]; + $spliceApply(parts, $concat([0, 1], alias)); + } + + for (var i = 1, isOwn = true; i < parts.length; i += 1) { + var part = parts[i]; + var first = $strSlice(part, 0, 1); + var last = $strSlice(part, -1); + if ( + ( + (first === '"' || first === "'" || first === '`') + || (last === '"' || last === "'" || last === '`') + ) + && first !== last + ) { + throw new $SyntaxError('property names with quotes must have matching quotes'); + } + if (part === 'constructor' || !isOwn) { + skipFurtherCaching = true; + } + + intrinsicBaseName += '.' + part; + intrinsicRealName = '%' + intrinsicBaseName + '%'; + + if (hasOwn(INTRINSICS, intrinsicRealName)) { + value = INTRINSICS[intrinsicRealName]; + } else if (value != null) { + if (!(part in value)) { + if (!allowMissing) { + throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); + } + return void undefined; + } + if ($gOPD && (i + 1) >= parts.length) { + var desc = $gOPD(value, part); + isOwn = !!desc; + + // By convention, when a data property is converted to an accessor + // property to emulate a data property that does not suffer from + // the override mistake, that accessor's getter is marked with + // an `originalValue` property. Here, when we detect this, we + // uphold the illusion by pretending to see that original data + // property, i.e., returning the value rather than the getter + // itself. + if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { + value = desc.get; + } else { + value = value[part]; + } + } else { + isOwn = hasOwn(value, part); + value = value[part]; + } + + if (isOwn && !skipFurtherCaching) { + INTRINSICS[intrinsicRealName] = value; + } + } + } + return value; +}; + + +/***/ }), + +/***/ "./node_modules/globalthis/implementation.browser.js": +/*!***********************************************************!*\ + !*** ./node_modules/globalthis/implementation.browser.js ***! + \***********************************************************/ +/***/ (function(module) { + +"use strict"; +/* eslint no-negated-condition: 0, no-new-func: 0 */ + + + +if (typeof self !== 'undefined') { + module.exports = self; +} else if (typeof window !== 'undefined') { + module.exports = window; +} else { + module.exports = Function('return this')(); +} + + +/***/ }), + +/***/ "./node_modules/globalthis/index.js": +/*!******************************************!*\ + !*** ./node_modules/globalthis/index.js ***! + \******************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var defineProperties = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js"); + +var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/globalthis/implementation.browser.js"); +var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/globalthis/polyfill.js"); +var shim = __webpack_require__(/*! ./shim */ "./node_modules/globalthis/shim.js"); + +var polyfill = getPolyfill(); + +var getGlobal = function () { return polyfill; }; + +defineProperties(getGlobal, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = getGlobal; + + +/***/ }), + +/***/ "./node_modules/globalthis/polyfill.js": +/*!*********************************************!*\ + !*** ./node_modules/globalthis/polyfill.js ***! + \*********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/globalthis/implementation.browser.js"); + +module.exports = function getPolyfill() { + if (typeof __webpack_require__.g !== 'object' || !__webpack_require__.g || __webpack_require__.g.Math !== Math || __webpack_require__.g.Array !== Array) { + return implementation; + } + return __webpack_require__.g; +}; + + +/***/ }), + +/***/ "./node_modules/globalthis/shim.js": +/*!*****************************************!*\ + !*** ./node_modules/globalthis/shim.js ***! + \*****************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js"); +var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/globalthis/polyfill.js"); + +module.exports = function shimGlobal() { + var polyfill = getPolyfill(); + if (define.supportsDescriptors) { + var descriptor = Object.getOwnPropertyDescriptor(polyfill, 'globalThis'); + if (!descriptor || (descriptor.configurable && (descriptor.enumerable || !descriptor.writable || globalThis !== polyfill))) { // eslint-disable-line max-len + Object.defineProperty(polyfill, 'globalThis', { + configurable: true, + enumerable: false, + value: polyfill, + writable: true + }); + } + } else if (typeof globalThis !== 'object' || globalThis !== polyfill) { + polyfill.globalThis = polyfill; + } + return polyfill; +}; + + +/***/ }), + +/***/ "./node_modules/gopd/index.js": +/*!************************************!*\ + !*** ./node_modules/gopd/index.js ***! + \************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js"); + +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); + +if ($gOPD) { + try { + $gOPD([], 'length'); + } catch (e) { + // IE 8 has a broken gOPD + $gOPD = null; + } +} + +module.exports = $gOPD; + + +/***/ }), + +/***/ "./node_modules/has-property-descriptors/index.js": +/*!********************************************************!*\ + !*** ./node_modules/has-property-descriptors/index.js ***! + \********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js"); + +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); + +var hasPropertyDescriptors = function hasPropertyDescriptors() { + if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + return true; + } catch (e) { + // IE 8 has a broken defineProperty + return false; + } + } + return false; +}; + +hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { + // node v0.6 has a bug where array lengths can be Set but not Defined + if (!hasPropertyDescriptors()) { + return null; + } + try { + return $defineProperty([], 'length', { value: 1 }).length !== 1; + } catch (e) { + // In Firefox 4-22, defining length on an array throws an exception. + return true; + } +}; + +module.exports = hasPropertyDescriptors; + + +/***/ }), + +/***/ "./node_modules/has-symbols/index.js": +/*!*******************************************!*\ + !*** ./node_modules/has-symbols/index.js ***! + \*******************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var origSymbol = typeof Symbol !== 'undefined' && Symbol; +var hasSymbolSham = __webpack_require__(/*! ./shams */ "./node_modules/has-symbols/shams.js"); + +module.exports = function hasNativeSymbols() { + if (typeof origSymbol !== 'function') { return false; } + if (typeof Symbol !== 'function') { return false; } + if (typeof origSymbol('foo') !== 'symbol') { return false; } + if (typeof Symbol('bar') !== 'symbol') { return false; } + + return hasSymbolSham(); +}; + + +/***/ }), + +/***/ "./node_modules/has-symbols/shams.js": +/*!*******************************************!*\ + !*** ./node_modules/has-symbols/shams.js ***! + \*******************************************/ +/***/ (function(module) { + +"use strict"; + + +/* eslint complexity: [2, 18], max-statements: [2, 33] */ +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } + + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } + + // temp disabled per https://github.com/ljharb/object.assign/issues/17 + // if (sym instanceof Symbol) { return false; } + // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + // if (!(symObj instanceof Symbol)) { return false; } + + // if (typeof Symbol.prototype.toString !== 'function') { return false; } + // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } + + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } + + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } + + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } + + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } + + if (typeof Object.getOwnPropertyDescriptor === 'function') { + var descriptor = Object.getOwnPropertyDescriptor(obj, sym); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } + + return true; +}; + + +/***/ }), + +/***/ "./node_modules/has-tostringtag/shams.js": +/*!***********************************************!*\ + !*** ./node_modules/has-tostringtag/shams.js ***! + \***********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var hasSymbols = __webpack_require__(/*! has-symbols/shams */ "./node_modules/has-symbols/shams.js"); + +module.exports = function hasToStringTagShams() { + return hasSymbols() && !!Symbol.toStringTag; +}; + + +/***/ }), + +/***/ "./node_modules/has/src/index.js": +/*!***************************************!*\ + !*** ./node_modules/has/src/index.js ***! + \***************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js"); + +module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); + + +/***/ }), + +/***/ "./node_modules/hash-base/index.js": +/*!*****************************************!*\ + !*** ./node_modules/hash-base/index.js ***! + \*****************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + +var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer) +var Transform = (__webpack_require__(/*! readable-stream */ "./node_modules/hash-base/node_modules/readable-stream/readable-browser.js").Transform) +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js") + +function throwIfNotStringOrBuffer (val, prefix) { + if (!Buffer.isBuffer(val) && typeof val !== 'string') { + throw new TypeError(prefix + ' must be a string or a buffer') + } +} + +function HashBase (blockSize) { + Transform.call(this) + + this._block = Buffer.allocUnsafe(blockSize) + this._blockSize = blockSize + this._blockOffset = 0 + this._length = [0, 0, 0, 0] + + this._finalized = false +} + +inherits(HashBase, Transform) + +HashBase.prototype._transform = function (chunk, encoding, callback) { + var error = null + try { + this.update(chunk, encoding) + } catch (err) { + error = err + } + + callback(error) +} + +HashBase.prototype._flush = function (callback) { + var error = null + try { + this.push(this.digest()) + } catch (err) { + error = err + } + + callback(error) +} + +HashBase.prototype.update = function (data, encoding) { + throwIfNotStringOrBuffer(data, 'Data') + if (this._finalized) throw new Error('Digest already called') + if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding) + + // consume data + var block = this._block + var offset = 0 + while (this._blockOffset + data.length - offset >= this._blockSize) { + for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++] + this._update() + this._blockOffset = 0 + } + while (offset < data.length) block[this._blockOffset++] = data[offset++] + + // update length + for (var j = 0, carry = data.length * 8; carry > 0; ++j) { + this._length[j] += carry + carry = (this._length[j] / 0x0100000000) | 0 + if (carry > 0) this._length[j] -= 0x0100000000 * carry + } + + return this +} + +HashBase.prototype._update = function () { + throw new Error('_update is not implemented') +} + +HashBase.prototype.digest = function (encoding) { + if (this._finalized) throw new Error('Digest already called') + this._finalized = true + + var digest = this._digest() + if (encoding !== undefined) digest = digest.toString(encoding) + + // reset state + this._block.fill(0) + this._blockOffset = 0 + for (var i = 0; i < 4; ++i) this._length[i] = 0 + + return digest +} + +HashBase.prototype._digest = function () { + throw new Error('_digest is not implemented') +} + +module.exports = HashBase + + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/errors-browser.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/errors-browser.js ***! + \*******************************************************************************/ +/***/ (function(module) { + +"use strict"; + + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } + + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inheritsLoose(NodeError, _Base); + + function NodeError(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + + return NodeError; + }(Base); + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js + + +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith + + +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + var determiner; + + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + var msg; + + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } + + msg += ". Received type ".concat(typeof actual); + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented'; +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg; +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); +module.exports.codes = codes; + + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_duplex.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/_stream_duplex.js ***! + \***********************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + + + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +}; +/**/ + +module.exports = Duplex; +var Readable = __webpack_require__(/*! ./_stream_readable */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_readable.js"); +var Writable = __webpack_require__(/*! ./_stream_writable */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_writable.js"); +__webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js")(Duplex, Readable); +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + +// the no-half-open enforcer +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + ({"env":{"NODE_ENV":"production"}}).nextTick(onEndNT, this); +} +function onEndNT(self) { + self.end(); +} +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_passthrough.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/_stream_passthrough.js ***! + \****************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + + + +module.exports = PassThrough; +var Transform = __webpack_require__(/*! ./_stream_transform */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_transform.js"); +__webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js")(PassThrough, Transform); +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); +} +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_readable.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/_stream_readable.js ***! + \*************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +module.exports = Readable; + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = (__webpack_require__(/*! events */ "./node_modules/events/events.js").EventEmitter); +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = __webpack_require__(/*! ./internal/streams/stream */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/stream-browser.js"); +/**/ + +var Buffer = (__webpack_require__(/*! buffer */ "./node_modules/buffer/index.js").Buffer); +var OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ +var debugUtil = __webpack_require__(/*! util */ "?1e44"); +var debug; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/**/ + +var BufferList = __webpack_require__(/*! ./internal/streams/buffer_list */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/buffer_list.js"); +var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/destroy.js"); +var _require = __webpack_require__(/*! ./internal/streams/state */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/state.js"), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = (__webpack_require__(/*! ../errors */ "./node_modules/hash-base/node_modules/readable-stream/errors-browser.js").codes), + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + +// Lazy loaded to improve the startup performance. +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; +__webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js")(Readable, Stream); +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_duplex.js"); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'end' (and potentially 'finish') + this.autoDestroy = !!options.autoDestroy; + + // has it been destroyed + this.destroyed = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = (__webpack_require__(/*! string_decoder/ */ "./node_modules/string_decoder/lib/string_decoder.js").StringDecoder); + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} +function Readable(options) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_duplex.js"); + if (!(this instanceof Readable)) return new Readable(options); + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); + + // legacy + this.readable = true; + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + Stream.call(this); +} +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); + } + } + + // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } + return er; +} +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = (__webpack_require__(/*! string_decoder/ */ "./node_modules/string_decoder/lib/string_decoder.js").StringDecoder); + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; + // If setEncoding(null), decoder.encoding equals utf8 + this._readableState.encoding = this._readableState.decoder.encoding; + + // Iterate over current buffer to convert already stored Buffers: + var p = this._readableState.buffer.head; + var content = ''; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + this._readableState.buffer.clear(); + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; + +// Don't raise the hwm > 1GB +var MAX_HWM = 0x40000000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; + } + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + if (ret !== null) this.emit('data', ret); + return ret; +}; +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); + } + } +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(emitReadable_, stream); + } +} +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } + + // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(maybeReadMore_, stream, state); + } +} +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== ({"env":{"NODE_ENV":"production"}}).stdout && dest !== ({"env":{"NODE_ENV":"production"}}).stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) ({"env":{"NODE_ENV":"production"}}).nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + if (ret === false) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + return dest; +}; +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; + + // Try start flowing on next tick if stream isn't explicitly paused + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + ({"env":{"NODE_ENV":"production"}}).nextTick(nReadingNextTick, this); + } + } + } + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + ({"env":{"NODE_ENV":"production"}}).nextTick(updateReadableListening, this); + } + return res; +}; +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + ({"env":{"NODE_ENV":"production"}}).nextTick(updateReadableListening, this); + } + return res; +}; +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; + + // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + // we flow only if there is no one listening + // for readable, but we still have to call + // resume() + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; + return this; +}; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(resume_, stream, state); + } +} +function resume_(stream, state) { + debug('resume', state.reading); + if (!state.reading) { + stream.read(0); + } + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + this._readableState.paused = true; + return this; +}; +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null); +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + _this.push(null); + }); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + return this; +}; +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = __webpack_require__(/*! ./internal/streams/async_iterator */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/async_iterator.js"); + } + return createReadableStreamAsyncIterator(this); + }; +} +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); + +// exposed for testing purposes only. +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; +} +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); + if (!state.endEmitted) { + state.ended = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(endReadableNT, state, stream); + } +} +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); + + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } + } +} +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = __webpack_require__(/*! ./internal/streams/from */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/from-browser.js"); + } + return from(Readable, iterable, opts); + }; +} +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_transform.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/_stream_transform.js ***! + \**************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +module.exports = Transform; +var _require$codes = (__webpack_require__(/*! ../errors */ "./node_modules/hash-base/node_modules/readable-stream/errors-browser.js").codes), + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; +var Duplex = __webpack_require__(/*! ./_stream_duplex */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_duplex.js"); +__webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js")(Transform, Duplex); +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); + } + ts.writechunk = null; + ts.writecb = null; + if (data != null) + // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} +function prefinish() { + var _this = this; + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); +}; +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) + // single equals check for both `null` and `undefined` + stream.push(data); + + // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); +} + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_writable.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/_stream_writable.js ***! + \*************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + + + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var internalUtil = { + deprecate: __webpack_require__(/*! util-deprecate */ "./node_modules/util-deprecate/browser.js") +}; +/**/ + +/**/ +var Stream = __webpack_require__(/*! ./internal/streams/stream */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/stream-browser.js"); +/**/ + +var Buffer = (__webpack_require__(/*! buffer */ "./node_modules/buffer/index.js").Buffer); +var OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/destroy.js"); +var _require = __webpack_require__(/*! ./internal/streams/state */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/state.js"), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = (__webpack_require__(/*! ../errors */ "./node_modules/hash-base/node_modules/readable-stream/errors-browser.js").codes), + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; +var errorOrDestroy = destroyImpl.errorOrDestroy; +__webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js")(Writable, Stream); +function nop() {} +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_duplex.js"); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'finish' (and potentially 'end') + this.autoDestroy = !!options.autoDestroy; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; + }; +} +function Writable(options) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_duplex.js"); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + + // legacy. + this.writable = true; + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; + } + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + // TODO: defer error events consistently everywhere, not just the cb + errorOrDestroy(stream, er); + ({"env":{"NODE_ENV":"production"}}).nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } + if (er) { + errorOrDestroy(stream, er); + ({"env":{"NODE_ENV":"production"}}).nextTick(cb, er); + return false; + } + return true; +} +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; +Writable.prototype.cork = function () { + this._writableState.corked++; +}; +Writable.prototype.uncork = function () { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + return ret; +} +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + ({"env":{"NODE_ENV":"production"}}).nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + ({"env":{"NODE_ENV":"production"}}).nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + ({"env":{"NODE_ENV":"production"}}).nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + if (entry === null) state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; +} +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; +Writable.prototype._writev = null; +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); + return this; +}; +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + return need; +} +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) ({"env":{"NODE_ENV":"production"}}).nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/async_iterator.js": +/*!****************************************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/async_iterator.js ***! + \****************************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var _Object$setPrototypeO; +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var finished = __webpack_require__(/*! ./end-of-stream */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/end-of-stream.js"); +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + if (resolve !== null) { + var data = iter[kStream].read(); + // we defer if data is null + // we can be expecting either 'end' or + // 'error' + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } + } +} +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + ({"env":{"NODE_ENV":"production"}}).nextTick(readAndResolve, iter); +} +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); + } + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + ({"env":{"NODE_ENV":"production"}}).nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } + + // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + var lastPromise = this[kLastPromise]; + var promise; + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + promise = new Promise(this[kHandlePromise]); + } + this[kLastPromise] = promise; + return promise; + } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; + // reject if we are waiting for data in the Promise + // returned by next() and store the error + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } + iterator[kError] = err; + return; + } + var resolve = iterator[kLastResolve]; + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; +module.exports = createReadableStreamAsyncIterator; + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/buffer_list.js": +/*!*************************************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/buffer_list.js ***! + \*************************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _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 _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var _require = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js"), + Buffer = _require.Buffer; +var _require2 = __webpack_require__(/*! util */ "?802b"), + inspect = _require2.inspect; +var custom = inspect && inspect.custom || 'inspect'; +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); +} +module.exports = /*#__PURE__*/function () { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; + } + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) ret += s + p.data; + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + } + + // Consumes a specified amount of bytes or characters from the buffered data. + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; + } + + // Consumes a specified amount of characters from the buffered data. + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Consumes a specified amount of bytes from the buffered data. + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Make sure the linked list only shows the minimal necessary information. + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread(_objectSpread({}, options), {}, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); + return BufferList; +}(); + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/destroy.js": +/*!*********************************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/destroy.js ***! + \*********************************************************************************************/ +/***/ (function(module) { + +"use strict"; + + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + ({"env":{"NODE_ENV":"production"}}).nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(emitErrorNT, this, err); + } + } + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + ({"env":{"NODE_ENV":"production"}}).nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + ({"env":{"NODE_ENV":"production"}}).nextTick(emitErrorAndCloseNT, _this, err); + } else { + ({"env":{"NODE_ENV":"production"}}).nextTick(emitCloseNT, _this); + } + } else if (cb) { + ({"env":{"NODE_ENV":"production"}}).nextTick(emitCloseNT, _this); + cb(err); + } else { + ({"env":{"NODE_ENV":"production"}}).nextTick(emitCloseNT, _this); + } + }); + return this; +} +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} +function emitErrorNT(self, err) { + self.emit('error', err); +} +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/end-of-stream.js": +/*!***************************************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/end-of-stream.js ***! + \***************************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). + + + +var ERR_STREAM_PREMATURE_CLOSE = (__webpack_require__(/*! ../../../errors */ "./node_modules/hash-base/node_modules/readable-stream/errors-browser.js").codes.ERR_STREAM_PREMATURE_CLOSE); +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + callback.apply(this, args); + }; +} +function noop() {} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + var onerror = function onerror(err) { + callback.call(stream, err); + }; + var onclose = function onclose() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} +module.exports = eos; + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/from-browser.js": +/*!**************************************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/from-browser.js ***! + \**************************************************************************************************/ +/***/ (function(module) { + +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; + + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/pipeline.js": +/*!**********************************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/pipeline.js ***! + \**********************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). + + + +var eos; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} +var _require$codes = (__webpack_require__(/*! ../../../errors */ "./node_modules/hash-base/node_modules/readable-stream/errors-browser.js").codes), + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = __webpack_require__(/*! ./end-of-stream */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/end-of-stream.js"); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; + + // request.destroy just do .end - .abort is what we want + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} +function call(fn) { + fn(); +} +function pipe(from, to) { + return from.pipe(to); +} +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} +module.exports = pipeline; + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/state.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/state.js ***! + \*******************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var ERR_INVALID_OPT_VALUE = (__webpack_require__(/*! ../../../errors */ "./node_modules/hash-base/node_modules/readable-stream/errors-browser.js").codes.ERR_INVALID_OPT_VALUE); +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } + return Math.floor(hwm); + } + + // Default value + return state.objectMode ? 16 : 16 * 1024; +} +module.exports = { + getHighWaterMark: getHighWaterMark +}; + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/stream-browser.js": +/*!****************************************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/stream-browser.js ***! + \****************************************************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! events */ "./node_modules/events/events.js").EventEmitter; + + +/***/ }), + +/***/ "./node_modules/hash-base/node_modules/readable-stream/readable-browser.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/hash-base/node_modules/readable-stream/readable-browser.js ***! + \*********************************************************************************/ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_readable.js"); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_writable.js"); +exports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_duplex.js"); +exports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_transform.js"); +exports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ "./node_modules/hash-base/node_modules/readable-stream/lib/_stream_passthrough.js"); +exports.finished = __webpack_require__(/*! ./lib/internal/streams/end-of-stream.js */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/end-of-stream.js"); +exports.pipeline = __webpack_require__(/*! ./lib/internal/streams/pipeline.js */ "./node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/pipeline.js"); + + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash.js": +/*!******************************************!*\ + !*** ./node_modules/hash.js/lib/hash.js ***! + \******************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +var hash = exports; + +hash.utils = __webpack_require__(/*! ./hash/utils */ "./node_modules/hash.js/lib/hash/utils.js"); +hash.common = __webpack_require__(/*! ./hash/common */ "./node_modules/hash.js/lib/hash/common.js"); +hash.sha = __webpack_require__(/*! ./hash/sha */ "./node_modules/hash.js/lib/hash/sha.js"); +hash.ripemd = __webpack_require__(/*! ./hash/ripemd */ "./node_modules/hash.js/lib/hash/ripemd.js"); +hash.hmac = __webpack_require__(/*! ./hash/hmac */ "./node_modules/hash.js/lib/hash/hmac.js"); + +// Proxy hash functions to the main object +hash.sha1 = hash.sha.sha1; +hash.sha256 = hash.sha.sha256; +hash.sha224 = hash.sha.sha224; +hash.sha384 = hash.sha.sha384; +hash.sha512 = hash.sha.sha512; +hash.ripemd160 = hash.ripemd.ripemd160; + + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/common.js": +/*!*************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/common.js ***! + \*************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./utils */ "./node_modules/hash.js/lib/hash/utils.js"); +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); + +function BlockHash() { + this.pending = null; + this.pendingTotal = 0; + this.blockSize = this.constructor.blockSize; + this.outSize = this.constructor.outSize; + this.hmacStrength = this.constructor.hmacStrength; + this.padLength = this.constructor.padLength / 8; + this.endian = 'big'; + + this._delta8 = this.blockSize / 8; + this._delta32 = this.blockSize / 32; +} +exports.BlockHash = BlockHash; + +BlockHash.prototype.update = function update(msg, enc) { + // Convert message to array, pad it, and join into 32bit blocks + msg = utils.toArray(msg, enc); + if (!this.pending) + this.pending = msg; + else + this.pending = this.pending.concat(msg); + this.pendingTotal += msg.length; + + // Enough data, try updating + if (this.pending.length >= this._delta8) { + msg = this.pending; + + // Process pending data in blocks + var r = msg.length % this._delta8; + this.pending = msg.slice(msg.length - r, msg.length); + if (this.pending.length === 0) + this.pending = null; + + msg = utils.join32(msg, 0, msg.length - r, this.endian); + for (var i = 0; i < msg.length; i += this._delta32) + this._update(msg, i, i + this._delta32); + } + + return this; +}; + +BlockHash.prototype.digest = function digest(enc) { + this.update(this._pad()); + assert(this.pending === null); + + return this._digest(enc); +}; + +BlockHash.prototype._pad = function pad() { + var len = this.pendingTotal; + var bytes = this._delta8; + var k = bytes - ((len + this.padLength) % bytes); + var res = new Array(k + this.padLength); + res[0] = 0x80; + for (var i = 1; i < k; i++) + res[i] = 0; + + // Append length + len <<= 3; + if (this.endian === 'big') { + for (var t = 8; t < this.padLength; t++) + res[i++] = 0; + + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = (len >>> 24) & 0xff; + res[i++] = (len >>> 16) & 0xff; + res[i++] = (len >>> 8) & 0xff; + res[i++] = len & 0xff; + } else { + res[i++] = len & 0xff; + res[i++] = (len >>> 8) & 0xff; + res[i++] = (len >>> 16) & 0xff; + res[i++] = (len >>> 24) & 0xff; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + + for (t = 8; t < this.padLength; t++) + res[i++] = 0; + } + + return res; +}; + + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/hmac.js": +/*!***********************************************!*\ + !*** ./node_modules/hash.js/lib/hash/hmac.js ***! + \***********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./utils */ "./node_modules/hash.js/lib/hash/utils.js"); +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); + +function Hmac(hash, key, enc) { + if (!(this instanceof Hmac)) + return new Hmac(hash, key, enc); + this.Hash = hash; + this.blockSize = hash.blockSize / 8; + this.outSize = hash.outSize / 8; + this.inner = null; + this.outer = null; + + this._init(utils.toArray(key, enc)); +} +module.exports = Hmac; + +Hmac.prototype._init = function init(key) { + // Shorten key, if needed + if (key.length > this.blockSize) + key = new this.Hash().update(key).digest(); + assert(key.length <= this.blockSize); + + // Add padding to key + for (var i = key.length; i < this.blockSize; i++) + key.push(0); + + for (i = 0; i < key.length; i++) + key[i] ^= 0x36; + this.inner = new this.Hash().update(key); + + // 0x36 ^ 0x5c = 0x6a + for (i = 0; i < key.length; i++) + key[i] ^= 0x6a; + this.outer = new this.Hash().update(key); +}; + +Hmac.prototype.update = function update(msg, enc) { + this.inner.update(msg, enc); + return this; +}; + +Hmac.prototype.digest = function digest(enc) { + this.outer.update(this.inner.digest()); + return this.outer.digest(enc); +}; + + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/ripemd.js": +/*!*************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/ripemd.js ***! + \*************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./utils */ "./node_modules/hash.js/lib/hash/utils.js"); +var common = __webpack_require__(/*! ./common */ "./node_modules/hash.js/lib/hash/common.js"); + +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_3 = utils.sum32_3; +var sum32_4 = utils.sum32_4; +var BlockHash = common.BlockHash; + +function RIPEMD160() { + if (!(this instanceof RIPEMD160)) + return new RIPEMD160(); + + BlockHash.call(this); + + this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; + this.endian = 'little'; +} +utils.inherits(RIPEMD160, BlockHash); +exports.ripemd160 = RIPEMD160; + +RIPEMD160.blockSize = 512; +RIPEMD160.outSize = 160; +RIPEMD160.hmacStrength = 192; +RIPEMD160.padLength = 64; + +RIPEMD160.prototype._update = function update(msg, start) { + var A = this.h[0]; + var B = this.h[1]; + var C = this.h[2]; + var D = this.h[3]; + var E = this.h[4]; + var Ah = A; + var Bh = B; + var Ch = C; + var Dh = D; + var Eh = E; + for (var j = 0; j < 80; j++) { + var T = sum32( + rotl32( + sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), + s[j]), + E); + A = E; + E = D; + D = rotl32(C, 10); + C = B; + B = T; + T = sum32( + rotl32( + sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), + sh[j]), + Eh); + Ah = Eh; + Eh = Dh; + Dh = rotl32(Ch, 10); + Ch = Bh; + Bh = T; + } + T = sum32_3(this.h[1], C, Dh); + this.h[1] = sum32_3(this.h[2], D, Eh); + this.h[2] = sum32_3(this.h[3], E, Ah); + this.h[3] = sum32_3(this.h[4], A, Bh); + this.h[4] = sum32_3(this.h[0], B, Ch); + this.h[0] = T; +}; + +RIPEMD160.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'little'); + else + return utils.split32(this.h, 'little'); +}; + +function f(j, x, y, z) { + if (j <= 15) + return x ^ y ^ z; + else if (j <= 31) + return (x & y) | ((~x) & z); + else if (j <= 47) + return (x | (~y)) ^ z; + else if (j <= 63) + return (x & z) | (y & (~z)); + else + return x ^ (y | (~z)); +} + +function K(j) { + if (j <= 15) + return 0x00000000; + else if (j <= 31) + return 0x5a827999; + else if (j <= 47) + return 0x6ed9eba1; + else if (j <= 63) + return 0x8f1bbcdc; + else + return 0xa953fd4e; +} + +function Kh(j) { + if (j <= 15) + return 0x50a28be6; + else if (j <= 31) + return 0x5c4dd124; + else if (j <= 47) + return 0x6d703ef3; + else if (j <= 63) + return 0x7a6d76e9; + else + return 0x00000000; +} + +var r = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 +]; + +var rh = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +]; + +var s = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 +]; + +var sh = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +]; + + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha.js": +/*!**********************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha.js ***! + \**********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +exports.sha1 = __webpack_require__(/*! ./sha/1 */ "./node_modules/hash.js/lib/hash/sha/1.js"); +exports.sha224 = __webpack_require__(/*! ./sha/224 */ "./node_modules/hash.js/lib/hash/sha/224.js"); +exports.sha256 = __webpack_require__(/*! ./sha/256 */ "./node_modules/hash.js/lib/hash/sha/256.js"); +exports.sha384 = __webpack_require__(/*! ./sha/384 */ "./node_modules/hash.js/lib/hash/sha/384.js"); +exports.sha512 = __webpack_require__(/*! ./sha/512 */ "./node_modules/hash.js/lib/hash/sha/512.js"); + + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha/1.js": +/*!************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha/1.js ***! + \************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/hash.js/lib/hash/utils.js"); +var common = __webpack_require__(/*! ../common */ "./node_modules/hash.js/lib/hash/common.js"); +var shaCommon = __webpack_require__(/*! ./common */ "./node_modules/hash.js/lib/hash/sha/common.js"); + +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_5 = utils.sum32_5; +var ft_1 = shaCommon.ft_1; +var BlockHash = common.BlockHash; + +var sha1_K = [ + 0x5A827999, 0x6ED9EBA1, + 0x8F1BBCDC, 0xCA62C1D6 +]; + +function SHA1() { + if (!(this instanceof SHA1)) + return new SHA1(); + + BlockHash.call(this); + this.h = [ + 0x67452301, 0xefcdab89, 0x98badcfe, + 0x10325476, 0xc3d2e1f0 ]; + this.W = new Array(80); +} + +utils.inherits(SHA1, BlockHash); +module.exports = SHA1; + +SHA1.blockSize = 512; +SHA1.outSize = 160; +SHA1.hmacStrength = 80; +SHA1.padLength = 64; + +SHA1.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; + + for(; i < W.length; i++) + W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + + for (i = 0; i < W.length; i++) { + var s = ~~(i / 20); + var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]); + e = d; + d = c; + c = rotl32(b, 30); + b = a; + a = t; + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); +}; + +SHA1.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha/224.js": +/*!**************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha/224.js ***! + \**************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/hash.js/lib/hash/utils.js"); +var SHA256 = __webpack_require__(/*! ./256 */ "./node_modules/hash.js/lib/hash/sha/256.js"); + +function SHA224() { + if (!(this instanceof SHA224)) + return new SHA224(); + + SHA256.call(this); + this.h = [ + 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]; +} +utils.inherits(SHA224, SHA256); +module.exports = SHA224; + +SHA224.blockSize = 512; +SHA224.outSize = 224; +SHA224.hmacStrength = 192; +SHA224.padLength = 64; + +SHA224.prototype._digest = function digest(enc) { + // Just truncate output + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 7), 'big'); + else + return utils.split32(this.h.slice(0, 7), 'big'); +}; + + + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha/256.js": +/*!**************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha/256.js ***! + \**************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/hash.js/lib/hash/utils.js"); +var common = __webpack_require__(/*! ../common */ "./node_modules/hash.js/lib/hash/common.js"); +var shaCommon = __webpack_require__(/*! ./common */ "./node_modules/hash.js/lib/hash/sha/common.js"); +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); + +var sum32 = utils.sum32; +var sum32_4 = utils.sum32_4; +var sum32_5 = utils.sum32_5; +var ch32 = shaCommon.ch32; +var maj32 = shaCommon.maj32; +var s0_256 = shaCommon.s0_256; +var s1_256 = shaCommon.s1_256; +var g0_256 = shaCommon.g0_256; +var g1_256 = shaCommon.g1_256; + +var BlockHash = common.BlockHash; + +var sha256_K = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]; + +function SHA256() { + if (!(this instanceof SHA256)) + return new SHA256(); + + BlockHash.call(this); + this.h = [ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 + ]; + this.k = sha256_K; + this.W = new Array(64); +} +utils.inherits(SHA256, BlockHash); +module.exports = SHA256; + +SHA256.blockSize = 512; +SHA256.outSize = 256; +SHA256.hmacStrength = 192; +SHA256.padLength = 64; + +SHA256.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; + for (; i < W.length; i++) + W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]); + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + var f = this.h[5]; + var g = this.h[6]; + var h = this.h[7]; + + assert(this.k.length === W.length); + for (i = 0; i < W.length; i++) { + var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]); + var T2 = sum32(s0_256(a), maj32(a, b, c)); + h = g; + g = f; + f = e; + e = sum32(d, T1); + d = c; + c = b; + b = a; + a = sum32(T1, T2); + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); + this.h[5] = sum32(this.h[5], f); + this.h[6] = sum32(this.h[6], g); + this.h[7] = sum32(this.h[7], h); +}; + +SHA256.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha/384.js": +/*!**************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha/384.js ***! + \**************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/hash.js/lib/hash/utils.js"); + +var SHA512 = __webpack_require__(/*! ./512 */ "./node_modules/hash.js/lib/hash/sha/512.js"); + +function SHA384() { + if (!(this instanceof SHA384)) + return new SHA384(); + + SHA512.call(this); + this.h = [ + 0xcbbb9d5d, 0xc1059ed8, + 0x629a292a, 0x367cd507, + 0x9159015a, 0x3070dd17, + 0x152fecd8, 0xf70e5939, + 0x67332667, 0xffc00b31, + 0x8eb44a87, 0x68581511, + 0xdb0c2e0d, 0x64f98fa7, + 0x47b5481d, 0xbefa4fa4 ]; +} +utils.inherits(SHA384, SHA512); +module.exports = SHA384; + +SHA384.blockSize = 1024; +SHA384.outSize = 384; +SHA384.hmacStrength = 192; +SHA384.padLength = 128; + +SHA384.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 12), 'big'); + else + return utils.split32(this.h.slice(0, 12), 'big'); +}; + + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha/512.js": +/*!**************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha/512.js ***! + \**************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/hash.js/lib/hash/utils.js"); +var common = __webpack_require__(/*! ../common */ "./node_modules/hash.js/lib/hash/common.js"); +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); + +var rotr64_hi = utils.rotr64_hi; +var rotr64_lo = utils.rotr64_lo; +var shr64_hi = utils.shr64_hi; +var shr64_lo = utils.shr64_lo; +var sum64 = utils.sum64; +var sum64_hi = utils.sum64_hi; +var sum64_lo = utils.sum64_lo; +var sum64_4_hi = utils.sum64_4_hi; +var sum64_4_lo = utils.sum64_4_lo; +var sum64_5_hi = utils.sum64_5_hi; +var sum64_5_lo = utils.sum64_5_lo; + +var BlockHash = common.BlockHash; + +var sha512_K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +]; + +function SHA512() { + if (!(this instanceof SHA512)) + return new SHA512(); + + BlockHash.call(this); + this.h = [ + 0x6a09e667, 0xf3bcc908, + 0xbb67ae85, 0x84caa73b, + 0x3c6ef372, 0xfe94f82b, + 0xa54ff53a, 0x5f1d36f1, + 0x510e527f, 0xade682d1, + 0x9b05688c, 0x2b3e6c1f, + 0x1f83d9ab, 0xfb41bd6b, + 0x5be0cd19, 0x137e2179 ]; + this.k = sha512_K; + this.W = new Array(160); +} +utils.inherits(SHA512, BlockHash); +module.exports = SHA512; + +SHA512.blockSize = 1024; +SHA512.outSize = 512; +SHA512.hmacStrength = 192; +SHA512.padLength = 128; + +SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { + var W = this.W; + + // 32 x 32bit words + for (var i = 0; i < 32; i++) + W[i] = msg[start + i]; + for (; i < W.length; i += 2) { + var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2 + var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); + var c1_hi = W[i - 14]; // i - 7 + var c1_lo = W[i - 13]; + var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15 + var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); + var c3_hi = W[i - 32]; // i - 16 + var c3_lo = W[i - 31]; + + W[i] = sum64_4_hi( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + W[i + 1] = sum64_4_lo( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + } +}; + +SHA512.prototype._update = function _update(msg, start) { + this._prepareBlock(msg, start); + + var W = this.W; + + var ah = this.h[0]; + var al = this.h[1]; + var bh = this.h[2]; + var bl = this.h[3]; + var ch = this.h[4]; + var cl = this.h[5]; + var dh = this.h[6]; + var dl = this.h[7]; + var eh = this.h[8]; + var el = this.h[9]; + var fh = this.h[10]; + var fl = this.h[11]; + var gh = this.h[12]; + var gl = this.h[13]; + var hh = this.h[14]; + var hl = this.h[15]; + + assert(this.k.length === W.length); + for (var i = 0; i < W.length; i += 2) { + var c0_hi = hh; + var c0_lo = hl; + var c1_hi = s1_512_hi(eh, el); + var c1_lo = s1_512_lo(eh, el); + var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); + var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); + var c3_hi = this.k[i]; + var c3_lo = this.k[i + 1]; + var c4_hi = W[i]; + var c4_lo = W[i + 1]; + + var T1_hi = sum64_5_hi( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + var T1_lo = sum64_5_lo( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + + c0_hi = s0_512_hi(ah, al); + c0_lo = s0_512_lo(ah, al); + c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); + c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); + + var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); + var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); + + hh = gh; + hl = gl; + + gh = fh; + gl = fl; + + fh = eh; + fl = el; + + eh = sum64_hi(dh, dl, T1_hi, T1_lo); + el = sum64_lo(dl, dl, T1_hi, T1_lo); + + dh = ch; + dl = cl; + + ch = bh; + cl = bl; + + bh = ah; + bl = al; + + ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); + al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); + } + + sum64(this.h, 0, ah, al); + sum64(this.h, 2, bh, bl); + sum64(this.h, 4, ch, cl); + sum64(this.h, 6, dh, dl); + sum64(this.h, 8, eh, el); + sum64(this.h, 10, fh, fl); + sum64(this.h, 12, gh, gl); + sum64(this.h, 14, hh, hl); +}; + +SHA512.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + +function ch64_hi(xh, xl, yh, yl, zh) { + var r = (xh & yh) ^ ((~xh) & zh); + if (r < 0) + r += 0x100000000; + return r; +} + +function ch64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ ((~xl) & zl); + if (r < 0) + r += 0x100000000; + return r; +} + +function maj64_hi(xh, xl, yh, yl, zh) { + var r = (xh & yh) ^ (xh & zh) ^ (yh & zh); + if (r < 0) + r += 0x100000000; + return r; +} + +function maj64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ (xl & zl) ^ (yl & zl); + if (r < 0) + r += 0x100000000; + return r; +} + +function s0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 28); + var c1_hi = rotr64_hi(xl, xh, 2); // 34 + var c2_hi = rotr64_hi(xl, xh, 7); // 39 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function s0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 28); + var c1_lo = rotr64_lo(xl, xh, 2); // 34 + var c2_lo = rotr64_lo(xl, xh, 7); // 39 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function s1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 14); + var c1_hi = rotr64_hi(xh, xl, 18); + var c2_hi = rotr64_hi(xl, xh, 9); // 41 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function s1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 14); + var c1_lo = rotr64_lo(xh, xl, 18); + var c2_lo = rotr64_lo(xl, xh, 9); // 41 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function g0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 1); + var c1_hi = rotr64_hi(xh, xl, 8); + var c2_hi = shr64_hi(xh, xl, 7); + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function g0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 1); + var c1_lo = rotr64_lo(xh, xl, 8); + var c2_lo = shr64_lo(xh, xl, 7); + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function g1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 19); + var c1_hi = rotr64_hi(xl, xh, 29); // 61 + var c2_hi = shr64_hi(xh, xl, 6); + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function g1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 19); + var c1_lo = rotr64_lo(xl, xh, 29); // 61 + var c2_lo = shr64_lo(xh, xl, 6); + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha/common.js": +/*!*****************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha/common.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/hash.js/lib/hash/utils.js"); +var rotr32 = utils.rotr32; + +function ft_1(s, x, y, z) { + if (s === 0) + return ch32(x, y, z); + if (s === 1 || s === 3) + return p32(x, y, z); + if (s === 2) + return maj32(x, y, z); +} +exports.ft_1 = ft_1; + +function ch32(x, y, z) { + return (x & y) ^ ((~x) & z); +} +exports.ch32 = ch32; + +function maj32(x, y, z) { + return (x & y) ^ (x & z) ^ (y & z); +} +exports.maj32 = maj32; + +function p32(x, y, z) { + return x ^ y ^ z; +} +exports.p32 = p32; + +function s0_256(x) { + return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); +} +exports.s0_256 = s0_256; + +function s1_256(x) { + return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); +} +exports.s1_256 = s1_256; + +function g0_256(x) { + return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3); +} +exports.g0_256 = g0_256; + +function g1_256(x) { + return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10); +} +exports.g1_256 = g1_256; + + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/utils.js": +/*!************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/utils.js ***! + \************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); + +exports.inherits = inherits; + +function isSurrogatePair(msg, i) { + if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) { + return false; + } + if (i < 0 || i + 1 >= msg.length) { + return false; + } + return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00; +} + +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === 'string') { + if (!enc) { + // Inspired by stringToUtf8ByteArray() in closure-library by Google + // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143 + // Apache License 2.0 + // https://github.com/google/closure-library/blob/master/LICENSE + var p = 0; + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + if (c < 128) { + res[p++] = c; + } else if (c < 2048) { + res[p++] = (c >> 6) | 192; + res[p++] = (c & 63) | 128; + } else if (isSurrogatePair(msg, i)) { + c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF); + res[p++] = (c >> 18) | 240; + res[p++] = ((c >> 12) & 63) | 128; + res[p++] = ((c >> 6) & 63) | 128; + res[p++] = (c & 63) | 128; + } else { + res[p++] = (c >> 12) | 224; + res[p++] = ((c >> 6) & 63) | 128; + res[p++] = (c & 63) | 128; + } + } + } else if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } + } else { + for (i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; + } + return res; +} +exports.toArray = toArray; + +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; +} +exports.toHex = toHex; + +function htonl(w) { + var res = (w >>> 24) | + ((w >>> 8) & 0xff00) | + ((w << 8) & 0xff0000) | + ((w & 0xff) << 24); + return res >>> 0; +} +exports.htonl = htonl; + +function toHex32(msg, endian) { + var res = ''; + for (var i = 0; i < msg.length; i++) { + var w = msg[i]; + if (endian === 'little') + w = htonl(w); + res += zero8(w.toString(16)); + } + return res; +} +exports.toHex32 = toHex32; + +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; +} +exports.zero2 = zero2; + +function zero8(word) { + if (word.length === 7) + return '0' + word; + else if (word.length === 6) + return '00' + word; + else if (word.length === 5) + return '000' + word; + else if (word.length === 4) + return '0000' + word; + else if (word.length === 3) + return '00000' + word; + else if (word.length === 2) + return '000000' + word; + else if (word.length === 1) + return '0000000' + word; + else + return word; +} +exports.zero8 = zero8; + +function join32(msg, start, end, endian) { + var len = end - start; + assert(len % 4 === 0); + var res = new Array(len / 4); + for (var i = 0, k = start; i < res.length; i++, k += 4) { + var w; + if (endian === 'big') + w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3]; + else + w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k]; + res[i] = w >>> 0; + } + return res; +} +exports.join32 = join32; + +function split32(msg, endian) { + var res = new Array(msg.length * 4); + for (var i = 0, k = 0; i < msg.length; i++, k += 4) { + var m = msg[i]; + if (endian === 'big') { + res[k] = m >>> 24; + res[k + 1] = (m >>> 16) & 0xff; + res[k + 2] = (m >>> 8) & 0xff; + res[k + 3] = m & 0xff; + } else { + res[k + 3] = m >>> 24; + res[k + 2] = (m >>> 16) & 0xff; + res[k + 1] = (m >>> 8) & 0xff; + res[k] = m & 0xff; + } + } + return res; +} +exports.split32 = split32; + +function rotr32(w, b) { + return (w >>> b) | (w << (32 - b)); +} +exports.rotr32 = rotr32; + +function rotl32(w, b) { + return (w << b) | (w >>> (32 - b)); +} +exports.rotl32 = rotl32; + +function sum32(a, b) { + return (a + b) >>> 0; +} +exports.sum32 = sum32; + +function sum32_3(a, b, c) { + return (a + b + c) >>> 0; +} +exports.sum32_3 = sum32_3; + +function sum32_4(a, b, c, d) { + return (a + b + c + d) >>> 0; +} +exports.sum32_4 = sum32_4; + +function sum32_5(a, b, c, d, e) { + return (a + b + c + d + e) >>> 0; +} +exports.sum32_5 = sum32_5; + +function sum64(buf, pos, ah, al) { + var bh = buf[pos]; + var bl = buf[pos + 1]; + + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + buf[pos] = hi >>> 0; + buf[pos + 1] = lo; +} +exports.sum64 = sum64; + +function sum64_hi(ah, al, bh, bl) { + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + return hi >>> 0; +} +exports.sum64_hi = sum64_hi; + +function sum64_lo(ah, al, bh, bl) { + var lo = al + bl; + return lo >>> 0; +} +exports.sum64_lo = sum64_lo; + +function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + + var hi = ah + bh + ch + dh + carry; + return hi >>> 0; +} +exports.sum64_4_hi = sum64_4_hi; + +function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { + var lo = al + bl + cl + dl; + return lo >>> 0; +} +exports.sum64_4_lo = sum64_4_lo; + +function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + lo = (lo + el) >>> 0; + carry += lo < el ? 1 : 0; + + var hi = ah + bh + ch + dh + eh + carry; + return hi >>> 0; +} +exports.sum64_5_hi = sum64_5_hi; + +function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var lo = al + bl + cl + dl + el; + + return lo >>> 0; +} +exports.sum64_5_lo = sum64_5_lo; + +function rotr64_hi(ah, al, num) { + var r = (al << (32 - num)) | (ah >>> num); + return r >>> 0; +} +exports.rotr64_hi = rotr64_hi; + +function rotr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +} +exports.rotr64_lo = rotr64_lo; + +function shr64_hi(ah, al, num) { + return ah >>> num; +} +exports.shr64_hi = shr64_hi; + +function shr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +} +exports.shr64_lo = shr64_lo; + + +/***/ }), + +/***/ "./node_modules/hmac-drbg/lib/hmac-drbg.js": +/*!*************************************************!*\ + !*** ./node_modules/hmac-drbg/lib/hmac-drbg.js ***! + \*************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var hash = __webpack_require__(/*! hash.js */ "./node_modules/hash.js/lib/hash.js"); +var utils = __webpack_require__(/*! minimalistic-crypto-utils */ "./node_modules/minimalistic-crypto-utils/lib/utils.js"); +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); + +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); +} +module.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] = 0x00; + this.V[i] = 0x01; + } + + this._update(seed); + this._reseed = 1; + this.reseedInterval = 0x1000000000000; // 2^48 +}; + +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([ 0x00 ]); + if (seed) + kmac = kmac.update(seed); + this.K = kmac.digest(); + this.V = this._hmac().update(this.V).digest(); + if (!seed) + return; + + this.K = this._hmac() + .update(this.V) + .update([ 0x01 ]) + .update(seed) + .digest(); + this.V = this._hmac().update(this.V).digest(); +}; + +HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { + // Optional entropy enc + if (typeof entropyEnc !== 'string') { + addEnc = add; + add = entropyEnc; + entropyEnc = null; + } + + entropy = utils.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'); + + // Optional encoding + if (typeof enc !== 'string') { + addEnc = add; + add = enc; + enc = null; + } + + // Optional additional data + 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/https-browserify/index.js": +/*!************************************************!*\ + !*** ./node_modules/https-browserify/index.js ***! + \************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var http = __webpack_require__(/*! http */ "./node_modules/stream-http/index.js") +var url = __webpack_require__(/*! url */ "./node_modules/url/url.js") + +var https = module.exports + +for (var key in http) { + if (http.hasOwnProperty(key)) https[key] = http[key] +} + +https.request = function (params, cb) { + params = validateParams(params) + return http.request.call(this, params, cb) +} + +https.get = function (params, cb) { + params = validateParams(params) + return http.get.call(this, params, cb) +} + +function validateParams (params) { + if (typeof params === 'string') { + params = url.parse(params) + } + if (!params.protocol) { + params.protocol = 'https:' + } + if (params.protocol !== 'https:') { + throw new Error('Protocol "' + params.protocol + '" not supported. Expected "https:"') + } + return params +} + + +/***/ }), + +/***/ "./node_modules/ieee754/index.js": +/*!***************************************!*\ + !*** ./node_modules/ieee754/index.js ***! + \***************************************/ +/***/ (function(__unused_webpack_module, exports) { + +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] + + i += d + + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) +} + +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + + value = Math.abs(value) + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } + + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = ((value * c) - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128 +} + + +/***/ }), + +/***/ "./node_modules/inherits/inherits_browser.js": +/*!***************************************************!*\ + !*** ./node_modules/inherits/inherits_browser.js ***! + \***************************************************/ +/***/ (function(module) { + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + + +/***/ }), + +/***/ "./node_modules/is-arguments/index.js": +/*!********************************************!*\ + !*** ./node_modules/is-arguments/index.js ***! + \********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")(); +var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js"); + +var $toString = callBound('Object.prototype.toString'); + +var isStandardArguments = function isArguments(value) { + if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) { + return false; + } + return $toString(value) === '[object Arguments]'; +}; + +var isLegacyArguments = function isArguments(value) { + if (isStandardArguments(value)) { + return true; + } + return value !== null && + typeof value === 'object' && + typeof value.length === 'number' && + value.length >= 0 && + $toString(value) !== '[object Array]' && + $toString(value.callee) === '[object Function]'; +}; + +var supportsStandardArguments = (function () { + return isStandardArguments(arguments); +}()); + +isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests + +module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; + + +/***/ }), + +/***/ "./node_modules/is-callable/index.js": +/*!*******************************************!*\ + !*** ./node_modules/is-callable/index.js ***! + \*******************************************/ +/***/ (function(module) { + +"use strict"; + + +var fnToStr = Function.prototype.toString; +var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply; +var badArrayLike; +var isCallableMarker; +if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') { + try { + badArrayLike = Object.defineProperty({}, 'length', { + get: function () { + throw isCallableMarker; + } + }); + isCallableMarker = {}; + // eslint-disable-next-line no-throw-literal + reflectApply(function () { throw 42; }, null, badArrayLike); + } catch (_) { + if (_ !== isCallableMarker) { + reflectApply = null; + } + } +} else { + reflectApply = null; +} + +var constructorRegex = /^\s*class\b/; +var isES6ClassFn = function isES6ClassFunction(value) { + try { + var fnStr = fnToStr.call(value); + return constructorRegex.test(fnStr); + } catch (e) { + return false; // not a function + } +}; + +var tryFunctionObject = function tryFunctionToStr(value) { + try { + if (isES6ClassFn(value)) { return false; } + fnToStr.call(value); + return true; + } catch (e) { + return false; + } +}; +var toStr = Object.prototype.toString; +var objectClass = '[object Object]'; +var fnClass = '[object Function]'; +var genClass = '[object GeneratorFunction]'; +var ddaClass = '[object HTMLAllCollection]'; // IE 11 +var ddaClass2 = '[object HTML document.all class]'; +var ddaClass3 = '[object HTMLCollection]'; // IE 9-10 +var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag` + +var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing + +var isDDA = function isDocumentDotAll() { return false; }; +if (typeof document === 'object') { + // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly + var all = document.all; + if (toStr.call(all) === toStr.call(document.all)) { + isDDA = function isDocumentDotAll(value) { + /* globals document: false */ + // in IE 6-8, typeof document.all is "object" and it's truthy + if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) { + try { + var str = toStr.call(value); + return ( + str === ddaClass + || str === ddaClass2 + || str === ddaClass3 // opera 12.16 + || str === objectClass // IE 6-8 + ) && value('') == null; // eslint-disable-line eqeqeq + } catch (e) { /**/ } + } + return false; + }; + } +} + +module.exports = reflectApply + ? function isCallable(value) { + if (isDDA(value)) { return true; } + if (!value) { return false; } + if (typeof value !== 'function' && typeof value !== 'object') { return false; } + try { + reflectApply(value, null, badArrayLike); + } catch (e) { + if (e !== isCallableMarker) { return false; } + } + return !isES6ClassFn(value) && tryFunctionObject(value); + } + : function isCallable(value) { + if (isDDA(value)) { return true; } + if (!value) { return false; } + if (typeof value !== 'function' && typeof value !== 'object') { return false; } + if (hasToStringTag) { return tryFunctionObject(value); } + if (isES6ClassFn(value)) { return false; } + var strClass = toStr.call(value); + if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; } + return tryFunctionObject(value); + }; + + +/***/ }), + +/***/ "./node_modules/is-generator-function/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/is-generator-function/index.js ***! + \*****************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var toStr = Object.prototype.toString; +var fnToStr = Function.prototype.toString; +var isFnRegex = /^\s*(?:function)?\*/; +var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")(); +var getProto = Object.getPrototypeOf; +var getGeneratorFunc = function () { // eslint-disable-line consistent-return + if (!hasToStringTag) { + return false; + } + try { + return Function('return function*() {}')(); + } catch (e) { + } +}; +var GeneratorFunction; + +module.exports = function isGeneratorFunction(fn) { + if (typeof fn !== 'function') { + return false; + } + if (isFnRegex.test(fnToStr.call(fn))) { + return true; + } + if (!hasToStringTag) { + var str = toStr.call(fn); + return str === '[object GeneratorFunction]'; + } + if (!getProto) { + return false; + } + if (typeof GeneratorFunction === 'undefined') { + var generatorFunc = getGeneratorFunc(); + GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; + } + return getProto(fn) === GeneratorFunction; +}; + + +/***/ }), + +/***/ "./node_modules/is-nan/implementation.js": +/*!***********************************************!*\ + !*** ./node_modules/is-nan/implementation.js ***! + \***********************************************/ +/***/ (function(module) { + +"use strict"; + + +/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */ + +module.exports = function isNaN(value) { + return value !== value; +}; + + +/***/ }), + +/***/ "./node_modules/is-nan/index.js": +/*!**************************************!*\ + !*** ./node_modules/is-nan/index.js ***! + \**************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var callBind = __webpack_require__(/*! call-bind */ "./node_modules/call-bind/index.js"); +var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js"); + +var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/is-nan/implementation.js"); +var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/is-nan/polyfill.js"); +var shim = __webpack_require__(/*! ./shim */ "./node_modules/is-nan/shim.js"); + +var polyfill = callBind(getPolyfill(), Number); + +/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */ + +define(polyfill, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = polyfill; + + +/***/ }), + +/***/ "./node_modules/is-nan/polyfill.js": +/*!*****************************************!*\ + !*** ./node_modules/is-nan/polyfill.js ***! + \*****************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/is-nan/implementation.js"); + +module.exports = function getPolyfill() { + if (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN('a')) { + return Number.isNaN; + } + return implementation; +}; + + +/***/ }), + +/***/ "./node_modules/is-nan/shim.js": +/*!*************************************!*\ + !*** ./node_modules/is-nan/shim.js ***! + \*************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js"); +var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/is-nan/polyfill.js"); + +/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */ + +module.exports = function shimNumberIsNaN() { + var polyfill = getPolyfill(); + define(Number, { isNaN: polyfill }, { + isNaN: function testIsNaN() { + return Number.isNaN !== polyfill; + } + }); + return polyfill; +}; + + +/***/ }), + +/***/ "./node_modules/is-typed-array/index.js": +/*!**********************************************!*\ + !*** ./node_modules/is-typed-array/index.js ***! + \**********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var forEach = __webpack_require__(/*! for-each */ "./node_modules/for-each/index.js"); +var availableTypedArrays = __webpack_require__(/*! available-typed-arrays */ "./node_modules/available-typed-arrays/index.js"); +var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js"); + +var $toString = callBound('Object.prototype.toString'); +var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")(); +var gOPD = __webpack_require__(/*! gopd */ "./node_modules/gopd/index.js"); + +var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; +var typedArrays = availableTypedArrays(); + +var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { + for (var i = 0; i < array.length; i += 1) { + if (array[i] === value) { + return i; + } + } + return -1; +}; +var $slice = callBound('String.prototype.slice'); +var toStrTags = {}; +var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); +if (hasToStringTag && gOPD && getPrototypeOf) { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + if (Symbol.toStringTag in arr) { + var proto = getPrototypeOf(arr); + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor) { + var superProto = getPrototypeOf(proto); + descriptor = gOPD(superProto, Symbol.toStringTag); + } + toStrTags[typedArray] = descriptor.get; + } + }); +} + +var tryTypedArrays = function tryAllTypedArrays(value) { + var anyTrue = false; + forEach(toStrTags, function (getter, typedArray) { + if (!anyTrue) { + try { + anyTrue = getter.call(value) === typedArray; + } catch (e) { /**/ } + } + }); + return anyTrue; +}; + +module.exports = function isTypedArray(value) { + if (!value || typeof value !== 'object') { return false; } + if (!hasToStringTag || !(Symbol.toStringTag in value)) { + var tag = $slice($toString(value), 8, -1); + return $indexOf(typedArrays, tag) > -1; + } + if (!gOPD) { return false; } + return tryTypedArrays(value); +}; + + +/***/ }), + +/***/ "./node_modules/isomorphic-ws/browser.js": +/*!***********************************************!*\ + !*** ./node_modules/isomorphic-ws/browser.js ***! + \***********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +// https://github.com/maxogden/websocket-stream/blob/48dc3ddf943e5ada668c31ccd94e9186f02fafbd/ws-fallback.js + +var ws = null + +if (typeof WebSocket !== 'undefined') { + ws = WebSocket +} else if (typeof MozWebSocket !== 'undefined') { + ws = MozWebSocket +} else if (typeof __webpack_require__.g !== 'undefined') { + ws = __webpack_require__.g.WebSocket || __webpack_require__.g.MozWebSocket +} else if (typeof window !== 'undefined') { + ws = window.WebSocket || window.MozWebSocket +} else if (typeof self !== 'undefined') { + ws = self.WebSocket || self.MozWebSocket +} + +module.exports = ws + + +/***/ }), + +/***/ "./node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js": +/*!****************************************************************************!*\ + !*** ./node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js ***! + \****************************************************************************/ +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!function(e){function r(e,r){"use strict";var t,a="uint8array",_=r.ready.then((function(){function a(){if(0!==t._sodium_init())throw new Error("libsodium was not correctly initialized.");for(var r=["crypto_aead_chacha20poly1305_decrypt","crypto_aead_chacha20poly1305_decrypt_detached","crypto_aead_chacha20poly1305_encrypt","crypto_aead_chacha20poly1305_encrypt_detached","crypto_aead_chacha20poly1305_ietf_decrypt","crypto_aead_chacha20poly1305_ietf_decrypt_detached","crypto_aead_chacha20poly1305_ietf_encrypt","crypto_aead_chacha20poly1305_ietf_encrypt_detached","crypto_aead_chacha20poly1305_ietf_keygen","crypto_aead_chacha20poly1305_keygen","crypto_aead_xchacha20poly1305_ietf_decrypt","crypto_aead_xchacha20poly1305_ietf_decrypt_detached","crypto_aead_xchacha20poly1305_ietf_encrypt","crypto_aead_xchacha20poly1305_ietf_encrypt_detached","crypto_aead_xchacha20poly1305_ietf_keygen","crypto_auth","crypto_auth_hmacsha256","crypto_auth_hmacsha256_final","crypto_auth_hmacsha256_init","crypto_auth_hmacsha256_keygen","crypto_auth_hmacsha256_update","crypto_auth_hmacsha256_verify","crypto_auth_hmacsha512","crypto_auth_hmacsha512_final","crypto_auth_hmacsha512_init","crypto_auth_hmacsha512_keygen","crypto_auth_hmacsha512_update","crypto_auth_hmacsha512_verify","crypto_auth_keygen","crypto_auth_verify","crypto_box_beforenm","crypto_box_curve25519xchacha20poly1305_keypair","crypto_box_curve25519xchacha20poly1305_seal","crypto_box_curve25519xchacha20poly1305_seal_open","crypto_box_detached","crypto_box_easy","crypto_box_easy_afternm","crypto_box_keypair","crypto_box_open_detached","crypto_box_open_easy","crypto_box_open_easy_afternm","crypto_box_seal","crypto_box_seal_open","crypto_box_seed_keypair","crypto_core_ed25519_add","crypto_core_ed25519_from_hash","crypto_core_ed25519_from_uniform","crypto_core_ed25519_is_valid_point","crypto_core_ed25519_random","crypto_core_ed25519_scalar_add","crypto_core_ed25519_scalar_complement","crypto_core_ed25519_scalar_invert","crypto_core_ed25519_scalar_mul","crypto_core_ed25519_scalar_negate","crypto_core_ed25519_scalar_random","crypto_core_ed25519_scalar_reduce","crypto_core_ed25519_scalar_sub","crypto_core_ed25519_sub","crypto_core_hchacha20","crypto_core_hsalsa20","crypto_core_ristretto255_add","crypto_core_ristretto255_from_hash","crypto_core_ristretto255_is_valid_point","crypto_core_ristretto255_random","crypto_core_ristretto255_scalar_add","crypto_core_ristretto255_scalar_complement","crypto_core_ristretto255_scalar_invert","crypto_core_ristretto255_scalar_mul","crypto_core_ristretto255_scalar_negate","crypto_core_ristretto255_scalar_random","crypto_core_ristretto255_scalar_reduce","crypto_core_ristretto255_scalar_sub","crypto_core_ristretto255_sub","crypto_generichash","crypto_generichash_blake2b_salt_personal","crypto_generichash_final","crypto_generichash_init","crypto_generichash_keygen","crypto_generichash_update","crypto_hash","crypto_hash_sha256","crypto_hash_sha256_final","crypto_hash_sha256_init","crypto_hash_sha256_update","crypto_hash_sha512","crypto_hash_sha512_final","crypto_hash_sha512_init","crypto_hash_sha512_update","crypto_kdf_derive_from_key","crypto_kdf_keygen","crypto_kx_client_session_keys","crypto_kx_keypair","crypto_kx_seed_keypair","crypto_kx_server_session_keys","crypto_onetimeauth","crypto_onetimeauth_final","crypto_onetimeauth_init","crypto_onetimeauth_keygen","crypto_onetimeauth_update","crypto_onetimeauth_verify","crypto_pwhash","crypto_pwhash_scryptsalsa208sha256","crypto_pwhash_scryptsalsa208sha256_ll","crypto_pwhash_scryptsalsa208sha256_str","crypto_pwhash_scryptsalsa208sha256_str_verify","crypto_pwhash_str","crypto_pwhash_str_needs_rehash","crypto_pwhash_str_verify","crypto_scalarmult","crypto_scalarmult_base","crypto_scalarmult_ed25519","crypto_scalarmult_ed25519_base","crypto_scalarmult_ed25519_base_noclamp","crypto_scalarmult_ed25519_noclamp","crypto_scalarmult_ristretto255","crypto_scalarmult_ristretto255_base","crypto_secretbox_detached","crypto_secretbox_easy","crypto_secretbox_keygen","crypto_secretbox_open_detached","crypto_secretbox_open_easy","crypto_secretstream_xchacha20poly1305_init_pull","crypto_secretstream_xchacha20poly1305_init_push","crypto_secretstream_xchacha20poly1305_keygen","crypto_secretstream_xchacha20poly1305_pull","crypto_secretstream_xchacha20poly1305_push","crypto_secretstream_xchacha20poly1305_rekey","crypto_shorthash","crypto_shorthash_keygen","crypto_shorthash_siphashx24","crypto_sign","crypto_sign_detached","crypto_sign_ed25519_pk_to_curve25519","crypto_sign_ed25519_sk_to_curve25519","crypto_sign_ed25519_sk_to_pk","crypto_sign_ed25519_sk_to_seed","crypto_sign_final_create","crypto_sign_final_verify","crypto_sign_init","crypto_sign_keypair","crypto_sign_open","crypto_sign_seed_keypair","crypto_sign_update","crypto_sign_verify_detached","crypto_stream_chacha20","crypto_stream_chacha20_ietf_xor","crypto_stream_chacha20_ietf_xor_ic","crypto_stream_chacha20_keygen","crypto_stream_chacha20_xor","crypto_stream_chacha20_xor_ic","crypto_stream_keygen","crypto_stream_xchacha20_keygen","crypto_stream_xchacha20_xor","crypto_stream_xchacha20_xor_ic","randombytes_buf","randombytes_buf_deterministic","randombytes_close","randombytes_random","randombytes_set_implementation","randombytes_stir","randombytes_uniform","sodium_version_string"],a=[x,k,S,T,w,Y,B,A,K,M,I,N,L,U,O,C,R,P,G,X,D,F,V,H,q,j,z,W,J,Q,Z,$,ee,re,te,ae,_e,se,ne,ce,oe,he,pe,ye,ie,le,ue,de,ve,ge,be,fe,me,Ee,xe,ke,Se,Te,we,Ye,Be,Ae,Ke,Me,Ie,Ne,Le,Ue,Oe,Ce,Re,Pe,Ge,Xe,De,Fe,Ve,He,qe,je,ze,We,Je,Qe,Ze,$e,er,rr,tr,ar,_r,sr,nr,cr,or,hr,pr,yr,ir,lr,ur,dr,vr,gr,br,fr,mr,Er,xr,kr,Sr,Tr,wr,Yr,Br,Ar,Kr,Mr,Ir,Nr,Lr,Ur,Or,Cr,Rr,Pr,Gr,Xr,Dr,Fr,Vr,Hr,qr,jr,zr,Wr,Jr,Qr,Zr,$r,et,rt,tt,at,_t,st,nt,ct,ot,ht,pt,yt,it,lt,ut,dt,vt,gt,bt,ft,mt,Et],_=0;_=240?(p=4,o=!0):y>=224?(p=3,o=!0):y>=192?(p=2,o=!0):y<128&&(p=1,o=!0)}while(!o);for(var i=p-(c.length-h),l=0;l>8&-39)<<8|87+(r=e[s]>>>4)+(r-10>>8&-39),_+=String.fromCharCode(255&a)+String.fromCharCode(a>>>8);return _}var o={ORIGINAL:1,ORIGINAL_NO_PADDING:3,URLSAFE:5,URLSAFE_NO_PADDING:7};function h(e){if(null==e)return o.URLSAFE_NO_PADDING;if(e!==o.ORIGINAL&&e!==o.ORIGINAL_NO_PADDING&&e!==o.URLSAFE&&e!=o.URLSAFE_NO_PADDING)throw new Error("unsupported base64 variant");return e}function p(e,r){r=h(r),e=E(_,e,"input");var a,_=[],s=0|Math.floor(e.length/3),c=e.length-3*s,o=4*s+(0!==c?0==(2&r)?4:2+(c>>>1):0),p=new u(o+1),y=d(e);return _.push(y),_.push(p.address),0===t._sodium_bin2base64(p.address,p.length,y,e.length,r)&&b(_,"conversion failed"),p.length=o,a=n(p.to_Uint8Array()),g(_),a}function y(e,r){var t=r||a;if(!i(t))throw new Error(t+" output format is not available");if(e instanceof u){if("uint8array"===t)return e.to_Uint8Array();if("text"===t)return n(e.to_Uint8Array());if("hex"===t)return c(e.to_Uint8Array());if("base64"===t)return p(e.to_Uint8Array(),o.URLSAFE_NO_PADDING);throw new Error('What is output format "'+t+'"?')}if("object"==typeof e){for(var _=Object.keys(e),s={},h=0;h<_.length;h++)s[_[h]]=y(e[_[h]],t);return s}if("string"==typeof e)return e;throw new TypeError("Cannot format output")}function i(e){for(var r=["uint8array","text","hex","base64"],t=0;t>>24>>>8,o,p);var x=y(v,n);return g(c),x}function ar(e){var r=[];l(e);var a=new u(0|t._crypto_kdf_keybytes()),_=a.address;r.push(_),t._crypto_kdf_keygen(_);var s=y(a,e);return g(r),s}function _r(e,r,a,_){var s=[];l(_),e=E(s,e,"clientPublicKey");var n,c=0|t._crypto_kx_publickeybytes();e.length!==c&&f(s,"invalid clientPublicKey length"),n=d(e),s.push(n),r=E(s,r,"clientSecretKey");var o,h=0|t._crypto_kx_secretkeybytes();r.length!==h&&f(s,"invalid clientSecretKey length"),o=d(r),s.push(o),a=E(s,a,"serverPublicKey");var p,i=0|t._crypto_kx_publickeybytes();a.length!==i&&f(s,"invalid serverPublicKey length"),p=d(a),s.push(p);var v=new u(0|t._crypto_kx_sessionkeybytes()),m=v.address;s.push(m);var x=new u(0|t._crypto_kx_sessionkeybytes()),k=x.address;if(s.push(k),0==(0|t._crypto_kx_client_session_keys(m,k,n,o,p))){var S=y({sharedRx:v,sharedTx:x},_);return g(s),S}b(s,"invalid usage")}function sr(e){var r=[];l(e);var a=new u(0|t._crypto_kx_publickeybytes()),_=a.address;r.push(_);var s=new u(0|t._crypto_kx_secretkeybytes()),n=s.address;if(r.push(n),0==(0|t._crypto_kx_keypair(_,n))){var c={publicKey:y(a,e),privateKey:y(s,e),keyType:"x25519"};return g(r),c}b(r,"internal error")}function nr(e,r){var a=[];l(r),e=E(a,e,"seed");var _,s=0|t._crypto_kx_seedbytes();e.length!==s&&f(a,"invalid seed length"),_=d(e),a.push(_);var n=new u(0|t._crypto_kx_publickeybytes()),c=n.address;a.push(c);var o=new u(0|t._crypto_kx_secretkeybytes()),h=o.address;if(a.push(h),0==(0|t._crypto_kx_seed_keypair(c,h,_))){var p={publicKey:y(n,r),privateKey:y(o,r),keyType:"x25519"};return g(a),p}b(a,"internal error")}function cr(e,r,a,_){var s=[];l(_),e=E(s,e,"serverPublicKey");var n,c=0|t._crypto_kx_publickeybytes();e.length!==c&&f(s,"invalid serverPublicKey length"),n=d(e),s.push(n),r=E(s,r,"serverSecretKey");var o,h=0|t._crypto_kx_secretkeybytes();r.length!==h&&f(s,"invalid serverSecretKey length"),o=d(r),s.push(o),a=E(s,a,"clientPublicKey");var p,i=0|t._crypto_kx_publickeybytes();a.length!==i&&f(s,"invalid clientPublicKey length"),p=d(a),s.push(p);var v=new u(0|t._crypto_kx_sessionkeybytes()),m=v.address;s.push(m);var x=new u(0|t._crypto_kx_sessionkeybytes()),k=x.address;if(s.push(k),0==(0|t._crypto_kx_server_session_keys(m,k,n,o,p))){var S=y({sharedRx:v,sharedTx:x},_);return g(s),S}b(s,"invalid usage")}function or(e,r,a){var _=[];l(a);var s=d(e=E(_,e,"message")),n=e.length;_.push(s),r=E(_,r,"key");var c,o=0|t._crypto_onetimeauth_keybytes();r.length!==o&&f(_,"invalid key length"),c=d(r),_.push(c);var h=new u(0|t._crypto_onetimeauth_bytes()),p=h.address;if(_.push(p),0==(0|t._crypto_onetimeauth(p,s,n,0,c))){var i=y(h,a);return g(_),i}b(_,"invalid usage")}function hr(e,r){var a=[];l(r),m(a,e,"state_address");var _=new u(0|t._crypto_onetimeauth_bytes()),s=_.address;if(a.push(s),0==(0|t._crypto_onetimeauth_final(e,s))){var n=(t._free(e),y(_,r));return g(a),n}b(a,"invalid usage")}function pr(e,r){var a=[];l(r);var _=null;null!=e&&(_=d(e=E(a,e,"key")),e.length,a.push(_));var s=new u(144).address;if(0==(0|t._crypto_onetimeauth_init(s,_))){var n=s;return g(a),n}b(a,"invalid usage")}function yr(e){var r=[];l(e);var a=new u(0|t._crypto_onetimeauth_keybytes()),_=a.address;r.push(_),t._crypto_onetimeauth_keygen(_);var s=y(a,e);return g(r),s}function ir(e,r,a){var _=[];l(a),m(_,e,"state_address");var s=d(r=E(_,r,"message_chunk")),n=r.length;_.push(s),0!=(0|t._crypto_onetimeauth_update(e,s,n))&&b(_,"invalid usage"),g(_)}function lr(e,r,a){var _=[];e=E(_,e,"hash");var s,n=0|t._crypto_onetimeauth_bytes();e.length!==n&&f(_,"invalid hash length"),s=d(e),_.push(s);var c=d(r=E(_,r,"message")),o=r.length;_.push(c),a=E(_,a,"key");var h,p=0|t._crypto_onetimeauth_keybytes();a.length!==p&&f(_,"invalid key length"),h=d(a),_.push(h);var y=0==(0|t._crypto_onetimeauth_verify(s,c,o,0,h));return g(_),y}function ur(e,r,a,_,s,n,c){var o=[];l(c),m(o,e,"keyLength"),("number"!=typeof e||(0|e)!==e||e<0)&&f(o,"keyLength must be an unsigned integer");var h=d(r=E(o,r,"password")),p=r.length;o.push(h),a=E(o,a,"salt");var i,v=0|t._crypto_pwhash_saltbytes();a.length!==v&&f(o,"invalid salt length"),i=d(a),o.push(i),m(o,_,"opsLimit"),("number"!=typeof _||(0|_)!==_||_<0)&&f(o,"opsLimit must be an unsigned integer"),m(o,s,"memLimit"),("number"!=typeof s||(0|s)!==s||s<0)&&f(o,"memLimit must be an unsigned integer"),m(o,n,"algorithm"),("number"!=typeof n||(0|n)!==n||n<0)&&f(o,"algorithm must be an unsigned integer");var x=new u(0|e),k=x.address;if(o.push(k),0==(0|t._crypto_pwhash(k,e,0,h,p,0,i,_,0,s,n))){var S=y(x,c);return g(o),S}b(o,"invalid usage")}function dr(e,r,a,_,s,n){var c=[];l(n),m(c,e,"keyLength"),("number"!=typeof e||(0|e)!==e||e<0)&&f(c,"keyLength must be an unsigned integer");var o=d(r=E(c,r,"password")),h=r.length;c.push(o),a=E(c,a,"salt");var p,i=0|t._crypto_pwhash_scryptsalsa208sha256_saltbytes();a.length!==i&&f(c,"invalid salt length"),p=d(a),c.push(p),m(c,_,"opsLimit"),("number"!=typeof _||(0|_)!==_||_<0)&&f(c,"opsLimit must be an unsigned integer"),m(c,s,"memLimit"),("number"!=typeof s||(0|s)!==s||s<0)&&f(c,"memLimit must be an unsigned integer");var v=new u(0|e),x=v.address;if(c.push(x),0==(0|t._crypto_pwhash_scryptsalsa208sha256(x,e,0,o,h,0,p,_,0,s))){var k=y(v,n);return g(c),k}b(c,"invalid usage")}function vr(e,r,a,_,s,n,c){var o=[];l(c);var h=d(e=E(o,e,"password")),p=e.length;o.push(h);var i=d(r=E(o,r,"salt")),v=r.length;o.push(i),m(o,a,"opsLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&f(o,"opsLimit must be an unsigned integer"),m(o,_,"r"),("number"!=typeof _||(0|_)!==_||_<0)&&f(o,"r must be an unsigned integer"),m(o,s,"p"),("number"!=typeof s||(0|s)!==s||s<0)&&f(o,"p must be an unsigned integer"),m(o,n,"keyLength"),("number"!=typeof n||(0|n)!==n||n<0)&&f(o,"keyLength must be an unsigned integer");var x=new u(0|n),k=x.address;if(o.push(k),0==(0|t._crypto_pwhash_scryptsalsa208sha256_ll(h,p,i,v,a,0,_,s,k,n))){var S=y(x,c);return g(o),S}b(o,"invalid usage")}function gr(e,r,a,_){var s=[];l(_);var n=d(e=E(s,e,"password")),c=e.length;s.push(n),m(s,r,"opsLimit"),("number"!=typeof r||(0|r)!==r||r<0)&&f(s,"opsLimit must be an unsigned integer"),m(s,a,"memLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&f(s,"memLimit must be an unsigned integer");var o=new u(0|t._crypto_pwhash_scryptsalsa208sha256_strbytes()).address;if(s.push(o),0==(0|t._crypto_pwhash_scryptsalsa208sha256_str(o,n,c,0,r,0,a))){var h=t.UTF8ToString(o);return g(s),h}b(s,"invalid usage")}function br(e,r,a){var _=[];l(a),"string"!=typeof e&&f(_,"hashed_password must be a string"),e=s(e+"\0"),null!=c&&e.length-1!==c&&f(_,"invalid hashed_password length");var n=d(e),c=e.length-1;_.push(n);var o=d(r=E(_,r,"password")),h=r.length;_.push(o);var p=0==(0|t._crypto_pwhash_scryptsalsa208sha256_str_verify(n,o,h,0));return g(_),p}function fr(e,r,a,_){var s=[];l(_);var n=d(e=E(s,e,"password")),c=e.length;s.push(n),m(s,r,"opsLimit"),("number"!=typeof r||(0|r)!==r||r<0)&&f(s,"opsLimit must be an unsigned integer"),m(s,a,"memLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&f(s,"memLimit must be an unsigned integer");var o=new u(0|t._crypto_pwhash_strbytes()).address;if(s.push(o),0==(0|t._crypto_pwhash_str(o,n,c,0,r,0,a))){var h=t.UTF8ToString(o);return g(s),h}b(s,"invalid usage")}function mr(e,r,a,_){var n=[];l(_),"string"!=typeof e&&f(n,"hashed_password must be a string"),e=s(e+"\0"),null!=o&&e.length-1!==o&&f(n,"invalid hashed_password length");var c=d(e),o=e.length-1;n.push(c),m(n,r,"opsLimit"),("number"!=typeof r||(0|r)!==r||r<0)&&f(n,"opsLimit must be an unsigned integer"),m(n,a,"memLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&f(n,"memLimit must be an unsigned integer");var h=0!=(0|t._crypto_pwhash_str_needs_rehash(c,r,0,a));return g(n),h}function Er(e,r,a){var _=[];l(a),"string"!=typeof e&&f(_,"hashed_password must be a string"),e=s(e+"\0"),null!=c&&e.length-1!==c&&f(_,"invalid hashed_password length");var n=d(e),c=e.length-1;_.push(n);var o=d(r=E(_,r,"password")),h=r.length;_.push(o);var p=0==(0|t._crypto_pwhash_str_verify(n,o,h,0));return g(_),p}function xr(e,r,a){var _=[];l(a),e=E(_,e,"privateKey");var s,n=0|t._crypto_scalarmult_scalarbytes();e.length!==n&&f(_,"invalid privateKey length"),s=d(e),_.push(s),r=E(_,r,"publicKey");var c,o=0|t._crypto_scalarmult_bytes();r.length!==o&&f(_,"invalid publicKey length"),c=d(r),_.push(c);var h=new u(0|t._crypto_scalarmult_bytes()),p=h.address;if(_.push(p),0==(0|t._crypto_scalarmult(p,s,c))){var i=y(h,a);return g(_),i}b(_,"weak public key")}function kr(e,r){var a=[];l(r),e=E(a,e,"privateKey");var _,s=0|t._crypto_scalarmult_scalarbytes();e.length!==s&&f(a,"invalid privateKey length"),_=d(e),a.push(_);var n=new u(0|t._crypto_scalarmult_bytes()),c=n.address;if(a.push(c),0==(0|t._crypto_scalarmult_base(c,_))){var o=y(n,r);return g(a),o}b(a,"unknown error")}function Sr(e,r,a){var _=[];l(a),e=E(_,e,"n");var s,n=0|t._crypto_scalarmult_ed25519_scalarbytes();e.length!==n&&f(_,"invalid n length"),s=d(e),_.push(s),r=E(_,r,"p");var c,o=0|t._crypto_scalarmult_ed25519_bytes();r.length!==o&&f(_,"invalid p length"),c=d(r),_.push(c);var h=new u(0|t._crypto_scalarmult_ed25519_bytes()),p=h.address;if(_.push(p),0==(0|t._crypto_scalarmult_ed25519(p,s,c))){var i=y(h,a);return g(_),i}b(_,"invalid point or scalar is 0")}function Tr(e,r){var a=[];l(r),e=E(a,e,"scalar");var _,s=0|t._crypto_scalarmult_ed25519_scalarbytes();e.length!==s&&f(a,"invalid scalar length"),_=d(e),a.push(_);var n=new u(0|t._crypto_scalarmult_ed25519_bytes()),c=n.address;if(a.push(c),0==(0|t._crypto_scalarmult_ed25519_base(c,_))){var o=y(n,r);return g(a),o}b(a,"scalar is 0")}function wr(e,r){var a=[];l(r),e=E(a,e,"scalar");var _,s=0|t._crypto_scalarmult_ed25519_scalarbytes();e.length!==s&&f(a,"invalid scalar length"),_=d(e),a.push(_);var n=new u(0|t._crypto_scalarmult_ed25519_bytes()),c=n.address;if(a.push(c),0==(0|t._crypto_scalarmult_ed25519_base_noclamp(c,_))){var o=y(n,r);return g(a),o}b(a,"scalar is 0")}function Yr(e,r,a){var _=[];l(a),e=E(_,e,"n");var s,n=0|t._crypto_scalarmult_ed25519_scalarbytes();e.length!==n&&f(_,"invalid n length"),s=d(e),_.push(s),r=E(_,r,"p");var c,o=0|t._crypto_scalarmult_ed25519_bytes();r.length!==o&&f(_,"invalid p length"),c=d(r),_.push(c);var h=new u(0|t._crypto_scalarmult_ed25519_bytes()),p=h.address;if(_.push(p),0==(0|t._crypto_scalarmult_ed25519_noclamp(p,s,c))){var i=y(h,a);return g(_),i}b(_,"invalid point or scalar is 0")}function Br(e,r,a){var _=[];l(a),e=E(_,e,"scalar");var s,n=0|t._crypto_scalarmult_ristretto255_scalarbytes();e.length!==n&&f(_,"invalid scalar length"),s=d(e),_.push(s),r=E(_,r,"element");var c,o=0|t._crypto_scalarmult_ristretto255_bytes();r.length!==o&&f(_,"invalid element length"),c=d(r),_.push(c);var h=new u(0|t._crypto_scalarmult_ristretto255_bytes()),p=h.address;if(_.push(p),0==(0|t._crypto_scalarmult_ristretto255(p,s,c))){var i=y(h,a);return g(_),i}b(_,"result is identity element")}function Ar(e,r){var a=[];l(r),e=E(a,e,"scalar");var _,s=0|t._crypto_core_ristretto255_scalarbytes();e.length!==s&&f(a,"invalid scalar length"),_=d(e),a.push(_);var n=new u(0|t._crypto_core_ristretto255_bytes()),c=n.address;if(a.push(c),0==(0|t._crypto_scalarmult_ristretto255_base(c,_))){var o=y(n,r);return g(a),o}b(a,"scalar is 0")}function Kr(e,r,a,_){var s=[];l(_);var n=d(e=E(s,e,"message")),c=e.length;s.push(n),r=E(s,r,"nonce");var o,h=0|t._crypto_secretbox_noncebytes();r.length!==h&&f(s,"invalid nonce length"),o=d(r),s.push(o),a=E(s,a,"key");var p,i=0|t._crypto_secretbox_keybytes();a.length!==i&&f(s,"invalid key length"),p=d(a),s.push(p);var v=new u(0|c),m=v.address;s.push(m);var x=new u(0|t._crypto_secretbox_macbytes()),k=x.address;if(s.push(k),0==(0|t._crypto_secretbox_detached(m,k,n,c,0,o,p))){var S=y({mac:x,cipher:v},_);return g(s),S}b(s,"invalid usage")}function Mr(e,r,a,_){var s=[];l(_);var n=d(e=E(s,e,"message")),c=e.length;s.push(n),r=E(s,r,"nonce");var o,h=0|t._crypto_secretbox_noncebytes();r.length!==h&&f(s,"invalid nonce length"),o=d(r),s.push(o),a=E(s,a,"key");var p,i=0|t._crypto_secretbox_keybytes();a.length!==i&&f(s,"invalid key length"),p=d(a),s.push(p);var v=new u(c+t._crypto_secretbox_macbytes()|0),m=v.address;if(s.push(m),0==(0|t._crypto_secretbox_easy(m,n,c,0,o,p))){var x=y(v,_);return g(s),x}b(s,"invalid usage")}function Ir(e){var r=[];l(e);var a=new u(0|t._crypto_secretbox_keybytes()),_=a.address;r.push(_),t._crypto_secretbox_keygen(_);var s=y(a,e);return g(r),s}function Nr(e,r,a,_,s){var n=[];l(s);var c=d(e=E(n,e,"ciphertext")),o=e.length;n.push(c),r=E(n,r,"mac");var h,p=0|t._crypto_secretbox_macbytes();r.length!==p&&f(n,"invalid mac length"),h=d(r),n.push(h),a=E(n,a,"nonce");var i,v=0|t._crypto_secretbox_noncebytes();a.length!==v&&f(n,"invalid nonce length"),i=d(a),n.push(i),_=E(n,_,"key");var m,x=0|t._crypto_secretbox_keybytes();_.length!==x&&f(n,"invalid key length"),m=d(_),n.push(m);var k=new u(0|o),S=k.address;if(n.push(S),0==(0|t._crypto_secretbox_open_detached(S,c,h,o,0,i,m))){var T=y(k,s);return g(n),T}b(n,"wrong secret key for the given ciphertext")}function Lr(e,r,a,_){var s=[];l(_),e=E(s,e,"ciphertext");var n,c=t._crypto_secretbox_macbytes(),o=e.length;o>>0;return g([]),r}function bt(e,r){var a=[];l(r);for(var _=t._malloc(24),s=0;s<6;s++)t.setValue(_+4*s,t.Runtime.addFunction(e[["implementation_name","random","stir","uniform","buf","close"][s]]),"i32");0!=(0|t._randombytes_set_implementation(_))&&b(a,"unsupported implementation"),g(a)}function ft(e){l(e),t._randombytes_stir()}function mt(e,r){var a=[];l(r),m(a,e,"upper_bound"),("number"!=typeof e||(0|e)!==e||e<0)&&f(a,"upper_bound must be an unsigned integer");var _=t._randombytes_uniform(e)>>>0;return g(a),_}function Et(){var e=t._sodium_version_string(),r=t.UTF8ToString(e);return g([]),r}return u.prototype.to_Uint8Array=function(){var e=new Uint8Array(this.length);return e.set(t.HEAPU8.subarray(this.address,this.address+this.length)),e},e.add=function(e,r){if(!(e instanceof Uint8Array&&r instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can added");var t=e.length,a=0,_=0;if(r.length!=e.length)throw new TypeError("Arguments must have the same length");for(_=0;_>=8,a+=e[_]+r[_],e[_]=255&a},e.base64_variants=o,e.compare=function(e,r){if(!(e instanceof Uint8Array&&r instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be compared");if(e.length!==r.length)throw new TypeError("Only instances of identical length can be compared");for(var t=0,a=1,_=e.length;_-- >0;)t|=r[_]-e[_]>>8&a,a&=(r[_]^e[_])-1>>8;return t+t+a-1},e.from_base64=function(e,r){r=h(r);var a,_=[],s=new u(3*(e=E(_,e,"input")).length/4),n=d(e),c=v(4),o=v(4);return _.push(n),_.push(s.address),_.push(s.result_bin_len_p),_.push(s.b64_end_p),0!==t._sodium_base642bin(s.address,s.length,n,e.length,0,c,o,r)&&b(_,"invalid input"),t.getValue(o,"i32")-n!==e.length&&b(_,"incomplete input"),s.length=t.getValue(c,"i32"),a=s.to_Uint8Array(),g(_),a},e.from_hex=function(e){var r,a=[],_=new u((e=E(a,e,"input")).length/2),s=d(e),n=v(4);return a.push(s),a.push(_.address),a.push(_.hex_end_p),0!==t._sodium_hex2bin(_.address,_.length,s,e.length,0,0,n)&&b(a,"invalid input"),t.getValue(n,"i32")-s!==e.length&&b(a,"incomplete input"),r=_.to_Uint8Array(),g(a),r},e.from_string=s,e.increment=function(e){if(!(e instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be incremented");for(var r=256,t=0,a=e.length;t>=8,r+=e[t],e[t]=255&r},e.is_zero=function(e){if(!(e instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be checked");for(var r=0,t=0,a=e.length;t 0");var a,_=[],s=v(4),n=1,c=0,o=0|e.length,h=new u(o+r);_.push(s),_.push(h.address);for(var p=h.address,y=h.address+o+r;p>>48|o>>>32|o>>>16|o))-1>>16);return 0!==t._sodium_pad(s,h.address,e.length,r,h.length)&&b(_,"internal error"),h.length=t.getValue(s,"i32"),a=h.to_Uint8Array(),g(_),a},e.unpad=function(e,r){if(!(e instanceof Uint8Array))throw new TypeError("buffer must be a Uint8Array");if((r|=0)<=0)throw new Error("block size must be > 0");var a=[],_=d(e),s=v(4);return a.push(_),a.push(s),0!==t._sodium_unpad(s,_,e.length,r)&&b(a,"unsupported/invalid padding"),e=(e=new Uint8Array(e)).subarray(0,t.getValue(s,"i32")),g(a),e},e.ready=_,e.symbols=function(){return Object.keys(e).sort()},e.to_base64=p,e.to_hex=c,e.to_string=n,e}var t="object"==typeof e.sodium&&"function"==typeof e.sodium.onload?e.sodium.onload:null; true?!(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports,__webpack_require__(/*! libsodium */ "./node_modules/libsodium/dist/modules/libsodium.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (r), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):0,t&&e.sodium.ready.then((function(){t(e.sodium)}))}(this); + + +/***/ }), + +/***/ "./node_modules/libsodium/dist/modules/libsodium.js": +/*!**********************************************************!*\ + !*** ./node_modules/libsodium/dist/modules/libsodium.js ***! + \**********************************************************/ +/***/ (function(module, exports, __webpack_require__) { + +var __dirname = "/"; +/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!function(A){function I(A){"use strict";var I;void 0===(I=A)&&(I={});var g=I;"object"!=typeof g.sodium&&("object"==typeof __webpack_require__.g?g=__webpack_require__.g:"object"==typeof window&&(g=window));var C=I;return I.ready=new Promise((function(A,I){(i=C).onAbort=I,i.print=function(A){},i.printErr=function(A){},i.onRuntimeInitialized=function(){try{i._crypto_secretbox_keybytes(),A()}catch(A){I(A)}},i.useBackupModule=function(){return new Promise((function(A,I){(i={}).onAbort=I,i.onRuntimeInitialized=function(){Object.keys(C).forEach((function(A){"getRandomValue"!==A&&delete C[A]})),Object.keys(i).forEach((function(A){C[A]=i[A]})),A()};var g,B,Q,i=void 0!==i?i:{},E=Object.assign({},i),o="object"==typeof window,a="function"==typeof importScripts,n= true&&"object"==typeof ({"env":{"NODE_ENV":"production"}}).versions&&"string"==typeof ({"env":{"NODE_ENV":"production"}}).versions.node,r="";if(n){var f=__webpack_require__(/*! fs */ "?f0f8"),t=__webpack_require__(/*! path */ "?ebe9");r=a?t.dirname(r)+"/":__dirname+"/",g=(A,I)=>{var g=T(A);return g?I?g:g.toString():(A=x(A)?new URL(A):t.normalize(A),f.readFileSync(A,I?void 0:"utf8"))},Q=A=>{var I=g(A,!0);return I.buffer||(I=new Uint8Array(I)),I},B=(A,I,g)=>{var C=T(A);C&&I(C),A=x(A)?new URL(A):t.normalize(A),f.readFile(A,(function(A,C){A?g(A):I(C.buffer)}))},({"env":{"NODE_ENV":"production"}}).argv.length>1&&({"env":{"NODE_ENV":"production"}}).argv[1].replace(/\\/g,"/"),({"env":{"NODE_ENV":"production"}}).argv.slice(2), true&&(module.exports=i),i.inspect=function(){return"[Emscripten Module object]"}}else(o||a)&&(a?r=self.location.href:"undefined"!=typeof document&&document.currentScript&&(r=document.currentScript.src),r=0!==r.indexOf("blob:")?r.substr(0,r.replace(/[?#].*/,"").lastIndexOf("/")+1):"",g=A=>{try{var I=new XMLHttpRequest;return I.open("GET",A,!1),I.send(null),I.responseText}catch(I){var g=T(A);if(g)return function(A){for(var I=[],g=0;g255&&(C&=255),I.push(String.fromCharCode(C))}return I.join("")}(g);throw I}},a&&(Q=A=>{try{var I=new XMLHttpRequest;return I.open("GET",A,!1),I.responseType="arraybuffer",I.send(null),new Uint8Array(I.response)}catch(I){var g=T(A);if(g)return g;throw I}}),B=(A,I,g)=>{var C=new XMLHttpRequest;C.open("GET",A,!0),C.responseType="arraybuffer",C.onload=()=>{if(200==C.status||0==C.status&&C.response)I(C.response);else{var B=T(A);B?I(B.buffer):g()}},C.onerror=g,C.send(null)});i.print;var e,c=i.printErr||void 0;Object.assign(i,E),E=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram,i.quit&&i.quit,i.wasmBinary&&(e=i.wasmBinary),i.noExitRuntime;var y,D={Memory:function(A){this.buffer=new ArrayBuffer(65536*A.initial)},Module:function(A){},Instance:function(A,I){this.exports=function(A){for(var I,g=new Uint8Array(123),C=25;C>=0;--C)g[48+C]=52+C,g[65+C]=C,g[97+C]=26+C;function B(A,I,C){for(var B,Q,i=0,E=I,o=C.length,a=I+(3*o>>2)-("="==C[o-2])-("="==C[o-1]);i>4,E>2),E>>0>x>>>0?o+1|0:o)|0,o=(QA=(n=x)>>>0>(x=x+QA|0)>>>0?o+1|0:o)+yA|0,iA=cA=x+eA|0,cA=o=cA>>>0>>0?o+1|0:o,x=nA(x^(a[A+80|0]|a[A+81|0]<<8|a[A+82|0]<<16|a[A+83|0]<<24)^-79577749,QA^(a[A+84|0]|a[A+85|0]<<8|a[A+86|0]<<16|a[A+87|0]<<24)^528734635,32),FA=o=w,o=o+1013904242|0,QA=x,T=o=(x=x-23791573|0)>>>0<4271175723?o+1|0:o,rA=nA(x^aA,o^rA,40),o=(o=cA)+(cA=w)|0,aA=nA(QA^(D=aA=rA+iA|0),FA^(h=D>>>0>>0?o+1|0:o),48),o=T+(L=w)|0,k=o=(aA=x+(s=aA)|0)>>>0>>0?o+1|0:o,aA=o=nA(rA^(u=aA),cA^o,1),T=x=w,cA=a[I+24|0]|a[I+25|0]<<8|a[I+26|0]<<16|a[I+27|0]<<24,FA=o=a[I+28|0]|a[I+29|0]<<8|a[I+30|0]<<16|a[I+31|0]<<24,tA=a[A+8|0]|a[A+9|0]<<8|a[A+10|0]<<16|a[A+11|0]<<24,x=(rA=a[I+16|0]|a[I+17|0]<<8|a[I+18|0]<<16|a[I+19|0]<<24)+(QA=a[A+40|0]|a[A+41|0]<<8|a[A+42|0]<<16|a[A+43|0]<<24)|0,o=(MA=a[I+20|0]|a[I+21|0]<<8|a[I+22|0]<<16|a[I+23|0]<<24)+(UA=a[A+44|0]|a[A+45|0]<<8|a[A+46|0]<<16|a[A+47|0]<<24)|0,o=(a[A+12|0]|a[A+13|0]<<8|a[A+14|0]<<16|a[A+15|0]<<24)+(x>>>0>>0?o+1|0:o)|0,o=FA+(iA=(n=x)>>>0>(x=x+tA|0)>>>0?o+1|0:o)|0,o=(tA=x+cA|0)>>>0>>0?o+1|0:o,n=nA(x^(a[A+72|0]|a[A+73|0]<<8|a[A+74|0]<<16|a[A+75|0]<<24)^725511199,iA^(a[A+76|0]|a[A+77|0]<<8|a[A+78|0]<<16|a[A+79|0]<<24)^-1694144372,32),e=nA(QA^(r=n-2067093701|0),UA^(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[I+61|0]<<8|a[I+62|0]<<16|a[I+63|0]<<24,tA=sA=a[I+56|0]|a[I+57|0]<<8|a[I+58|0]<<16|a[I+59|0]<<24,G=a[A+24|0]|a[A+25|0]<<8|a[A+26|0]<<16|a[A+27|0]<<24,X=(iA=a[I+48|0]|a[I+49|0]<<8|a[I+50|0]<<16|a[I+51|0]<<24)+(z=a[A+56|0]|a[A+57|0]<<8|a[A+58|0]<<16|a[A+59|0]<<24)|0,o=(SA=a[I+52|0]|a[I+53|0]<<8|a[I+54|0]<<16|a[I+55|0]<<24)+(_=a[A+60|0]|a[A+61|0]<<8|a[A+62|0]<<16|a[A+63|0]<<24)|0,o=(a[A+28|0]|a[A+29|0]<<8|a[A+30|0]<<16|a[A+31|0]<<24)+(X>>>0>>0?o+1|0:o)|0,o=C+(T=(M=X)>>>0>(X=G+X|0)>>>0?o+1|0:o)|0,o=(G=X+tA|0)>>>0>>0?o+1|0:o,T=nA(X^(a[A+88|0]|a[A+89|0]<<8|a[A+90|0]<<16|a[A+91|0]<<24)^327033209,T^(a[A+92|0]|a[A+93|0]<<8|a[A+94|0]<<16|a[A+95|0]<<24)^1541459225,32),z=nA(z^(tA=T+1595750129|0),(M=_)^(_=(J=X=w)-((T>>>0<2699217167)+1521486533|0)|0),40),o=(IA=w)+o|0,X=nA((G=X=z+G|0)^T,J^(M=G>>>0>>0?o+1|0:o),48),o=_+($=w)|0,N=o=(X=tA+(_=X)|0)>>>0>>0?o+1|0:o,o=O+o|0,V=p^(T=v+(J=X)|0),p=o=T>>>0>>0?o+1|0:o,tA=nA(V,o^uA,40),o=(uA=w)+y|0,X=nA(P=v^(y=X=tA+P|0),O^(v=y>>>0>>0?o+1|0:o),48),o=p+(CA=w)|0,O=o=(p=T+(P=X)|0)>>>0>>0?o+1|0:o,X=(d=nA(p^tA,uA^o,1))+(T=a[I+72|0]|a[I+73|0]<<8|a[I+74|0]<<16|a[I+75|0]<<24)|0,o=(wA=w)+(uA=a[I+76|0]|a[I+77|0]<<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=0,II=0,gI=0,CI=0,BI=0,QI=0,iI=0;return D=f=D-560|0,EA(f+352|0),i&&m(f+352|0,34768,34,0),QA(f+288|0,Q,32,0),m(wA=f+352|0,f+320|0,32,0),m(wA,g,C,B),M(wA,sA=f+224|0),pA=a[(tA=Q)+32|0]|a[tA+33|0]<<8|a[tA+34|0]<<16|a[tA+35|0]<<24,FA=a[tA+36|0]|a[tA+37|0]<<8|a[tA+38|0]<<16|a[tA+39|0]<<24,cA=a[tA+40|0]|a[tA+41|0]<<8|a[tA+42|0]<<16|a[tA+43|0]<<24,fA=a[tA+44|0]|a[tA+45|0]<<8|a[tA+46|0]<<16|a[tA+47|0]<<24,eA=a[tA+48|0]|a[tA+49|0]<<8|a[tA+50|0]<<16|a[tA+51|0]<<24,Q=a[tA+52|0]|a[tA+53|0]<<8|a[tA+54|0]<<16|a[tA+55|0]<<24,yA=a[tA+60|0]|a[tA+61|0]<<8|a[tA+62|0]<<16|a[tA+63|0]<<24,tA=a[tA+56|0]|a[tA+57|0]<<8|a[tA+58|0]<<16|a[tA+59|0]<<24,E[A+56|0]=tA,E[A+57|0]=tA>>>8,E[A+58|0]=tA>>>16,E[A+59|0]=tA>>>24,E[A+60|0]=yA,E[A+61|0]=yA>>>8,E[A+62|0]=yA>>>16,E[A+63|0]=yA>>>24,E[A+48|0]=eA,E[A+49|0]=eA>>>8,E[A+50|0]=eA>>>16,E[A+51|0]=eA>>>24,E[A+52|0]=Q,E[A+53|0]=Q>>>8,E[A+54|0]=Q>>>16,E[A+55|0]=Q>>>24,E[A+40|0]=cA,E[A+41|0]=cA>>>8,E[A+42|0]=cA>>>16,E[A+43|0]=cA>>>24,E[A+44|0]=fA,E[A+45|0]=fA>>>8,E[A+46|0]=fA>>>16,E[A+47|0]=fA>>>24,E[0|(Q=A+32|0)]=pA,E[Q+1|0]=pA>>>8,E[Q+2|0]=pA>>>16,E[Q+3|0]=pA>>>24,E[Q+4|0]=FA,E[Q+5|0]=FA>>>8,E[Q+6|0]=FA>>>16,E[Q+7|0]=FA>>>24,u(sA),v(f,sA),uA(A,f),EA(wA),i&&m(f+352|0,34768,34,0),m(i=f+352|0,A,64,0),m(i,g,C,B),M(i,hA=f+160|0),u(hA),E[f+288|0]=248&a[f+288|0],E[f+319|0]=63&a[f+319|0]|64,g=a[23+(A=r=f+288|0)|0],cA=DA(t=a[A+21|0]|a[A+22|0]<<8|g<<16&2031616,0,e=(a[hA+28|0]|a[hA+29|0]<<8|a[hA+30|0]<<16|a[hA+31|0]<<24)>>>7|0,0),eA=w,g=(A=a[hA+27|0])>>>24|0,B=A<<8|(fA=a[hA+23|0]|a[hA+24|0]<<8|a[hA+25|0]<<16|a[hA+26|0]<<24)>>>24,A=DA(c=2097151&((3&(FA=(A=(C=a[hA+28|0])>>>16|0)|g))<<30|(g=(C<<=16)|B)>>>2),0,y=(i=a[r+23|0]|a[r+24|0]<<8|a[r+25|0]<<16|a[r+26|0]<<24)>>>5&2097151,0),g=w+eA|0,C=A>>>0>(B=A+cA|0)>>>0?g+1|0:g,A=DA(h=(g=a[hA+23|0])<<16&2031616|a[hA+21|0]|a[hA+22|0]<<8,0,s=(a[r+28|0]|a[r+29|0]<<8|a[r+30|0]<<16|a[r+31|0]<<24)>>>7|0,0),C=w+C|0,eA=g=A+B|0,B=A>>>0>g>>>0?C+1|0:C,C=(A=a[r+27|0])>>>24|0,i=A<<8|i>>>24,A=DA(p=2097151&((3&(C|=g=(A=a[r+28|0])>>>16|0))<<30|(g=(A<<=16)|i)>>>2),0,k=fA>>>5&2097151,0),g=w+B|0,tA=C=A+eA|0,B=A>>>0>C>>>0?g+1|0:g,fA=DA(y,0,k,0),eA=w,g=(A=a[r+19|0])>>>24|0,i=A<<8|(UA=a[r+15|0]|a[r+16|0]<<8|a[r+17|0]<<16|a[r+18|0]<<24)>>>24,C=g,g=DA(F=(7&(C|=g=(A=a[r+20|0])>>>16|0))<<29|(g=(A<<=16)|i)>>>3,FA=C>>>3|0,e,0),A=w+eA|0,A=g>>>0>(C=g+fA|0)>>>0?A+1|0:A,i=(g=DA(t,0,c,0))+C|0,C=w+A|0,g=g>>>0>(fA=i)>>>0?C+1|0:C,C=(A=a[hA+19|0])>>>24|0,eA=A<<8|(GA=a[hA+15|0]|a[hA+16|0]<<8|a[hA+17|0]<<16|a[hA+18|0]<<24)>>>24,A=DA(l=(7&(cA=(A=(i=a[hA+20|0])>>>16|0)|C))<<29|(C=(i<<=16)|eA)>>>3,S=cA>>>3|0,s,0),g=w+g|0,g=A>>>0>(C=A+fA|0)>>>0?g+1|0:g,A=DA(h,0,p,0),g=w+g|0,pA=g=A>>>0>(sA=A+C|0)>>>0?g+1|0:g,lA=A=g-((sA>>>0<4293918720)-1|0)|0,C=(g=A>>>21|0)+B|0,fA=C=(A=(2097151&A)<<11|(cA=sA- -1048576|0)>>>21)>>>0>(tA=A+tA|0)>>>0?C+1|0:C,HA=A=C-((tA>>>0<4293918720)-1|0)|0,wA=(2097151&A)<<11|(eA=tA- -1048576|0)>>>21,i=A>>>21|0,A=DA(s,0,k,0),g=w,C=A,A=DA(e,0,y,0),g=w+g|0,g=A>>>0>(C=C+A|0)>>>0?g+1|0:g,SA=(A=C)+(C=DA(c,0,p,0))|0,A=w+g|0,A=C>>>0>SA>>>0?A+1|0:A,yA=SA-(g=-2097152&(C=SA- -1048576|0))|0,g=(A-((131071&(B=A-((SA>>>0<4293918720)-1|0)|0))+(g>>>0>SA>>>0)|0)|0)+i|0,j=g=(A=yA+wA|0)>>>0>>0?g+1|0:g,X=A,yA=DA(A,g,470296,0),wA=w,g=DA(e,0,p,0),A=w,i=g,g=DA(c,0,s,0),A=w+A|0,g=g>>>0>(i=i+g|0)>>>0?A+1|0:A,A=B>>>21|0,B=(2097151&B)<<11|C>>>21,C=A+g|0,_A=B=(C=B>>>0>(i=B+i|0)>>>0?C+1|0:C)-((i>>>0<4293918720)-1|0)|0,A=i-(g=-2097152&(bA=i- -1048576|0))|0,q=i=C-((131071&B)+(g>>>0>i>>>0)|0)|0,z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)>>>1),0,s,0),A=w+B|0,A=g>>>0>(C=g+cA|0)>>>0?A+1|0:A,g=DA(p,0,G,0),A=w+A|0,fA=A=g>>>0>(cA=g+C|0)>>>0?A+1|0:A,KA=g=A-((cA>>>0<4293918720)-1|0)|0,C=(A=g>>>21|0)+i|0,wA=C=(g=(2097151&g)<<11|(yA=cA- -1048576|0)>>>21)>>>0>(HA=g+sA|0)>>>0?C+1|0:C,NA=g=C-((HA>>>0<4293918720)-1|0)|0,A=(A=g>>>21|0)+lA|0,T=A=(g=(C=(2097151&g)<<11|(sA=HA- -1048576|0)>>>21)+SA|0)>>>0>>0?A+1|0:A,W=g,A=DA(g,A,-997805,-1),g=w+eA|0,kA=C=A+kA|0,eA=A>>>0>C>>>0?g+1|0:g,SA=(mA=a[23+(n=f+224|0)|0]|a[n+24|0]<<8|a[n+25|0]<<16|a[n+26|0]<<24)>>>5&2097151,C=DA(N=(A=a[r+2|0])<<16&2031616|a[0|r]|a[r+1|0]<<8,0,k,0),g=w,B=(A=DA(h,0,Y=(i=a[r+2|0]|a[r+3|0]<<8|a[r+4|0]<<16|a[r+5|0]<<24)>>>5&2097151,0))+C|0,C=w+g|0,C=A>>>0>B>>>0?C+1|0:C,A=DA(b=(a[r+7|0]|a[r+8|0]<<8|a[r+9|0]<<16|a[r+10|0]<<24)>>>7&2097151,0,G,0),g=w+C|0,g=A>>>0>(B=A+B|0)>>>0?g+1|0:g,C=DA(J,0,_=pA>>>4&2097151,0),A=w+g|0,pA=B=C+B|0,B=C>>>0>B>>>0?A+1|0:A,i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>>24|0,lA=A<<8|(kA=a[n+15|0]|a[n+16|0]<<8|a[n+17|0]<<16|a[n+18|0]<<24)>>>24,C=((vA=(A=(B=a[n+20|0])>>>16|0)|g)>>>3|0)+C|0,SA=B=(g=(7&vA)<<29|(g=(B<<=16)|lA)>>>3)+SA|0,B=g>>>0>B>>>0?C+1|0:C,lA=kA>>>6&2097151,A=DA(G,0,N,0),g=w,C=A,A=DA(J,0,Y,0),g=w+g|0,g=A>>>0>(C=C+A|0)>>>0?g+1|0:g,kA=(A=C)+(C=DA(b,0,P,0))|0,A=w+g|0,A=C>>>0>kA>>>0?A+1|0:A,C=DA(_,0,d,0),g=w+A|0,g=C>>>0>(kA=C+kA|0)>>>0?g+1|0:g,C=DA(K,0,YA,0),A=w+g|0,A=C>>>0>(kA=C+kA|0)>>>0?A+1|0:A,g=DA(H,0,L,0),C=w+A|0,C=g>>>0>(kA=g+kA|0)>>>0?C+1|0:C,A=DA(U,0,R,0),g=w+C|0,A=A>>>0>(kA=A+kA|0)>>>0?g+1|0:g,VA=A=(LA=kA+lA|0)>>>0>>0?A+1|0:A,gI=A=A-((LA>>>0<4293918720)-1|0)|0,C=(2097151&A)<<11|(qA=LA- -1048576|0)>>>21,A=(A>>>21|0)+B|0,TA=A=C>>>0>(OA=C+SA|0)>>>0?A+1|0:A,CI=A=A-((OA>>>0<4293918720)-1|0)|0,C=(2097151&A)<<11|(xA=OA- -1048576|0)>>>21,A=(A>>>21|0)+i|0,g=(C>>>0>(B=C+GA|0)>>>0?A+1|0:A)+eA|0,eA=(C=B+pA|0)-(A=-2097152&tA)|0,hA=A=(g=C>>>0>>0?g+1|0:g)-((A>>>0>C>>>0)+hA|0)|0,BI=A=A-((eA>>>0<4293918720)-1|0)|0,C=(2097151&A)<<11|(jA=eA- -1048576|0)>>>21,A=(A>>21)+PA|0,B=A=C>>>0>(i=C+JA|0)>>>0?A+1|0:A,II=A=A-((i>>>0<4293918720)-1|0)|0,XA=(2097151&A)<<11|(GA=i- -1048576|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=C>>>0>fA>>>0?g+1|0:g,g=(A=a[n+27|0])>>>24|0,cA=A<<8|mA>>>24,fA=2097151&((3&(g|=A=(fA=a[n+28|0])>>>16|0))<<30|(A=(fA<<=16)|cA)>>>2),g=C,cA=A=fA+NA|0,fA=A>>>0>>0?g+1|0:g,vA=DA(O,q,470296,0),NA=w,A=(C=(2097151&_A)<<11|bA>>>21)+(JA-(g=-2097152&kA)|0)|0,g=zA-((524287&RA)+(g>>>0>JA>>>0)|0)+(_A>>>21)|0,IA=g=A>>>0>>0?g+1|0:g,gA=A,g=DA(A,g,666643,0),A=w+NA|0,A=g>>>0>(C=g+vA|0)>>>0?A+1|0:A,kA=(g=DA(X,j,654183,0))+C|0,C=w+A|0,C=g>>>0>kA>>>0?C+1|0:C,g=DA(z,V,-997805,-1),A=w+C|0,A=g>>>0>(kA=g+kA|0)>>>0?A+1|0:A,C=DA(W,T,136657,0),g=w+A|0,UA=(A=(2097151&MA)<<11|UA>>>21)+(kA=C+kA|0)|0,g=(MA>>>21|0)+(C>>>0>kA>>>0?g+1|0:g)|0,RA=kA=fA-((cA>>>0<4293918720)-1|0)|0,A=(A>>>0>UA>>>0?g+1|0:g)+fA|0,g=(fA=cA+UA|0)-(C=-2097152&(zA=cA- -1048576|0))|0,C=(A=(A=fA>>>0>>0?A+1|0:A)-((C>>>0>fA>>>0)+kA|0)|0)+pA|0,vA=fA=A-((g>>>0<4293918720)-1|0)|0,JA=(C=(cA=g+XA|0)>>>0>>0?C+1|0:C)-(((g=-2097152&(NA=g- -1048576|0))>>>0>cA>>>0)+fA|0)|0,mA=A=cA-g|0,fA=i,i=B,AI=PA-(A=-2097152&tA)|0,kA=sA-((A>>>0>PA>>>0)+WA|0)|0,A=DA(gA,IA,-683901,-1),g=w,B=(C=A)+(A=DA(x,Z,136657,0))|0,C=w+g|0,g=yA+(A>>>0>B>>>0?C+1|0:C)|0,wA=(C=B+KA|0)-(A=-2097152&wA)|0,sA=(g=C>>>0>>0?g+1|0:g)-((A>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|0,g=C>>>0>(yA=C+yA|0)>>>0?g+1|0:g,C=DA(y,0,P,0),A=w+g|0,A=C>>>0>(yA=C+yA|0)>>>0?A+1|0:A,g=DA(t,0,YA,0),C=w+A|0,C=g>>>0>(yA=g+yA|0)>>>0?C+1|0:C,yA=(A=DA(s,0,R,0))+yA|0,g=w+C|0,C=DA(p,0,d,0),A=w+(A>>>0>yA>>>0?g+1|0:g)|0,PA=A=C>>>0>(WA=C+yA|0)>>>0?A+1|0:A,BA=A=A-((WA>>>0<4293918720)-1|0)|0,C=(2097151&A)<<11|(_A=WA- -1048576|0)>>>21,A=(A>>>21|0)+B|0,bA=A=C>>>0>(XA=C+cA|0)>>>0?A+1|0:A,iA=A=A-((XA>>>0<4293918720)-1|0)|0,C=(2097151&A)<<11|(MA=XA- -1048576|0)>>>21,A=(A>>>21|0)+pA|0,UA=A=C>>>0>(KA=C+tA|0)>>>0?A+1|0:A,oA=A=A-((KA>>>0<4293918720)-1|0)|0,C=(2097151&A)<<11|(lA=KA- -1048576|0)>>>21,A=(A>>21)+sA|0,B=A=C>>>0>(tA=C+wA|0)>>>0?A+1|0:A,sA=A=A-((tA>>>0<4293918720)-1|0)|0,pA=(2097151&A)<<11|(C=tA- -1048576|0)>>>21,A=(A>>21)+kA|0,ZA=A=(cA=pA+AI|0)>>>0>>0?A+1|0:A,dA=cA,A=DA(cA,A,-683901,-1),g=w,cA=A,A=DA(AA,$,136657,0),g=w+g|0,A=(A>>>0>(cA=cA+A|0)>>>0?g+1|0:g)+i|0,QI=(i=fA+cA|0)-(g=-2097152&GA)|0,iI=(A=i>>>0>>0?A+1|0:A)-((g>>>0>i>>>0)+II|0)|0,pA=eA,cA=hA,eA=DA(dA,ZA,136657,0),i=w,AI=A=tA-(g=-2097152&C)|0,CA=B=B-((g>>>0>tA>>>0)+sA|0)|0,C=DA(AA,$,-997805,-1),g=w+i|0,g=C>>>0>(eA=C+eA|0)>>>0?g+1|0:g,C=DA(A,B,-683901,-1),A=w+g|0,II=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|0)+B|0,HA=g=(A=(2097151&A)<<11|(GA=qA- -1048576|0)>>>21)>>>0>(TA=A+tA|0)>>>0?g+1|0:g,nA=A=g-((TA>>>0<4293918720)-1|0)|0,g=(2097151&A)<<11|(yA=TA- -1048576|0)>>>21,A=(A>>>21|0)+SA|0,sA=A=g>>>0>(wA=g+wA|0)>>>0?A+1|0:A,rA=A=A-((wA>>>0<4293918720)-1|0)|0,g=(C=A>>21)+i|0,gI=g=(g=(A=(2097151&A)<<11|(tA=wA- -1048576|0)>>>21)>>>0>(B=A+kA|0)>>>0?g+1|0:g)-(((C=-2097152&xA)>>>0>B>>>0)+CI|0)|0,xA=A=B-C|0,eA=A- -1048576|0,CI=A=g-((A>>>0<4293918720)-1|0)|0,C=(g=A>>21)+fA|0,g=((A=(2097151&A)<<11|eA>>>21)>>>0>(B=A+II|0)>>>0?C+1|0:C)+cA|0,LA=g=(g=(A=B)>>>0>(B=B+pA|0)>>>0?g+1|0:g)-(((C=-2097152&jA)>>>0>B>>>0)+BI|0)|0,cA=A=B-C|0,i=A- -1048576|0,VA=A=g-((A>>>0<4293918720)-1|0)|0,C=(g=A>>21)+iI|0,jA=A=(C=(A=(2097151&A)<<11|i>>>21)>>>0>(fA=A+QI|0)>>>0?C+1|0:C)-((fA>>>0<4293918720)-1|0)|0,kA=mA- -1048576|0,SA=JA-((mA>>>0<4293918720)-1|0)|0,pA=(2097151&A)<<11|(B=fA- -1048576|0)>>>21,A=(A>>21)+JA|0,BI=(mA=pA+mA|0)-(g=-2097152&kA)|0,QI=(pA>>>0>mA>>>0?A+1|0:A)-((g>>>0>mA>>>0)+SA|0)|0,iI=fA-(A=-2097152&B)|0,II=C-((A>>>0>fA>>>0)+jA|0)|0,OA=cA-(A=-2097152&i)|0,mA=LA-((A>>>0>cA>>>0)+VA|0)|0,A=DA(dA,ZA,-997805,-1),g=w,C=A,A=DA(AA,$,654183,0),g=w+g|0,g=A>>>0>(C=C+A|0)>>>0?g+1|0:g,B=(A=C)+(C=D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0>(tA=g+(wA-C|0)|0)>>>0?A+1|0:A,C=DA(AI,CA,-997805,-1),g=w+A|0,g=C>>>0>(tA=C+tA|0)>>>0?g+1|0:g,PA=C=lA-(A=-2097152&i)|0,YA=eA=eA-((A>>>0>lA>>>0)+_A|0)|0,tA=(i=DA(JA,RA,136657,0))+tA|0,A=w+g|0,C=DA(C,eA,-683901,-1),g=w+(i>>>0>tA>>>0?A+1|0:A)|0,eA=g=C>>>0>(sA=C+tA|0)>>>0?g+1|0:g,_A=A=g-((sA>>>0<4293918720)-1|0)|0,g=(2097151&A)<<11|(i=sA- -1048576|0)>>>21,A=(A>>21)+B|0,lA=g=(A=g>>>0>(tA=g+UA|0)>>>0?A+1|0:A)-((tA>>>0<4293918720)-1|0)|0,wA=(2097151&g)<<11|(B=tA- -1048576|0)>>>21,g=(g>>21)+mA|0,OA=UA=wA+OA|0,UA=wA>>>0>UA>>>0?g+1|0:g,mA=tA-(g=-2097152&B)|0,WA=A-((g>>>0>tA>>>0)+lA|0)|0,LA=sA-(A=-2097152&i)|0,VA=eA-((A>>>0>sA>>>0)+_A|0)|0,A=DA(AA,$,666643,0),C=HA+w|0,C=(i=A+TA|0)>>>0>>0?C+1|0:C,B=(A=DA(dA,ZA,470296,0))+(i-(g=-2097152&yA)|0)|0,g=w+(C-((g>>>0>i>>>0)+nA|0)|0)|0,g=A>>>0>B>>>0?g+1|0:g,C=DA(AI,CA,654183,0),A=w+g|0,tA=B=C+B|0,B=C>>>0>B>>>0?A+1|0:A,i=MA-(A=-2097152&fA)|0,eA=cA-((A>>>0>MA>>>0)+zA|0)|0,A=DA(gA,IA,470296,0),g=w,C=A,A=DA(x,Z,666643,0),g=w+g|0,g=A>>>0>(C=C+A|0)>>>0?g+1|0:g,A=DA(O,q,654183,0),g=w+g|0,g=A>>>0>(C=A+C|0)>>>0?g+1|0:g,fA=(A=C)+(C=DA(X,j,-997805,-1))|0,A=w+g|0,A=C>>>0>fA>>>0?A+1|0:A,g=DA(z,V,136657,0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]<<8|a[n+4|0]<<16|a[n+5|0]<<24)>>>24,C=A,g=(A=a[n+7|0])>>>16|0,g|=C,C=B,i=C=(A=2097151&((3&g)<<30|(A=A<<16|i)>>>2))>>>0>(eA=A+eA|0)>>>0?C+1|0:C,XA=A=C-((eA>>>0<4293918720)-1|0)|0,C=(2097151&A)<<11|(HA=eA- -1048576|0)>>>21,A=(A>>>21|0)+fA|0,wA=A=C>>>0>(hA=C+FA|0)>>>0?A+1|0:A,zA=A=A-((hA>>>0<4293918720)-1|0)|0,C=(g=A>>>21|0)+pA|0,C=(A=(2097151&A)<<11|(sA=hA- -1048576|0)>>>21)>>>0>(B=A+tA|0)>>>0?C+1|0:C,g=DA(dA,ZA,666643,0),A=w+C|0,A=g>>>0>(B=g+B|0)>>>0?A+1|0:A,g=DA(AI,CA,470296,0),A=w+A|0,A=g>>>0>(C=g+B|0)>>>0?A+1|0:A,B=(g=C)+(C=DA(bA,_A,136657,0))|0,g=w+A|0,g=C>>>0>B>>>0?g+1|0:g,A=DA(JA,RA,654183,0),g=w+g|0,g=A>>>0>(C=A+B|0)>>>0?g+1|0:g,tA=(A=DA(PA,YA,-997805,-1))+C|0,C=w+g|0,pA=C=A>>>0>tA>>>0?C+1|0:C,vA=A=C-((tA>>>0<4293918720)-1|0)|0,C=(2097151&A)<<11|(FA=tA- -1048576|0)>>>21,A=(A>>21)+cA|0,NA=C=(A=C>>>0>(B=C+NA|0)>>>0?A+1|0:A)-((B>>>0<4293918720)-1|0)|0,fA=(2097151&C)<<11|(cA=B- -1048576|0)>>>21,C=(C>>21)+VA|0,KA=GA=fA+LA|0,GA=fA>>>0>GA>>>0?C+1|0:C,fA=B,g=A,B=(MA-(A=-2097152&yA)|0)+(yA=(2097151&SA)<<11|kA>>>21)|0,A=(lA-((A>>>0>MA>>>0)+xA|0)|0)+(SA>>21)|0,kA=A=B>>>0>>0?A+1|0:A,LA=A=A-((B>>>0<4293918720)-1|0)|0,MA=C=A>>21,A=DA(dA=(2097151&A)<<11|(SA=B- -1048576|0)>>>21,C,-683901,-1),g=w+g|0,g=A>>>0>(C=A+fA|0)>>>0?g+1|0:g,VA=C-(A=-2097152&cA)|0,qA=g-((A>>>0>C>>>0)+NA|0)|0,g=DA(dA,MA,136657,0),A=w+pA|0,A=g>>>0>(C=g+tA|0)>>>0?A+1|0:A,TA=C-(g=-2097152&FA)|0,vA=A-((g>>>0>C>>>0)+vA|0)|0,g=DA(AI,CA,666643,0),A=w+(wA-(((C=-2097152&sA)>>>0>hA>>>0)+zA|0)|0)|0,A=g>>>0>(fA=g+(hA-C|0)|0)>>>0?A+1|0:A,C=DA(bA,_A,-997805,-1),g=w+A|0,g=C>>>0>(fA=C+fA|0)>>>0?g+1|0:g,A=DA(JA,RA,470296,0),C=w+g|0,C=A>>>0>(fA=A+fA|0)>>>0?C+1|0:C,g=DA(PA,YA,654183,0),A=w+C|0,NA=fA=g+fA|0,pA=g>>>0>fA>>>0?A+1|0:A,C=jA>>>5&2097151,A=DA(N,0,R,0),g=w,cA=A,A=DA(Y,0,L,0),g=w+g|0,A=A>>>0>(fA=cA+A|0)>>>0?g+1|0:g,cA=g=C+fA|0,C=A=g>>>0>>0?A+1|0:A,hA=(g=DA(N,0,L,0))+(A=(A=a[n+2|0])<<16&2031616|a[0|n]|a[n+1|0]<<8)|0,g=w,yA=g=A>>>0>hA>>>0?g+1|0:g,xA=g=g-((hA>>>0<4293918720)-1|0)|0,A=(A=g>>>21|0)+C|0,sA=A=(g=(2097151&g)<<11|(wA=hA- -1048576|0)>>>21)>>>0>(lA=g+cA|0)>>>0?A+1|0:A,jA=g=A-((lA>>>0<4293918720)-1|0)|0,C=(2097151&g)<<11|(tA=lA- -1048576|0)>>>21,g=(g>>>21|0)+i|0,g=C>>>0>(fA=C+eA|0)>>>0?g+1|0:g,C=DA(bA,_A,654183,0),A=w+(g-(((i=-2097152&HA)>>>0>fA>>>0)+XA|0)|0)|0,A=C>>>0>(eA=C+(fA-i|0)|0)>>>0?A+1|0:A,g=DA(JA,RA,666643,0),A=w+A|0,A=g>>>0>(C=g+eA|0)>>>0?A+1|0:A,FA=(g=C)+(C=DA(PA,YA,470296,0))|0,g=w+A|0,cA=g=C>>>0>FA>>>0?g+1|0:g,zA=g=g-((FA>>>0<4293918720)-1|0)|0,C=(A=g>>21)+pA|0,HA=g=(C=(g=(2097151&g)<<11|(fA=FA- -1048576|0)>>>21)>>>0>(eA=g+NA|0)>>>0?C+1|0:C)-((eA>>>0<4293918720)-1|0)|0,pA=(2097151&g)<<11|(i=eA- -1048576|0)>>>21,g=(g>>21)+vA|0,RA=JA=pA+TA|0,pA=pA>>>0>JA>>>0?g+1|0:g,A=DA(dA,MA,-997805,-1),g=w+C|0,g=A>>>0>(eA=A+eA|0)>>>0?g+1|0:g,vA=eA-(A=-2097152&i)|0,NA=g-((A>>>0>eA>>>0)+HA|0)|0,g=DA(dA,MA,654183,0),A=w+cA|0,A=g>>>0>(C=g+FA|0)>>>0?A+1|0:A,JA=C-(g=-2097152&fA)|0,HA=A-((g>>>0>C>>>0)+zA|0)|0,A=DA(bA,_A,470296,0),C=w+(sA-(((g=-2097152&tA)>>>0>lA>>>0)+jA|0)|0)|0,C=A>>>0>(i=A+(lA-g|0)|0)>>>0?C+1|0:C,g=DA(PA,YA,666643,0),A=w+C|0,eA=i=g+i|0,C=g>>>0>i>>>0?A+1|0:A,g=DA(bA,_A,666643,0),A=w+(yA-((4095&xA)+((i=-2097152&wA)>>>0>hA>>>0)|0)|0)|0,FA=A=g>>>0>(tA=g+(hA-i|0)|0)>>>0?A+1|0:A,yA=A=A-((tA>>>0<4293918720)-1|0)|0,i=(2097151&A)<<11|(cA=tA- -1048576|0)>>>21,A=(A>>21)+C|0,C=A=i>>>0>(fA=i+eA|0)>>>0?A+1|0:A,wA=A=A-((fA>>>0<4293918720)-1|0)|0,i=(2097151&A)<<11|(eA=fA- -1048576|0)>>>21,A=(A>>21)+HA|0,i=i>>>0>(sA=i+JA|0)>>>0?A+1|0:A,A=DA(dA,MA,470296,0),C=w+C|0,C=A>>>0>(g=A+fA|0)>>>0?C+1|0:C,fA=g-(A=-2097152&eA)|0,eA=C-((A>>>0>g>>>0)+wA|0)|0,g=DA(dA,MA,666643,0),A=w+(FA-(((C=-2097152&cA)>>>0>tA>>>0)+yA|0)|0)|0,g=(C=(A=g>>>0>(lA=g+(tA-C|0)|0)>>>0?A+1|0:A)>>21)+eA|0,A=(A=(g=(A=(2097151&A)<<11|lA>>>21)>>>0>(HA=A+fA|0)>>>0?g+1|0:g)>>21)+i|0,g=(g=(A=(g=(2097151&g)<<11|HA>>>21)>>>0>(yA=g+sA|0)>>>0?A+1|0:A)>>21)+NA|0,C=(A=(g=(A=(2097151&A)<<11|yA>>>21)>>>0>(i=A+vA|0)>>>0?g+1|0:g)>>21)+pA|0,A=(g=(C=(g=(2097151&g)<<11|i>>>21)>>>0>(wA=g+RA|0)>>>0?C+1|0:C)>>21)+qA|0,g=(C=(A=(C=(2097151&C)<<11|wA>>>21)>>>0>(sA=C+VA|0)>>>0?A+1|0:A)>>21)+GA|0,A=(A=(g=(A=(2097151&A)<<11|sA>>>21)>>>0>(tA=A+KA|0)>>>0?g+1|0:g)>>21)+WA|0,g=(g=(A=(g=(2097151&g)<<11|tA>>>21)>>>0>(pA=g+mA|0)>>>0?A+1|0:A)>>21)+UA|0,C=(A=(g=(A=(2097151&A)<<11|pA>>>21)>>>0>(FA=A+OA|0)>>>0?g+1|0:g)>>21)+II|0,A=(g=(C=(g=(2097151&g)<<11|FA>>>21)>>>0>(cA=g+iI|0)>>>0?C+1|0:C)>>21)+QI|0,eA=(SA=B-(g=-2097152&SA)|0)+((2097151&(A=(C=(2097151&C)<<11|cA>>>21)>>>0>(fA=C+BI|0)>>>0?A+1|0:A))<<11|fA>>>21)|0,A=(kA-((g>>>0>B>>>0)+LA|0)|0)+(A>>21)|0,SA=g=(A=eA>>>0>>0?A+1|0:A)>>21,lA=(A=DA(GA=(2097151&A)<<11|eA>>>21,g,666643,0))+(g=2097151&lA)|0,A=w,B=A=g>>>0>lA>>>0?A+1|0:A,E[0|Q]=lA,E[Q+1|0]=(255&A)<<24|lA>>>8,A=2097151&HA,g=DA(GA,SA,470296,0)+A|0,C=w,A=(B>>21)+(A>>>0>g>>>0?C+1|0:C)|0,A=(kA=(2097151&B)<<11|lA>>>21)>>>0>(HA=kA+g|0)>>>0?A+1|0:A,E[Q+4|0]=(2047&A)<<21|HA>>>11,g=A,C=HA,E[Q+3|0]=(7&A)<<29|C>>>3,E[Q+2|0]=31&((65535&B)<<16|lA>>>16)|C<<5,B=2097151&yA,yA=DA(GA,SA,654183,0)+B|0,A=w,HA=(2097151&g)<<11|C>>>21,g=(g>>21)+(B=B>>>0>yA>>>0?A+1|0:A)|0,A=g=(yA=HA+yA|0)>>>0>>0?g+1|0:g,E[Q+6|0]=(63&A)<<26|yA>>>6,B=yA,yA=0,E[Q+5|0]=yA<<13|(1572864&C)>>>19|B<<2,C=2097151&i,i=DA(GA,SA,-997805,-1)+C|0,g=w,g=C>>>0>i>>>0?g+1|0:g,yA=(2097151&(C=A))<<11|B>>>21,C=(A>>=21)+g|0,C=(i=yA+i|0)>>>0>>0?C+1|0:C,E[Q+9|0]=(511&C)<<23|i>>>9,E[Q+8|0]=(1&C)<<31|i>>>1,g=0,E[Q+7|0]=g<<18|(2080768&B)>>>14|i<<7,g=2097151&wA,B=DA(GA,SA,136657,0)+g|0,A=w,A=g>>>0>B>>>0?A+1|0:A,wA=(2097151&(g=C))<<11|i>>>21,g=A+(C=g>>21)|0,g=(B=wA+B|0)>>>0>>0?g+1|0:g,E[Q+12|0]=(4095&g)<<20|B>>>12,C=B,E[Q+11|0]=(15&g)<<28|C>>>4,B=0,E[Q+10|0]=B<<15|(1966080&i)>>>17|C<<4,B=2097151&sA,i=DA(GA,SA,-683901,-1)+B|0,A=w,A=B>>>0>i>>>0?A+1|0:A,B=g,g=A+(g>>=21)|0,g=(B=(sA=i)+(i=(2097151&B)<<11|C>>>21)|0)>>>0>>0?g+1|0:g,E[Q+14|0]=(127&g)<<25|B>>>7,i=0,E[Q+13|0]=i<<12|(1048576&C)>>>20|B<<1,A=g>>21,C=(g=(2097151&g)<<11|B>>>21)>>>0>(i=g+(2097151&tA)|0)>>>0?A+1|0:A,E[Q+17|0]=(1023&C)<<22|i>>>10,E[Q+16|0]=(3&C)<<30|i>>>2,g=0,E[Q+15|0]=g<<17|(2064384&B)>>>15|i<<6,A=C>>21,A=(g=(2097151&C)<<11|i>>>21)>>>0>(C=g+(2097151&pA)|0)>>>0?A+1|0:A,E[Q+20|0]=(8191&A)<<19|C>>>13,E[Q+19|0]=(31&A)<<27|C>>>5,B=(g=2097151&FA)+(FA=(2097151&A)<<11|C>>>21)|0,g=A>>21,g=B>>>0>>0?g+1|0:g,FA=B,E[Q+21|0]=B,pA=0,E[Q+18|0]=pA<<14|(1835008&i)>>>18|C<<3,E[Q+22|0]=(255&g)<<24|B>>>8,C=g>>21,C=(B=(i=(2097151&g)<<11|B>>>21)+(2097151&cA)|0)>>>0>>0?C+1|0:C,E[Q+25|0]=(2047&C)<<21|B>>>11,E[Q+24|0]=(7&C)<<29|B>>>3,E[Q+23|0]=31&((65535&g)<<16|FA>>>16)|B<<5,A=C>>21,A=(g=(2097151&C)<<11|B>>>21)>>>0>(C=g+(2097151&fA)|0)>>>0?A+1|0:A,E[Q+27|0]=(63&A)<<26|C>>>6,i=0,E[Q+26|0]=i<<13|(1572864&B)>>>19|C<<2,g=A>>21,g=(A=(B=(2097151&A)<<11|C>>>21)+(2097151&eA)|0)>>>0>>0?g+1|0:g,E[Q+31|0]=(131071&g)<<15|A>>>17,E[Q+30|0]=(511&g)<<23|A>>>9,E[Q+29|0]=(1&g)<<31|A>>>1,B=0,E[Q+28|0]=B<<18|(2080768&C)>>>14|A<<7,$A(r,64),$A(n,64),I&&(o[I>>2]=64,o[I+4>>2]=0),D=f+560|0,0}function p(A,I,g,C){for(var B=0,Q=0,i=0,E=0,n=0,r=0,f=0,t=0,e=0,c=0,y=0,D=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>>2]+o[C+52>>2]|0,I=(g=o[C+48>>2])+o[A+48>>2]|0,o[A+48>>2]=I,o[A+52>>2]=I>>>0>>0?B+1|0:B,B=o[A+60>>2]+o[C+60>>2]|0,I=(g=o[C+56>>2])+o[A+56>>2]|0,o[A+56>>2]=I,o[A+60>>2]=I>>>0>>0?B+1|0:B}function u(A){var I,g,C,B,Q,i,o,n,r,f,t=0,e=0,c=0,y=0,D=0,h=0,s=0,p=0,u=0,k=0,F=0,l=0,S=0,H=0,M=0,G=0,U=0,J=0,N=0,Y=0,b=0,_=0,K=0,P=0,v=0,m=0,d=0,L=0,R=0,x=0,j=0,X=0,q=0,z=0,V=0,O=0,T=0,W=0;y=(l=a[A+44|0]|a[A+45|0]<<8|a[A+46|0]<<16|a[A+47|0]<<24)>>>5&2097151,c=DA(_=(a[A+60|0]|a[A+61|0]<<8|a[A+62|0]<<16|a[A+63|0]<<24)>>>3|0,0,-683901,-1),e=(t=a[A+44|0])<<16&2031616|a[A+42|0]|a[A+43|0]<<8,t=w,p=t=e>>>0>(u=c+e|0)>>>0?t+1|0:t,G=t=t-((u>>>0<4293918720)-1|0)|0,c=t>>21,t=(e=y)+(y=(2097151&t)<<11|(h=u- -1048576|0)>>>21)|0,e=c,x=e=t>>>0>>0?e+1|0:e,j=t,N=DA(t,e,-683901,-1),k=w,s=DA(I=(a[A+49|0]|a[A+50|0]<<8|a[A+51|0]<<16|a[A+52|0]<<24)>>>7&2097151,0,-997805,-1),c=(t=a[A+27|0])>>>24|0,y=t<<8|(S=a[A+23|0]|a[A+24|0]<<8|a[A+25|0]<<16|a[A+26|0]<<24)>>>24,e=(t=a[A+28|0])>>>16|0,e=2097151&((3&(e|=c))<<30|(t=y|t<<16)>>>2),t=w,t=e>>>0>(c=e+s|0)>>>0?t+1|0:t,e=DA(d=(H=a[A+52|0]|a[A+53|0]<<8|a[A+54|0]<<16|a[A+55|0]<<24)>>>4&2097151,0,654183,0),t=w+t|0,s=c=e+c|0,c=e>>>0>c>>>0?t+1|0:t,D=(e=a[A+48|0])<<8|l>>>24,e=t=e>>>24|0,t=DA(g=2097151&((3&(l=(t=(y=a[A+49|0])>>>16|0)|e))<<30|(e=(y<<=16)|D)>>>2),0,136657,0),c=w+c|0,c=t>>>0>(e=t+s|0)>>>0?c+1|0:c,y=(t=DA(C=(a[A+57|0]|a[A+58|0]<<8|a[A+59|0]<<16|a[A+60|0]<<24)>>>6&2097151,0,666643,0))+e|0,e=w+c|0,s=y,c=t>>>0>y>>>0?e+1|0:e,e=(t=a[A+56|0])>>>24|0,D=t<<8|H>>>24,e=DA(B=2097151&((1&(H=(t=(y=a[A+57|0])>>>16|0)|e))<<31|(e=(y<<=16)|D)>>>1),0,470296,0),t=w+c|0,e=(t=(c=y=e+s|0)>>>0>>0?t+1|0:t)+k|0,e=c>>>0>(y=c+N|0)>>>0?e+1|0:e,U=c- -1048576|0,J=c=t-((c>>>0<4293918720)-1|0)|0,k=y-(t=-2097152&U)|0,N=e-((t>>>0>y>>>0)+c|0)|0,e=DA(I,0,654183,0),t=w,t=e>>>0>(c=e+(S>>>5&2097151)|0)>>>0?t+1|0:t,y=(e=c)+(c=DA(d,0,470296,0))|0,e=w+t|0,e=c>>>0>y>>>0?e+1|0:e,t=DA(g,q,-997805,-1),e=w+e|0,e=t>>>0>(c=t+y|0)>>>0?e+1|0:e,y=(t=c)+(c=DA(B,z,666643,0))|0,t=w+e|0,D=y,y=c>>>0>y>>>0?t+1|0:t,s=(c=DA(I,0,470296,0))+(t=(t=a[A+23|0])<<16&2031616|a[A+21|0]|a[A+22|0]<<8)|0,c=w,c=t>>>0>s>>>0?c+1|0:c,s=(e=DA(d,0,666643,0))+s|0,t=w+c|0,c=DA(g,q,654183,0),e=w+(e>>>0>s>>>0?t+1|0:t)|0,H=e=c>>>0>(S=c+s|0)>>>0?e+1|0:e,m=e=e-((S>>>0<4293918720)-1|0)|0,t=(t=e>>>21|0)+y|0,c=t=(e=(2097151&e)<<11|(s=S- -1048576|0)>>>21)>>>0>(D=e+D|0)>>>0?t+1|0:t,F=e=t-((D>>>0<4293918720)-1|0)|0,t=k,k=(2097151&e)<<11|(y=D- -1048576|0)>>>21,e=(e>>21)+N|0,l=k=(e=k>>>0>(M=t+k|0)>>>0?e+1|0:e)-((M>>>0<4293918720)-1|0)|0,L=M-(t=-2097152&(N=M- -1048576|0))|0,V=e-((t>>>0>M>>>0)+k|0)|0,t=DA(j,x,136657,0),c=w+c|0,c=t>>>0>(e=t+D|0)>>>0?c+1|0:c,b=e-(t=-2097152&y)|0,R=c-((t>>>0>e>>>0)+F|0)|0,M=u-(t=-2097152&h)|0,G=p-((t>>>0>u>>>0)+G|0)|0,p=DA(_,0,136657,0),e=(t=a[A+40|0])>>>24|0,y=t<<8|(h=a[A+36|0]|a[A+37|0]<<8|a[A+38|0]<<16|a[A+39|0]<<24)>>>24,c=(t=a[A+41|0])>>>16|0,e=(c|=e)>>>3|0,c=(7&c)<<29|(t=y|t<<16)>>>3,t=e+w|0,t=c>>>0>(y=c+p|0)>>>0?t+1|0:t,e=DA(C,0,-683901,-1),t=w+t|0,t=e>>>0>(c=e+y|0)>>>0?t+1|0:t,D=c,e=DA(_,0,-997805,-1),c=w,c=e>>>0>(y=e+(h>>>6&2097151)|0)>>>0?c+1|0:c,h=(e=y)+(y=DA(C,0,136657,0))|0,e=w+c|0,c=DA(B,z,-683901,-1),e=w+(y>>>0>h>>>0?e+1|0:e)|0,k=e=c>>>0>(K=c+h|0)>>>0?e+1|0:e,O=c=e-((K>>>0<4293918720)-1|0)|0,t=t+(e=c>>21)|0,h=t=(c=(2097151&c)<<11|(u=K- -1048576|0)>>>21)>>>0>(F=c+D|0)>>>0?t+1|0:t,P=t=t-((F>>>0<4293918720)-1|0)|0,e=(e=t>>21)+G|0,X=e=(t=(c=(2097151&t)<<11|(D=F- -1048576|0)>>>21)+M|0)>>>0>>0?e+1|0:e,v=t,e=DA(t,e,-683901,-1),t=w+R|0,Y=c=e+b|0,y=e>>>0>c>>>0?t+1|0:t,R=S-(t=-2097152&s)|0,G=H-((4095&m)+(t>>>0>S>>>0)|0)|0,S=DA(I,0,666643,0),t=(e=a[A+19|0])>>>24|0,s=e<<8|(H=a[A+15|0]|a[A+16|0]<<8|a[A+17|0]<<16|a[A+18|0]<<24)>>>24,c=t,e=(7&(c|=e=(t=a[A+20|0])>>>16|0))<<29|(e=(t<<=16)|s)>>>3,c=w+(c>>>3|0)|0,c=e>>>0>(s=e+S|0)>>>0?c+1|0:c,t=DA(g,q,470296,0),e=w+c|0,t=t>>>0>(s=t+s|0)>>>0?e+1|0:e,c=DA(g,q,666643,0),e=w,S=e=c>>>0>(b=c+(H>>>6&2097151)|0)>>>0?e+1|0:e,T=c=e-((b>>>0<4293918720)-1|0)|0,t=t+(e=c>>>21|0)|0,H=t=(c=(2097151&c)<<11|(p=b- -1048576|0)>>>21)>>>0>(M=c+s|0)>>>0?t+1|0:t,W=t=t-((M>>>0<4293918720)-1|0)|0,e=(e=t>>>21|0)+G|0,e=(t=(2097151&t)<<11|(s=M- -1048576|0)>>>21)>>>0>(c=t+R|0)>>>0?e+1|0:e,G=(t=c)+(c=DA(j,x,-997805,-1))|0,t=w+e|0,t=c>>>0>G>>>0?t+1|0:t,m=e=F-(c=-2097152&D)|0,Q=D=h-((c>>>0>F>>>0)+P|0)|0,c=DA(v,X,136657,0),t=w+t|0,t=c>>>0>(h=c+G|0)>>>0?t+1|0:t,c=DA(e,D,-683901,-1),e=w+t|0,h=e=c>>>0>(G=c+h|0)>>>0?e+1|0:e,P=t=e-((G>>>0<4293918720)-1|0)|0,e=(2097151&t)<<11|(D=G- -1048576|0)>>>21,t=(t>>21)+y|0,Y=e=(t=e>>>0>(F=e+Y|0)>>>0?t+1|0:t)-((F>>>0<4293918720)-1|0)|0,R=(2097151&e)<<11|(y=F- -1048576|0)>>>21,e=(e>>21)+V|0,o=L=R+L|0,R=L>>>0>>0?e+1|0:e,n=F-(e=-2097152&y)|0,r=t-((e>>>0>F>>>0)+Y|0)|0,L=G-(t=-2097152&D)|0,V=h-((t>>>0>G>>>0)+P|0)|0,c=(t=DA(j,x,654183,0))+(M-(e=-2097152&s)|0)|0,e=w+(H-((e>>>0>M>>>0)+W|0)|0)|0,e=t>>>0>c>>>0?e+1|0:e,t=DA(v,X,-997805,-1),e=w+e|0,e=t>>>0>(c=t+c|0)>>>0?e+1|0:e,y=(t=c)+(c=DA(m,Q,136657,0))|0,t=w+e|0,Y=y,h=c>>>0>y>>>0?t+1|0:t,M=K-(t=-2097152&u)|0,F=k-((t>>>0>K>>>0)+O|0)|0,H=DA(d,0,-683901,-1),t=(e=a[A+35|0])>>>24|0,y=e<<8|(s=a[A+31|0]|a[A+32|0]<<8|a[A+33|0]<<16|a[A+34|0]<<24)>>>24,c=t,e=(t=a[A+36|0])>>>16|0,e|=c,c=w,c=(t=2097151&((1&e)<<31|(t=t<<16|y)>>>1))>>>0>(e=t+H|0)>>>0?c+1|0:c,y=(t=DA(_,0,654183,0))+e|0,e=w+c|0,e=t>>>0>y>>>0?e+1|0:e,c=DA(C,0,-997805,-1),t=w+e|0,t=c>>>0>(y=c+y|0)>>>0?t+1|0:t,e=DA(B,z,136657,0),t=w+t|0,D=c=e+y|0,y=e>>>0>c>>>0?t+1|0:t,t=DA(I,0,-683901,-1),e=w,e=t>>>0>(c=t+(s>>>4&2097151)|0)>>>0?e+1|0:e,s=(t=DA(d,0,136657,0))+c|0,c=w+e|0,c=t>>>0>s>>>0?c+1|0:c,t=DA(_,0,470296,0),e=w+c|0,e=t>>>0>(s=t+s|0)>>>0?e+1|0:e,s=(c=DA(C,0,654183,0))+s|0,t=w+e|0,e=DA(B,z,-997805,-1),t=w+(c>>>0>s>>>0?t+1|0:t)|0,H=t=e>>>0>(k=e+s|0)>>>0?t+1|0:t,f=e=t-((k>>>0<4293918720)-1|0)|0,c=(t=e>>21)+y|0,G=e=(c=(e=(2097151&e)<<11|(s=k- -1048576|0)>>>21)>>>0>(u=e+D|0)>>>0?c+1|0:c)-((u>>>0<4293918720)-1|0)|0,t=(t=e>>21)+F|0,P=t=(e=(y=(2097151&e)<<11|(D=u- -1048576|0)>>>21)+M|0)>>>0>>0?t+1|0:t,y=Y,Y=e,t=DA(e,t,-683901,-1),e=w+h|0,F=y=y+t|0,y=t>>>0>y>>>0?e+1|0:e,h=(t=DA(j,x,470296,0))+(b-(e=-2097152&p)|0)|0,e=w+(S-((2047&T)+(e>>>0>b>>>0)|0)|0)|0,e=t>>>0>h>>>0?e+1|0:e,p=(t=h)+(h=DA(v,X,654183,0))|0,t=w+e|0,t=h>>>0>p>>>0?t+1|0:t,h=DA(m,Q,-997805,-1),e=w+t|0,e=h>>>0>(p=h+p|0)>>>0?e+1|0:e,K=D=u-(t=-2097152&D)|0,i=h=c-((t>>>0>u>>>0)+G|0)|0,c=DA(Y,P,136657,0),t=w+e|0,t=c>>>0>(p=c+p|0)>>>0?t+1|0:t,c=DA(D,h,-683901,-1),e=w+t|0,h=e=c>>>0>(S=c+p|0)>>>0?e+1|0:e,G=t=e-((S>>>0<4293918720)-1|0)|0,e=(2097151&t)<<11|(D=S- -1048576|0)>>>21,t=(t>>21)+y|0,F=e=(t=e>>>0>(p=e+F|0)>>>0?t+1|0:t)-((p>>>0<4293918720)-1|0)|0,u=(2097151&e)<<11|(y=p- -1048576|0)>>>21,e=(e>>21)+V|0,O=M=u+L|0,M=u>>>0>M>>>0?e+1|0:e,T=p-(e=-2097152&y)|0,W=t-((e>>>0>p>>>0)+F|0)|0,L=S-(t=-2097152&D)|0,V=h-((t>>>0>S>>>0)+G|0)|0,h=DA(j,x,666643,0),t=(e=a[A+14|0])>>>24|0,y=e<<8|(G=a[A+10|0]|a[A+11|0]<<8|a[A+12|0]<<16|a[A+13|0]<<24)>>>24,c=t,e=(t=a[A+15|0])>>>16|0,e|=c,c=w,c=(t=2097151&((1&e)<<31|(t=t<<16|y)>>>1))>>>0>(e=t+h|0)>>>0?c+1|0:c,y=(t=e)+(e=DA(v,X,470296,0))|0,t=w+c|0,t=e>>>0>y>>>0?t+1|0:t,e=DA(m,Q,654183,0),t=w+t|0,t=e>>>0>(c=e+y|0)>>>0?t+1|0:t,y=(e=c)+(c=DA(Y,P,-997805,-1))|0,e=w+t|0,e=c>>>0>y>>>0?e+1|0:e,t=DA(K,i,136657,0),e=w+e|0,S=c=t+y|0,y=t>>>0>c>>>0?e+1|0:e,s=k-(t=-2097152&s)|0,h=H-((t>>>0>k>>>0)+f|0)|0,c=DA(I,0,136657,0),t=w,t=(e=(a[A+28|0]|a[A+29|0]<<8|a[A+30|0]<<16|a[A+31|0]<<24)>>>7&2097151)>>>0>(c=e+c|0)>>>0?t+1|0:t,D=(e=c)+(c=DA(d,0,-997805,-1))|0,e=w+t|0,e=c>>>0>D>>>0?e+1|0:e,t=DA(g,q,-683901,-1),e=w+e|0,e=t>>>0>(c=t+D|0)>>>0?e+1|0:e,D=(t=DA(_,0,666643,0))+c|0,c=w+e|0,c=t>>>0>D>>>0?c+1|0:c,e=DA(C,0,470296,0),t=w+c|0,t=e>>>0>(D=e+D|0)>>>0?t+1|0:t,e=DA(B,z,654183,0),t=w+t|0,e=(J>>21)+(e>>>0>(c=e+D|0)>>>0?t+1|0:t)|0,u=e=(D=(2097151&J)<<11|U>>>21)>>>0>(U=D+c|0)>>>0?e+1|0:e,F=t=e-((U>>>0<4293918720)-1|0)|0,D=(2097151&t)<<11|(p=U- -1048576|0)>>>21,t=(t>>21)+h|0,b=t=(e=D+s|0)>>>0>>0?t+1|0:t,J=e,e=DA(e,t,-683901,-1),t=w+y|0,D=c=e+S|0,y=e>>>0>c>>>0?t+1|0:t,t=DA(v,X,666643,0),e=w,e=t>>>0>(c=t+(G>>>4&2097151)|0)>>>0?e+1|0:e,t=DA(m,Q,470296,0),e=w+e|0,e=t>>>0>(c=t+c|0)>>>0?e+1|0:e,h=(t=DA(Y,P,654183,0))+c|0,c=w+e|0,c=t>>>0>h>>>0?c+1|0:c,e=DA(K,i,-997805,-1),t=w+c|0,t=e>>>0>(h=e+h|0)>>>0?t+1|0:t,e=DA(J,b,136657,0),t=w+t|0,H=t=e>>>0>(k=e+h|0)>>>0?t+1|0:t,x=e=t-((k>>>0<4293918720)-1|0)|0,t=D,D=(2097151&e)<<11|(s=k- -1048576|0)>>>21,e=(e>>21)+y|0,v=y=(e=(c=t+D|0)>>>0>>0?e+1|0:e)-((c>>>0<4293918720)-1|0)|0,t=(t=y>>21)+V|0,j=D=(y=(2097151&y)<<11|(h=c- -1048576|0)>>>21)+L|0,S=y>>>0>D>>>0?t+1|0:t,D=c,c=e,y=(U-(e=-2097152&p)|0)+(p=(2097151&l)<<11|N>>>21)|0,e=(u-((e>>>0>U>>>0)+F|0)|0)+(l>>21)|0,G=e=y>>>0

>>0?e+1|0:e,d=e=e-((y>>>0<4293918720)-1|0)|0,N=t=e>>21,t=DA(_=(2097151&e)<<11|(F=y- -1048576|0)>>>21,t,-683901,-1),c=w+c|0,c=t>>>0>(e=t+D|0)>>>0?c+1|0:c,q=e-(t=-2097152&h)|0,z=c-((t>>>0>e>>>0)+v|0)|0,t=DA(_,N,136657,0),e=H+w|0,X=(c=t+k|0)-(t=-2097152&s)|0,v=(e=c>>>0>>0?e+1|0:e)-((t>>>0>c>>>0)+x|0)|0,e=DA(m,Q,666643,0),c=w,c=(t=(a[A+7|0]|a[A+8|0]<<8|a[A+9|0]<<16|a[A+10|0]<<24)>>>7&2097151)>>>0>(e=t+e|0)>>>0?c+1|0:c,D=(t=DA(Y,P,470296,0))+e|0,e=w+c|0,e=t>>>0>D>>>0?e+1|0:e,t=DA(K,i,654183,0),e=w+e|0,e=t>>>0>(c=t+D|0)>>>0?e+1|0:e,D=(t=c)+(c=DA(J,b,-997805,-1))|0,t=w+e|0,p=D,D=c>>>0>D>>>0?t+1|0:t,H=DA(Y,P,666643,0),t=(e=a[A+6|0])>>>24|0,h=e<<8|(U=a[A+2|0]|a[A+3|0]<<8|a[A+4|0]<<16|a[A+5|0]<<24)>>>24,c=t,e=(t=a[A+7|0])>>>16|0,e=2097151&((3&(e|=c))<<30|(t=t<<16|h)>>>2),t=w,t=e>>>0>(c=e+H|0)>>>0?t+1|0:t,h=(e=DA(K,i,470296,0))+c|0,c=w+t|0,c=e>>>0>h>>>0?c+1|0:c,e=DA(J,b,654183,0),t=w+c|0,H=t=e>>>0>(u=e+h|0)>>>0?t+1|0:t,l=t=t-((u>>>0<4293918720)-1|0)|0,e=(c=t>>21)+D|0,k=t=(e=(t=(2097151&t)<<11|(s=u- -1048576|0)>>>21)>>>0>(h=t+p|0)>>>0?e+1|0:e)-((h>>>0<4293918720)-1|0)|0,p=(2097151&t)<<11|(D=h- -1048576|0)>>>21,t=(t>>21)+v|0,v=Y=p+X|0,p=p>>>0>Y>>>0?t+1|0:t,t=DA(_,N,-997805,-1),e=w+e|0,e=t>>>0>(c=t+h|0)>>>0?e+1|0:e,m=c-(t=-2097152&D)|0,P=e-((t>>>0>c>>>0)+k|0)|0,e=DA(_,N,654183,0),t=H+w|0,Y=(c=e+u|0)-(e=-2097152&s)|0,l=(t=c>>>0>>0?t+1|0:t)-((e>>>0>c>>>0)+l|0)|0,t=DA(K,i,666643,0),e=w,e=t>>>0>(c=t+(U>>>5&2097151)|0)>>>0?e+1|0:e,t=DA(J,b,470296,0),e=w+e|0,h=c=t+c|0,c=t>>>0>c>>>0?e+1|0:e,D=DA(J,b,666643,0),e=(t=a[A+2|0])<<16&2031616|a[0|A]|a[A+1|0]<<8,t=w,H=t=e>>>0>(k=D+e|0)>>>0?t+1|0:t,b=t=t-((k>>>0<4293918720)-1|0)|0,D=(2097151&t)<<11|(s=k- -1048576|0)>>>21,t=(t>>21)+c|0,c=t=D>>>0>(u=D+h|0)>>>0?t+1|0:t,U=t=t-((u>>>0<4293918720)-1|0)|0,D=(2097151&t)<<11|(h=u- -1048576|0)>>>21,t=(t>>21)+l|0,D=D>>>0>(l=J=D+Y|0)>>>0?t+1|0:t,t=DA(_,N,470296,0),c=c+w|0,c=(e=t+u|0)>>>0>>0?c+1|0:c,u=e-(t=-2097152&h)|0,h=c-((t>>>0>e>>>0)+U|0)|0,e=DA(_,N,666643,0),t=w+(H-(((c=-2097152&s)>>>0>k>>>0)+b|0)|0)|0,e=(c=(t=e>>>0>(J=e+(k-c|0)|0)>>>0?t+1|0:t)>>21)+h|0,t=(t=(e=(t=(2097151&t)<<11|J>>>21)>>>0>(U=t+u|0)>>>0?e+1|0:e)>>21)+D|0,e=(e=(t=(e=(2097151&e)<<11|U>>>21)>>>0>(l=e+l|0)>>>0?t+1|0:t)>>21)+P|0,c=(t=(e=(t=(2097151&t)<<11|l>>>21)>>>0>(D=t+m|0)>>>0?e+1|0:e)>>21)+p|0,t=(e=(c=(e=(2097151&e)<<11|D>>>21)>>>0>(N=e+v|0)>>>0?c+1|0:c)>>21)+z|0,e=(c=(t=(c=(2097151&c)<<11|N>>>21)>>>0>(k=c+q|0)>>>0?t+1|0:t)>>21)+S|0,t=(t=(e=(t=(2097151&t)<<11|k>>>21)>>>0>(u=t+j|0)>>>0?e+1|0:e)>>21)+W|0,e=(e=(t=(e=(2097151&e)<<11|u>>>21)>>>0>(S=e+T|0)>>>0?t+1|0:t)>>21)+M|0,c=(t=(e=(t=(2097151&t)<<11|S>>>21)>>>0>(p=t+O|0)>>>0?e+1|0:e)>>21)+r|0,t=(e=(c=(e=(2097151&e)<<11|p>>>21)>>>0>(H=e+n|0)>>>0?c+1|0:c)>>21)+R|0,h=(F=y-(e=-2097152&F)|0)+((2097151&(t=(c=(2097151&c)<<11|H>>>21)>>>0>(s=c+o|0)>>>0?t+1|0:t))<<11|s>>>21)|0,t=(G-((e>>>0>y>>>0)+d|0)|0)+(t>>21)|0,F=e=(t=h>>>0>>0?t+1|0:t)>>21,J=(t=DA(M=(2097151&t)<<11|h>>>21,e,666643,0))+(e=2097151&J)|0,t=w,y=t=e>>>0>J>>>0?t+1|0:t,E[0|A]=J,E[A+1|0]=(255&t)<<24|J>>>8,t=2097151&U,e=DA(M,F,470296,0)+t|0,c=w,t=(y>>21)+(t>>>0>e>>>0?c+1|0:c)|0,t=(G=(2097151&y)<<11|J>>>21)>>>0>(U=G+e|0)>>>0?t+1|0:t,E[A+4|0]=(2047&t)<<21|U>>>11,e=t,c=U,E[A+3|0]=(7&t)<<29|c>>>3,E[A+2|0]=31&((65535&y)<<16|J>>>16)|c<<5,y=2097151&l,l=DA(M,F,654183,0)+y|0,t=w,U=(2097151&e)<<11|c>>>21,e=(e>>21)+(y=y>>>0>l>>>0?t+1|0:t)|0,t=e=(l=U+l|0)>>>0>>0?e+1|0:e,E[A+6|0]=(63&t)<<26|l>>>6,y=l,l=0,E[A+5|0]=l<<13|(1572864&c)>>>19|y<<2,c=2097151&D,D=DA(M,F,-997805,-1)+c|0,e=w,e=c>>>0>D>>>0?e+1|0:e,l=(2097151&(c=t))<<11|y>>>21,c=(t>>=21)+e|0,c=(D=l+D|0)>>>0>>0?c+1|0:c,E[A+9|0]=(511&c)<<23|D>>>9,E[A+8|0]=(1&c)<<31|D>>>1,e=0,E[A+7|0]=e<<18|(2080768&y)>>>14|D<<7,e=2097151&N,y=DA(M,F,136657,0)+e|0,t=w,t=e>>>0>y>>>0?t+1|0:t,N=(2097151&(e=c))<<11|D>>>21,e=t+(c=e>>21)|0,e=(y=N+y|0)>>>0>>0?e+1|0:e,E[A+12|0]=(4095&e)<<20|y>>>12,c=y,E[A+11|0]=(15&e)<<28|c>>>4,y=0,E[A+10|0]=y<<15|(1966080&D)>>>17|c<<4,y=2097151&k,D=DA(M,F,-683901,-1)+y|0,t=w,t=y>>>0>D>>>0?t+1|0:t,y=e,e=t+(e>>=21)|0,e=(y=(Y=D)+(D=(2097151&y)<<11|c>>>21)|0)>>>0>>0?e+1|0:e,E[A+14|0]=(127&e)<<25|y>>>7,D=0,E[A+13|0]=D<<12|(1048576&c)>>>20|y<<1,t=e>>21,c=(e=(2097151&e)<<11|y>>>21)>>>0>(D=e+(2097151&u)|0)>>>0?t+1|0:t,E[A+17|0]=(1023&c)<<22|D>>>10,E[A+16|0]=(3&c)<<30|D>>>2,e=0,E[A+15|0]=e<<17|(2064384&y)>>>15|D<<6,t=c>>21,t=(e=(2097151&c)<<11|D>>>21)>>>0>(c=e+(2097151&S)|0)>>>0?t+1|0:t,E[A+20|0]=(8191&t)<<19|c>>>13,E[A+19|0]=(31&t)<<27|c>>>5,y=(e=2097151&p)+(p=(2097151&t)<<11|c>>>21)|0,e=t>>21,e=y>>>0

>>0?e+1|0:e,p=y,E[A+21|0]=y,S=0,E[A+18|0]=S<<14|(1835008&D)>>>18|c<<3,E[A+22|0]=(255&e)<<24|y>>>8,c=e>>21,c=(y=(D=(2097151&e)<<11|y>>>21)+(2097151&H)|0)>>>0>>0?c+1|0:c,E[A+25|0]=(2047&c)<<21|y>>>11,E[A+24|0]=(7&c)<<29|y>>>3,E[A+23|0]=31&((65535&e)<<16|p>>>16)|y<<5,t=c>>21,t=(e=(2097151&c)<<11|y>>>21)>>>0>(c=e+(2097151&s)|0)>>>0?t+1|0:t,E[A+27|0]=(63&t)<<26|c>>>6,D=0,E[A+26|0]=D<<13|(1572864&y)>>>19|c<<2,e=t>>21,e=(t=(y=(2097151&t)<<11|c>>>21)+(2097151&h)|0)>>>0>>0?e+1|0:e,E[A+31|0]=(131071&e)<<15|t>>>17,E[A+30|0]=(511&e)<<23|t>>>9,E[A+29|0]=(1&e)<<31|t>>>1,y=0,E[A+28|0]=y<<18|(2080768&c)>>>14|t<<7}function k(A,I,g,C,B,Q){var i,n=0,f=0,t=0,e=0,c=0,y=0,w=0,h=0,s=0,p=0,k=0,S=0,H=0,G=0,J=0,N=0,Y=0,P=0,v=0,d=0,L=0,R=0,x=0,j=0,X=0,q=0,z=0,O=0,T=0,W=0,Z=0,$=0,AA=0,IA=0,gA=0,CA=0,BA=0,QA=0;for(D=i=D-592|0,S=-1,H=A+32|0,k=32,G=1;p=a[2672+(f=k-1|0)|0],t=(f=((e=a[f+H|0])^p)-1>>8&G)&(y=a[H+(k=k-2|0)|0])-(c=a[k+2672|0])>>8|255&(e-p>>>8&G|t),G=f&(c^y)-1>>8,k;);if(255&t&&!(aA(A)|!(((127&(-1^a[B+31|0])|a[B+1|0]&a[B+2|0]&a[B+3|0]&a[B+4|0]&a[B+5|0]&a[B+6|0]&a[B+7|0]&a[B+8|0]&a[B+9|0]&a[B+10|0]&a[B+11|0]&a[B+12|0]&a[B+13|0]&a[B+14|0]&a[B+15|0]&a[B+16|0]&a[B+17|0]&a[B+18|0]&a[B+19|0]&a[B+20|0]&a[B+21|0]&a[B+22|0]&a[B+23|0]&a[B+24|0]&a[B+25|0]&a[B+26|0]&a[B+27|0]&a[B+28|0]&a[B+30|0]&a[B+29|0]^255)-1&236-a[0|B]^-1)>>>8&1)||aA(B)||U(i+128|0,B))){for(EA(f=i+384|0),Q&&m(f,34768,34,0),m(f,A,32,0),m(f,B,32,0),m(f,I,g,C),M(f,g=i+320|0),u(g),Q=i+8|0,C=i+128|0,B=0,I=0,D=n=D-2272|0;e=g+(B>>>3|0)|0,E[(f=n+2016|0)+B|0]=a[0|e]>>>(6&B)&1,E[(t=f)+(f=1|B)|0]=a[0|e]>>>(7&f)&1,256!=(0|(B=B+2|0)););for(;;){I=(g=I)+1|0;A:if(!(!a[0|(t=g+(n+2016|0)|0)]|g>>>0>254)){I:if(B=E[0|(c=(n+2016|0)+I|0)])if((0|(B=(e=B<<1)+(f=E[0|t])|0))<=15)E[0|t]=B,E[0|c]=0;else{if((0|(B=f-e|0))<-15)break A;for(E[0|t]=B,B=I;;){if(!a[0|(f=(n+2016|0)+B|0)]){E[0|f]=1;break I}if(E[0|f]=0,f=B>>>0<255,B=B+1|0,!f)break}}if(!(g>>>0>253)){I:if(f=E[0|(y=(B=g+2|0)+(n+2016|0)|0)])if((0|(f=(c=f<<2)+(e=E[0|t])|0))>=16){if((0|(f=e-c|0))<-15)break A;for(E[0|t]=f;;){if(a[0|(f=(n+2016|0)+B|0)]){if(E[0|f]=0,f=B>>>0<255,B=B+1|0,f)continue;break I}break}E[0|f]=1}else E[0|t]=f,E[0|y]=0;if(!(g>>>0>252)){I:if(f=E[0|(y=(B=g+3|0)+(n+2016|0)|0)])if((0|(f=(c=f<<3)+(e=E[0|t])|0))>=16){if((0|(f=e-c|0))<-15)break A;for(E[0|t]=f;;){if(a[0|(f=(n+2016|0)+B|0)]){if(E[0|f]=0,f=B>>>0<255,B=B+1|0,f)continue;break I}break}E[0|f]=1}else E[0|t]=f,E[0|y]=0;if(!(g>>>0>251)){I:if(f=E[0|(y=(B=g+4|0)+(n+2016|0)|0)])if((0|(f=(c=f<<4)+(e=E[0|t])|0))>=16){if((0|(f=e-c|0))<-15)break A;for(E[0|t]=f;;){if(a[0|(f=(n+2016|0)+B|0)]){if(E[0|f]=0,f=B>>>0<255,B=B+1|0,f)continue;break I}break}E[0|f]=1}else E[0|t]=f,E[0|y]=0;if(!(g>>>0>250)){I:if(f=E[0|(y=(B=g+5|0)+(n+2016|0)|0)])if((0|(f=(c=f<<5)+(e=E[0|t])|0))>=16){if((0|(f=e-c|0))<-15)break A;for(E[0|t]=f;;){if(a[0|(f=(n+2016|0)+B|0)]){if(E[0|f]=0,f=B>>>0<255,B=B+1|0,f)continue;break I}break}E[0|f]=1}else E[0|t]=f,E[0|y]=0;if(!(g>>>0>249)&&(g=E[0|(c=(B=g+6|0)+(n+2016|0)|0)]))if((0|(g=(e=g<<6)+(f=E[0|t])|0))>=16){if((0|(g=f-e|0))<-15)break A;for(E[0|t]=g;;){if(a[0|(g=(n+2016|0)+B|0)]){if(E[0|g]=0,g=B>>>0<255,B=B+1|0,g)continue;break A}break}E[0|g]=1}else E[0|t]=g,E[0|c]=0}}}}}if(256==(0|I))break}for(B=0;g=H+(B>>>3|0)|0,E[(I=n+1760|0)+B|0]=a[0|g]>>>(6&B)&1,E[(f=I)+(I=1|B)|0]=a[0|g]>>>(7&I)&1,256!=(0|(B=B+2|0)););for(I=0;;){I=(g=I)+1|0;A:if(!(!a[0|(t=g+(n+1760|0)|0)]|g>>>0>254)){I:if(B=E[0|(c=(n+1760|0)+I|0)])if((0|(B=(e=B<<1)+(f=E[0|t])|0))<=15)E[0|t]=B,E[0|c]=0;else{if((0|(B=f-e|0))<-15)break A;for(E[0|t]=B,B=I;;){if(!a[0|(f=(n+1760|0)+B|0)]){E[0|f]=1;break I}if(E[0|f]=0,f=B>>>0<255,B=B+1|0,!f)break}}if(!(g>>>0>253)){I:if(f=E[0|(y=(B=g+2|0)+(n+1760|0)|0)])if((0|(f=(c=f<<2)+(e=E[0|t])|0))>=16){if((0|(f=e-c|0))<-15)break A;for(E[0|t]=f;;){if(a[0|(f=(n+1760|0)+B|0)]){if(E[0|f]=0,f=B>>>0<255,B=B+1|0,f)continue;break I}break}E[0|f]=1}else E[0|t]=f,E[0|y]=0;if(!(g>>>0>252)){I:if(f=E[0|(y=(B=g+3|0)+(n+1760|0)|0)])if((0|(f=(c=f<<3)+(e=E[0|t])|0))>=16){if((0|(f=e-c|0))<-15)break A;for(E[0|t]=f;;){if(a[0|(f=(n+1760|0)+B|0)]){if(E[0|f]=0,f=B>>>0<255,B=B+1|0,f)continue;break I}break}E[0|f]=1}else E[0|t]=f,E[0|y]=0;if(!(g>>>0>251)){I:if(f=E[0|(y=(B=g+4|0)+(n+1760|0)|0)])if((0|(f=(c=f<<4)+(e=E[0|t])|0))>=16){if((0|(f=e-c|0))<-15)break A;for(E[0|t]=f;;){if(a[0|(f=(n+1760|0)+B|0)]){if(E[0|f]=0,f=B>>>0<255,B=B+1|0,f)continue;break I}break}E[0|f]=1}else E[0|t]=f,E[0|y]=0;if(!(g>>>0>250)){I:if(f=E[0|(y=(B=g+5|0)+(n+1760|0)|0)])if((0|(f=(c=f<<5)+(e=E[0|t])|0))>=16){if((0|(f=e-c|0))<-15)break A;for(E[0|t]=f;;){if(a[0|(f=(n+1760|0)+B|0)]){if(E[0|f]=0,f=B>>>0<255,B=B+1|0,f)continue;break I}break}E[0|f]=1}else E[0|t]=f,E[0|y]=0;if(!(g>>>0>249)&&(g=E[0|(c=(B=g+6|0)+(n+1760|0)|0)]))if((0|(g=(e=g<<6)+(f=E[0|t])|0))>=16){if((0|(g=f-e|0))<-15)break A;for(E[0|t]=g;;){if(a[0|(g=(n+1760|0)+B|0)]){if(E[0|g]=0,g=B>>>0<255,B=B+1|0,g)continue;break A}break}E[0|g]=1}else E[0|t]=g,E[0|c]=0}}}}}if(256==(0|I))break}for(V(S=n+480|0,C),p=o[C+8>>2],t=o[C+12>>2],y=o[C+16>>2],c=o[C+20>>2],e=o[C+24>>2],f=o[C+28>>2],B=o[C>>2],g=o[C+4>>2],I=o[C+36>>2],o[n+192>>2]=o[C+32>>2],o[n+196>>2]=I,o[n+184>>2]=e,o[n+188>>2]=f,o[n+176>>2]=y,o[n+180>>2]=c,o[n+168>>2]=p,o[n+172>>2]=t,o[n+160>>2]=B,o[n+164>>2]=g,p=o[C+40>>2],t=o[C+44>>2],y=o[C+48>>2],c=o[C+52>>2],e=o[C+56>>2],f=o[C+60>>2],B=o[(I=C- -64|0)>>2],g=o[I+4>>2],I=o[C+76>>2],o[n+232>>2]=o[C+72>>2],o[n+236>>2]=I,o[n+224>>2]=B,o[n+228>>2]=g,o[n+216>>2]=e,o[n+220>>2]=f,o[n+208>>2]=y,o[n+212>>2]=c,o[n+200>>2]=p,o[n+204>>2]=t,p=o[C+80>>2],t=o[C+84>>2],y=o[C+88>>2],c=o[C+92>>2],e=o[C+96>>2],f=o[C+100>>2],B=o[C+104>>2],g=o[C+108>>2],I=o[C+116>>2],o[n+272>>2]=o[C+112>>2],o[n+276>>2]=I,o[n+264>>2]=B,o[n+268>>2]=g,o[n+256>>2]=e,o[n+260>>2]=f,o[n+248>>2]=y,o[n+252>>2]=c,o[n+240>>2]=p,o[n+244>>2]=t,l(C=n+320|0,g=n+160|0),F(n,C,w=n+440|0),F(n+40|0,h=n+360|0,s=n+400|0),F(n+80|0,s,w),F(n+120|0,C,h),_(C,n,S),F(g,C,w),F(N=n+200|0,h,s),F(Y=n+240|0,s,w),F(J=n+280|0,C,h),V(I=n+640|0,g),_(C,n,I),F(g,C,w),F(N,h,s),F(Y,s,w),F(J,C,h),V(I=n+800|0,g),_(C,n,I),F(g,C,w),F(N,h,s),F(Y,s,w),F(J,C,h),V(I=n+960|0,g),_(C,n,I),F(g,C,w),F(N,h,s),F(Y,s,w),F(J,C,h),V(I=n+1120|0,g),_(C,n,I),F(g,C,w),F(N,h,s),F(Y,s,w),F(J,C,h),V(I=n+1280|0,g),_(C,n,I),F(g,C,w),F(N,h,s),F(Y,s,w),F(J,C,h),V(I=n+1440|0,g),_(C,n,I),F(g,C,w),F(N,h,s),F(Y,s,w),F(J,C,h),V(n+1600|0,g),o[Q+32>>2]=0,o[Q+36>>2]=0,o[Q+24>>2]=0,o[Q+28>>2]=0,o[Q+16>>2]=0,o[Q+20>>2]=0,o[Q+8>>2]=0,o[Q+12>>2]=0,o[Q>>2]=0,o[Q+4>>2]=0,o[Q+44>>2]=0,o[Q+48>>2]=0,o[(z=Q+40|0)>>2]=1,o[Q+52>>2]=0,o[Q+56>>2]=0,o[Q+60>>2]=0,o[Q+64>>2]=0,o[Q+68>>2]=0,o[Q+72>>2]=0,o[Q+84>>2]=0,o[Q+88>>2]=0,o[Q+76>>2]=0,o[Q+80>>2]=1,o[Q+92>>2]=0,o[Q+96>>2]=0,o[Q+100>>2]=0,o[Q+104>>2]=0,o[Q+108>>2]=0,o[Q+112>>2]=0,o[Q+116>>2]=0,IA=Q+80|0,I=255;;){A:{I:{if(!(a[(n+2016|0)+I|0]|a[(n+1760|0)+I|0])){if(!(a[(g=I-1|0)+(n+2016|0)|0]|a[g+(n+1760|0)|0]))break I;I=g}if((0|I)<0)break A;for(;l(n+320|0,Q),(0|(B=E[(g=I)+(n+2016|0)|0]))>0?(F(I=n+160|0,C=n+320|0,w),F(N,h,s),F(Y,s,w),F(J,C,h),_(C,I,(n+480|0)+r((254&B)>>>1|0,160)|0)):(0|B)>=0||(F(I=n+160|0,C=n+320|0,w),F(N,h,s),F(Y,s,w),F(J,C,h),b(C,I,(n+480|0)+r((0-B&254)>>>1|0,160)|0)),(0|(X=E[g+(n+1760|0)|0]))>0?(F(I=n+160|0,C=n+320|0,w),F(N,h,s),F(Y,s,w),F(J,C,h),K(C,I,r((254&X)>>>1|0,120)+1488|0)):(0|X)>=0||(F(n+160|0,q=n+320|0,w),F(N,h,s),F(Y,s,w),F(J,q,h),P=o[n+160>>2],v=o[n+200>>2],d=o[n+164>>2],L=o[n+204>>2],R=o[n+168>>2],x=o[n+208>>2],j=o[n+172>>2],k=o[n+212>>2],H=o[n+176>>2],G=o[n+216>>2],S=o[n+180>>2],p=o[n+220>>2],t=o[n+184>>2],y=o[n+224>>2],c=o[n+188>>2],e=o[n+228>>2],f=o[n+192>>2],B=o[n+232>>2],C=o[n+236>>2],I=o[n+196>>2],o[n+396>>2]=C-I,o[n+392>>2]=B-f,o[n+388>>2]=e-c,o[n+384>>2]=y-t,o[n+380>>2]=p-S,o[n+376>>2]=G-H,o[n+372>>2]=k-j,o[n+368>>2]=x-R,o[n+364>>2]=L-d,o[n+360>>2]=v-P,o[n+356>>2]=I+C,o[n+352>>2]=B+f,o[n+348>>2]=e+c,o[n+344>>2]=t+y,o[n+340>>2]=p+S,o[n+336>>2]=H+G,o[n+332>>2]=k+j,o[n+328>>2]=R+x,o[n+324>>2]=d+L,o[n+320>>2]=P+v,F(s,q,40+(I=r((0-X&254)>>>1|0,120)+1488|0)|0),F(h,h,I),F(w,I+80|0,J),gA=o[n+276>>2],CA=o[n+272>>2],X=o[n+268>>2],q=o[n+264>>2],t=o[n+260>>2],y=o[n+256>>2],c=o[n+252>>2],e=o[n+248>>2],f=o[n+244>>2],B=o[n+240>>2],O=o[n+360>>2],T=o[n+400>>2],W=o[n+364>>2],Z=o[n+404>>2],$=o[n+368>>2],AA=o[n+408>>2],P=o[n+372>>2],v=o[n+412>>2],d=o[n+376>>2],L=o[n+416>>2],R=o[n+380>>2],x=o[n+420>>2],j=o[n+384>>2],k=o[n+424>>2],H=o[n+388>>2],G=o[n+428>>2],S=o[n+392>>2],p=o[n+432>>2],C=o[n+396>>2],I=o[n+436>>2],o[n+396>>2]=C+I,o[n+392>>2]=p+S,o[n+388>>2]=H+G,o[n+384>>2]=k+j,o[n+380>>2]=R+x,o[n+376>>2]=d+L,o[n+372>>2]=P+v,o[n+368>>2]=$+AA,o[n+364>>2]=W+Z,o[n+360>>2]=O+T,o[n+356>>2]=I-C,o[n+352>>2]=p-S,o[n+348>>2]=G-H,o[n+344>>2]=k-j,o[n+340>>2]=x-R,o[n+336>>2]=L-d,o[n+332>>2]=v-P,o[n+328>>2]=AA-$,o[n+324>>2]=Z-W,o[n+320>>2]=T-O,P=B<<1,v=o[n+440>>2],o[n+400>>2]=P-v,d=f<<1,L=o[n+444>>2],o[n+404>>2]=d-L,R=e<<1,x=o[n+448>>2],o[n+408>>2]=R-x,j=c<<1,k=o[n+452>>2],o[n+412>>2]=j-k,H=y<<1,G=o[n+456>>2],o[n+416>>2]=H-G,S=t<<1,p=o[n+460>>2],o[n+420>>2]=S-p,t=q<<1,y=o[n+464>>2],o[n+424>>2]=t-y,c=X<<1,e=o[n+468>>2],o[n+428>>2]=c-e,f=CA<<1,B=o[n+472>>2],o[n+432>>2]=f-B,C=gA<<1,I=o[n+476>>2],o[n+436>>2]=C-I,o[n+440>>2]=P+v,o[n+444>>2]=d+L,o[n+448>>2]=R+x,o[n+452>>2]=k+j,o[n+456>>2]=H+G,o[n+460>>2]=p+S,o[n+464>>2]=t+y,o[n+468>>2]=e+c,o[n+472>>2]=B+f,o[n+476>>2]=I+C),F(Q,n+320|0,w),F(z,h,s),F(IA,s,w),I=g-1|0,(0|g)>0;);break A}if(I=I-2|0,g)continue}break}D=n+2272|0,uA(I=i+288|0,Q),BA=-1,QA=cA(I,A),S=((0|A)==(0|I)?BA:QA)|oA(A,I,32)}return D=i+592|0,S}function F(A,I,g){var C,B,Q,i,E,a,n,f,t,e,c,y,D,h,s,p,u,k,F,l,S,H,M,G,U,J,N,Y,b,_,K,P,v,m,d,L,R,x,j,X,q,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J,K=DA(L,B,Z,y),N=w+J|0,N=(P=K+P|0)>>>0>>0?N+1|0:N,K=DA(J=m,Q,m=iA,X=m>>31),J=w+N|0,J=(J=((P=K+P|0)>>>0>>0?J+1|0:J)<<1|P>>>31)+(N=Y>>25)|0,J=(Y=(_=P<<1)+(P=(33554431&Y)<<7|T>>>25)|0)>>>0

>>0?J+1|0:J,P=Y,N=J,K=J=Y+33554432|0,Y=N=J>>>0<33554432?N+1|0:N,o[A+152>>2]=P-(-67108864&J),N=s-(J=-67108864&oA)|0,q=EA-((J>>>0>s>>>0)+aA|0)|0,J=b>>25,b=(d=(33554431&b)<<7|d>>>25)+N|0,N=J+q|0,N=b>>>0>>0?N+1|0:N,_=N=(67108863&(N=(J=b+33554432|0)>>>0<33554432?N+1|0:N))<<6|J>>>26,N=N+(P=gA-(-33554432&nA)|0)|0,o[A+140>>2]=N,o[A+136>>2]=b-(-67108864&J),J=DA(x,i,z,n),N=w,b=DA(V,c,O,F),N=w+N|0,N=(J=b+J|0)>>>0>>0?N+1|0:N,b=(x=DA(j,t,IA,h))+J|0,J=w+N|0,J=b>>>0>>0?J+1|0:J,N=b,b=DA(R,C,Z,y),J=w+J|0,J=(N=N+b|0)>>>0>>0?J+1|0:J,b=(R=DA(L,B,m,X))+N|0,N=w+J|0,N=J=(b>>>0>>0?N+1|0:N)<<1|b>>>31,J=(J=Y>>26)+N|0,N=(Y=(_=b<<=1)+(b=(67108863&Y)<<6|K>>>26)|0)>>>0>>0?J+1|0:J,N=(J=Y+16777216|0)>>>0<16777216?N+1|0:N,o[A+156>>2]=Y-(-33554432&J),b=v-(-33554432&CA)|0,R=l-(Y=-67108864&M)|0,L=rA-((Y>>>0>l>>>0)+G|0)|0,N=DA((33554431&N)<<7|J>>>25,N>>25,19,0),J=w+L|0,N=N>>>0>(Y=N+R|0)>>>0?J+1|0:J,_=N=(67108863&(N=(J=Y+33554432|0)>>>0<33554432?N+1|0:N))<<6|J>>>26,N=N+b|0,o[A+124>>2]=N,o[A+120>>2]=Y-(-67108864&J),J=o[I+40>>2],N=o[I+44>>2],Y=o[I+4>>2],b=o[I+48>>2],R=o[I+8>>2],L=o[I+52>>2],m=o[I+12>>2],x=o[I+56>>2],P=o[I+16>>2],K=o[I+60>>2],z=o[I+20>>2],X=o[I- -64>>2],j=o[I+24>>2],d=o[I+68>>2],q=o[I+28>>2],V=o[I+72>>2],Z=o[I+32>>2],BA=o[I>>2],o[A+76>>2]=o[I+76>>2]+o[I+36>>2],o[A+72>>2]=V+Z,o[A+68>>2]=d+q,o[(IA=A- -64|0)>>2]=j+X,o[A+60>>2]=K+z,o[A+56>>2]=P+x,o[A+52>>2]=m+L,o[A+48>>2]=b+R,o[A+44>>2]=N+Y,o[(I=A+40|0)>>2]=J+BA,S(g,I),J=o[A+80>>2],N=o[A+4>>2],Y=o[A+84>>2],b=o[A+8>>2],R=o[A+88>>2],L=o[A+12>>2],m=o[A+92>>2],x=o[A+16>>2],P=o[A+96>>2],K=o[A+20>>2],z=o[A+100>>2],X=o[A+24>>2],j=o[A+104>>2],d=o[A+28>>2],q=o[A+108>>2],V=o[A+32>>2],Z=o[A+112>>2],BA=o[A>>2],_=(W=o[A+116>>2])-($=o[A+36>>2])|0,o[A+116>>2]=_,O=Z-V|0,o[A+112>>2]=O,gA=q-d|0,o[A+108>>2]=gA,v=j-X|0,o[A+104>>2]=v,iA=z-K|0,o[A+100>>2]=iA,EA=P-x|0,o[A+96>>2]=EA,oA=m-L|0,o[A+92>>2]=oA,aA=R-b|0,o[A+88>>2]=aA,T=Y-N|0,o[A+84>>2]=T,nA=J-BA|0,o[A+80>>2]=nA,W=W+$|0,o[A+76>>2]=W,V=V+Z|0,o[A+72>>2]=V,d=d+q|0,o[A+68>>2]=d,X=j+X|0,o[IA>>2]=X,K=K+z|0,o[A+60>>2]=K,x=P+x|0,o[A+56>>2]=x,L=m+L|0,o[A+52>>2]=L,b=b+R|0,o[A+48>>2]=b,N=N+Y|0,o[A+44>>2]=N,Y=I,I=J+B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|0)|0,I=v+(N-((I>>>0>J>>>0)+b|0)|0)|0,v=m>>>0>>0?I+1|0:I,d=v=(67108863&(v=(I=m+33554432|0)>>>0<33554432?v+1|0:v))<<6|I>>>26,v=v+(X=BA-(-33554432&_)|0)|0,o[A+20>>2]=v,o[A+16>>2]=m-(-67108864&I),I=DA(C,E,g,t),m=w,v=(d=DA(f,F,O,G))+I|0,I=w+m|0,I=v>>>0>>0?I+1|0:I,m=(d=DA(n,c,h,M))+v|0,v=w+I|0,v=m>>>0>>0?v+1|0:v,I=(d=DA(q,B,D,u))+m|0,m=w+v|0,m=I>>>0>>0?m+1|0:m,d=(v=I)+(I=DA(z,Q,j,T))|0,v=w+m|0,v=(I=I>>>0>d>>>0?v+1|0:v)+(v=L>>26)|0,I=(m=(L=(67108863&L)<<6|R>>>26)+d|0)>>>0>>0?v+1|0:v,I=(v=m+16777216|0)>>>0<16777216?I+1|0:I,o[A+36>>2]=m-(-33554432&v),L=$-(-33554432&QA)|0,d=x-(m=-67108864&K)|0,q=gA-((m>>>0>x>>>0)+P|0)|0,I=DA((33554431&I)<<7|v>>>25,I>>25,19,0),v=w+q|0,I=I>>>0>(m=I+d|0)>>>0?v+1|0:v,d=I=(67108863&(I=(v=m+33554432|0)>>>0<33554432?I+1|0:I))<<6|v>>>26,I=I+L|0,o[A+4>>2]=I,o[A>>2]=m-(-67108864&v)}function H(A,I,g,C,B){var Q,i,n,r,f,t,e,c,y,w,h,s,p,u,k,F=0,l=0,S=0,H=0,M=0,G=0,U=0,J=0,N=0,Y=0,b=0,_=0,K=0,P=0,v=0,m=0,d=0,L=0,R=0,x=0,j=0,X=0,q=0,z=0,V=0,O=0,T=0,W=0,Z=0,$=0,AA=0,IA=0,gA=0,CA=0;for(Q=D+-64|0,i=o[A+60>>2],n=o[A+56>>2],x=o[A+52>>2],R=o[A+48>>2],r=o[A+44>>2],f=o[A+40>>2],t=o[A+36>>2],e=o[A+32>>2],c=o[A+28>>2],y=o[A+24>>2],w=o[A+20>>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|0),8),g=YA((_=g+H|0)^L,7),j=j-2|0;);if(j=a[I+4|0]|a[I+5|0]<<8|a[I+6|0]<<16|a[I+7|0]<<24,L=a[I+8|0]|a[I+9|0]<<8|a[I+10|0]<<16|a[I+11|0]<<24,X=a[I+12|0]|a[I+13|0]<<8|a[I+14|0]<<16|a[I+15|0]<<24,q=a[I+16|0]|a[I+17|0]<<8|a[I+18|0]<<16|a[I+19|0]<<24,z=a[I+20|0]|a[I+21|0]<<8|a[I+22|0]<<16|a[I+23|0]<<24,N=a[I+24|0]|a[I+25|0]<<8|a[I+26|0]<<16|a[I+27|0]<<24,O=a[I+28|0]|a[I+29|0]<<8|a[I+30|0]<<16|a[I+31|0]<<24,T=a[I+32|0]|a[I+33|0]<<8|a[I+34|0]<<16|a[I+35|0]<<24,W=a[I+36|0]|a[I+37|0]<<8|a[I+38|0]<<16|a[I+39|0]<<24,Z=a[I+40|0]|a[I+41|0]<<8|a[I+42|0]<<16|a[I+43|0]<<24,$=a[I+44|0]|a[I+45|0]<<8|a[I+46|0]<<16|a[I+47|0]<<24,AA=a[I+48|0]|a[I+49|0]<<8|a[I+50|0]<<16|a[I+51|0]<<24,IA=a[I+52|0]|a[I+53|0]<<8|a[I+54|0]<<16|a[I+55|0]<<24,gA=a[I+56|0]|a[I+57|0]<<8|a[I+58|0]<<16|a[I+59|0]<<24,CA=a[I+60|0]|a[I+61|0]<<8|a[I+62|0]<<16|a[I+63|0]<<24,l=l+k^(a[0|I]|a[I+1|0]<<8|a[I+2|0]<<16|a[I+3|0]<<24),E[0|F]=l,E[F+1|0]=l>>>8,E[F+2|0]=l>>>16,E[F+3|0]=l>>>24,l=H+i^CA,E[F+60|0]=l,E[F+61|0]=l>>>8,E[F+62|0]=l>>>16,E[F+63|0]=l>>>24,l=d+n^gA,E[F+56|0]=l,E[F+57|0]=l>>>8,E[F+58|0]=l>>>16,E[F+59|0]=l>>>24,l=v+x^IA,E[F+52|0]=l,E[F+53|0]=l>>>8,E[F+54|0]=l>>>16,E[F+55|0]=l>>>24,l=K+R^AA,E[F+48|0]=l,E[F+49|0]=l>>>8,E[F+50|0]=l>>>16,E[F+51|0]=l>>>24,l=J+r^$,E[F+44|0]=l,E[F+45|0]=l>>>8,E[F+46|0]=l>>>16,E[F+47|0]=l>>>24,l=_+f^Z,E[F+40|0]=l,E[F+41|0]=l>>>8,E[F+42|0]=l>>>16,E[F+43|0]=l>>>24,l=m+t^W,E[F+36|0]=l,E[F+37|0]=l>>>8,E[F+38|0]=l>>>16,E[F+39|0]=l>>>24,l=U+e^T,E[F+32|0]=l,E[F+33|0]=l>>>8,E[F+34|0]=l>>>16,E[F+35|0]=l>>>24,G=G+c^O,E[F+28|0]=G,E[F+29|0]=G>>>8,E[F+30|0]=G>>>16,E[F+31|0]=G>>>24,M=N^M+y,E[F+24|0]=M,E[F+25|0]=M>>>8,E[F+26|0]=M>>>16,E[F+27|0]=M>>>24,g=z^g+w,E[F+20|0]=g,E[F+21|0]=g>>>8,E[F+22|0]=g>>>16,E[F+23|0]=g>>>24,g=q^S+h,E[F+16|0]=g,E[F+17|0]=g>>>8,E[F+18|0]=g>>>16,E[F+19|0]=g>>>24,g=X^P+s,E[F+12|0]=g,E[F+13|0]=g>>>8,E[F+14|0]=g>>>16,E[F+15|0]=g>>>24,g=L^b+p,E[F+8|0]=g,E[F+9|0]=g>>>8,E[F+10|0]=g>>>16,E[F+11|0]=g>>>24,g=j^Y+u,E[F+4|0]=g,E[F+5|0]=g>>>8,E[F+6|0]=g>>>16,E[F+7|0]=g>>>24,x=!(R=R+1|0)+x|0,!B&C>>>0<=64){if(!(!C|!B&C>>>0>63|0!=(0|B)))for(S=0;E[S+V|0]=a[F+S|0],C>>>0>(S=S+1|0)>>>0;);o[A+52>>2]=x,o[A+48>>2]=R;break}I=I- -64|0,g=F- -64|0,B=B-1|0,B=(C=C+-64|0)>>>0<4294967232?B+1|0:B}}function M(A,I){var g,C=0,B=0,Q=0,i=0,a=0,n=0,r=0;D=g=D-704|0,C=80+((B=o[A+72>>2]>>>3&127)+A|0)|0,B>>>0<=111?HA(C,34640,112-B|0):(HA(C,34640,128-B|0),p(A,B=A+80|0,g,g+640|0),MA(B,0,112)),n=(Q=o[A+64>>2])<<24|(65280&Q)<<8,B=(i=16711680&Q)>>>8|0,r=i<<24,i=(a=-16777216&Q)>>>24|0,C=r|a<<8|-16777216&((255&(C=o[A+68>>2]))<<24|Q>>>8)|16711680&((16777215&C)<<8|Q>>>24)|C>>>8&65280|C>>>24,E[A+192|0]=C,E[A+193|0]=C>>>8,E[A+194|0]=C>>>16,E[A+195|0]=C>>>24,B=(C=B|i|n)|(B=0)|B|0,E[A+196|0]=B,E[A+197|0]=B>>>8,E[A+198|0]=B>>>16,E[A+199|0]=B>>>24,n=(Q=o[A+72>>2])<<24|(65280&Q)<<8,B=(i=16711680&Q)>>>8|0,r=i<<24,i=(a=-16777216&Q)>>>24|0,C=r|a<<8|-16777216&((255&(C=o[A+76>>2]))<<24|Q>>>8)|16711680&((16777215&C)<<8|Q>>>24)|C>>>8&65280|C>>>24,E[A+200|0]=C,E[A+201|0]=C>>>8,E[A+202|0]=C>>>16,E[A+203|0]=C>>>24,B=(C=B|i|n)|(B=0)|B|0,E[A+204|0]=B,E[A+205|0]=B>>>8,E[A+206|0]=B>>>16,E[A+207|0]=B>>>24,p(A,A+80|0,g,g+640|0),n=(Q=o[A>>2])<<24|(65280&Q)<<8,B=(i=16711680&Q)>>>8|0,r=i<<24,i=(a=-16777216&Q)>>>24|0,C=r|a<<8|-16777216&((255&(C=o[A+4>>2]))<<24|Q>>>8)|16711680&((16777215&C)<<8|Q>>>24)|C>>>8&65280|C>>>24,E[0|I]=C,E[I+1|0]=C>>>8,E[I+2|0]=C>>>16,E[I+3|0]=C>>>24,B=(C=B|i|n)|(B=0)|B|0,E[I+4|0]=B,E[I+5|0]=B>>>8,E[I+6|0]=B>>>16,E[I+7|0]=B>>>24,n=(Q=o[A+8>>2])<<24|(65280&Q)<<8,B=(i=16711680&Q)>>>8|0,r=i<<24,i=(a=-16777216&Q)>>>24|0,C=r|a<<8|-16777216&((255&(C=o[A+12>>2]))<<24|Q>>>8)|16711680&((16777215&C)<<8|Q>>>24)|C>>>8&65280|C>>>24,E[I+8|0]=C,E[I+9|0]=C>>>8,E[I+10|0]=C>>>16,E[I+11|0]=C>>>24,B=(C=B|i|n)|(B=0)|B|0,E[I+12|0]=B,E[I+13|0]=B>>>8,E[I+14|0]=B>>>16,E[I+15|0]=B>>>24,n=(Q=o[A+16>>2])<<24|(65280&Q)<<8,B=(i=16711680&Q)>>>8|0,r=i<<24,i=(a=-16777216&Q)>>>24|0,C=r|a<<8|-16777216&((255&(C=o[A+20>>2]))<<24|Q>>>8)|16711680&((16777215&C)<<8|Q>>>24)|C>>>8&65280|C>>>24,E[I+16|0]=C,E[I+17|0]=C>>>8,E[I+18|0]=C>>>16,E[I+19|0]=C>>>24,B=(C=B|i|n)|(B=0)|B|0,E[I+20|0]=B,E[I+21|0]=B>>>8,E[I+22|0]=B>>>16,E[I+23|0]=B>>>24,n=(Q=o[A+24>>2])<<24|(65280&Q)<<8,B=(i=16711680&Q)>>>8|0,r=i<<24,i=(a=-16777216&Q)>>>24|0,C=r|a<<8|-16777216&((255&(C=o[A+28>>2]))<<24|Q>>>8)|16711680&((16777215&C)<<8|Q>>>24)|C>>>8&65280|C>>>24,E[I+24|0]=C,E[I+25|0]=C>>>8,E[I+26|0]=C>>>16,E[I+27|0]=C>>>24,B=(C=B|i|n)|(B=0)|B|0,E[I+28|0]=B,E[I+29|0]=B>>>8,E[I+30|0]=B>>>16,E[I+31|0]=B>>>24,n=(Q=o[A+32>>2])<<24|(65280&Q)<<8,B=(i=16711680&Q)>>>8|0,r=i<<24,i=(a=-16777216&Q)>>>24|0,C=r|a<<8|-16777216&((255&(C=o[A+36>>2]))<<24|Q>>>8)|16711680&((16777215&C)<<8|Q>>>24)|C>>>8&65280|C>>>24,E[I+32|0]=C,E[I+33|0]=C>>>8,E[I+34|0]=C>>>16,E[I+35|0]=C>>>24,B=(C=B|i|n)|(B=0)|B|0,E[I+36|0]=B,E[I+37|0]=B>>>8,E[I+38|0]=B>>>16,E[I+39|0]=B>>>24,n=(Q=o[A+40>>2])<<24|(65280&Q)<<8,B=(i=16711680&Q)>>>8|0,r=i<<24,i=(a=-16777216&Q)>>>24|0,C=r|a<<8|-16777216&((255&(C=o[A+44>>2]))<<24|Q>>>8)|16711680&((16777215&C)<<8|Q>>>24)|C>>>8&65280|C>>>24,E[I+40|0]=C,E[I+41|0]=C>>>8,E[I+42|0]=C>>>16,E[I+43|0]=C>>>24,B=(C=B|i|n)|(B=0)|B|0,E[I+44|0]=B,E[I+45|0]=B>>>8,E[I+46|0]=B>>>16,E[I+47|0]=B>>>24,n=(Q=o[A+48>>2])<<24|(65280&Q)<<8,B=(i=16711680&Q)>>>8|0,r=i<<24,i=(a=-16777216&Q)>>>24|0,C=r|a<<8|-16777216&((255&(C=o[A+52>>2]))<<24|Q>>>8)|16711680&((16777215&C)<<8|Q>>>24)|C>>>8&65280|C>>>24,E[I+48|0]=C,E[I+49|0]=C>>>8,E[I+50|0]=C>>>16,E[I+51|0]=C>>>24,B=(C=B|i|n)|(B=0)|B|0,E[I+52|0]=B,E[I+53|0]=B>>>8,E[I+54|0]=B>>>16,E[I+55|0]=B>>>24,n=(Q=o[A+56>>2])<<24|(65280&Q)<<8,B=(i=16711680&Q)>>>8|0,C=I,r=i<<24,i=(a=-16777216&Q)>>>24|0,I=r|a<<8|-16777216&((255&(I=o[A+60>>2]))<<24|Q>>>8)|16711680&((16777215&I)<<8|Q>>>24)|I>>>8&65280|I>>>24,E[C+56|0]=I,E[C+57|0]=I>>>8,E[C+58|0]=I>>>16,E[C+59|0]=I>>>24,I=(I=B|i|n)|(B=0)|B|0,E[C+60|0]=I,E[C+61|0]=I>>>8,E[C+62|0]=I>>>16,E[C+63|0]=I>>>24,$A(g,704),$A(A,208),D=g+704|0}function G(A,I,g){var C,B=0,i=0,n=0,r=0,f=0,t=0;D=C=D+-64|0;A:{if((g-65&255)>>>0>191){if(B=-1,!(a[A+80|0]|a[A+81|0]<<8|a[A+82|0]<<16|a[A+83|0]<<24|a[A+84|0]|a[A+85|0]<<8|a[A+86|0]<<16|a[A+87|0]<<24)){if((r=a[A+352|0]|a[A+353|0]<<8|a[A+354|0]<<16|a[A+355|0]<<24)>>>0>=129){if(n=a[0|(B=A- -64|0)]|a[B+1|0]<<8|a[B+2|0]<<16|a[B+3|0]<<24,f=i=a[B+4|0]|a[B+5|0]<<8|a[B+6|0]<<16|a[B+7|0]<<24,i=(r=n+128|0)>>>0<128?i+1|0:i,E[0|B]=r,E[B+1|0]=r>>>8,E[B+2|0]=r>>>16,E[B+3|0]=r>>>24,E[B+4|0]=i,E[B+5|0]=i>>>8,E[B+6|0]=i>>>16,E[B+7|0]=i>>>24,i=a[A+76|0]|a[A+77|0]<<8|a[A+78|0]<<16|a[A+79|0]<<24,i=(B=-1==(0|f)&n>>>0>4294967167)>>>0>(n=B+(a[A+72|0]|a[A+73|0]<<8|a[A+74|0]<<16|a[A+75|0]<<24)|0)>>>0?i+1|0:i,E[A+72|0]=n,E[A+73|0]=n>>>8,E[A+74|0]=n>>>16,E[A+75|0]=n>>>24,E[A+76|0]=i,E[A+77|0]=i>>>8,E[A+78|0]=i>>>16,E[A+79|0]=i>>>24,h(A,i=A+96|0),B=(a[A+352|0]|a[A+353|0]<<8|a[A+354|0]<<16|a[A+355|0]<<24)-128|0,E[A+352|0]=B,E[A+353|0]=B>>>8,E[A+354|0]=B>>>16,E[A+355|0]=B>>>24,B>>>0>=129)break A;HA(i,A+224|0,B),r=a[A+352|0]|a[A+353|0]<<8|a[A+354|0]<<16|a[A+355|0]<<24}i=a[0|(B=A- -64|0)]|a[B+1|0]<<8|a[B+2|0]<<16|a[B+3|0]<<24,n=t=a[B+4|0]|a[B+5|0]<<8|a[B+6|0]<<16|a[B+7|0]<<24,n=(f=i+r|0)>>>0>>0?n+1|0:n,E[0|B]=f,E[B+1|0]=f>>>8,E[B+2|0]=f>>>16,E[B+3|0]=f>>>24,E[B+4|0]=n,E[B+5|0]=n>>>8,E[B+6|0]=n>>>16,E[B+7|0]=n>>>24,B=(0|n)==(0|t)&i>>>0>f>>>0|n>>>0>>0,i=a[A+76|0]|a[A+77|0]<<8|a[A+78|0]<<16|a[A+79|0]<<24,i=(n=B+(a[A+72|0]|a[A+73|0]<<8|a[A+74|0]<<16|a[A+75|0]<<24)|0)>>>0>>0?i+1|0:i,E[A+72|0]=n,E[A+73|0]=n>>>8,E[A+74|0]=n>>>16,E[A+75|0]=n>>>24,E[A+76|0]=i,E[A+77|0]=i>>>8,E[A+78|0]=i>>>16,E[A+79|0]=i>>>24,a[A+356|0]&&(E[A+88|0]=255,E[A+89|0]=255,E[A+90|0]=255,E[A+91|0]=255,E[A+92|0]=255,E[A+93|0]=255,E[A+94|0]=255,E[A+95|0]=255),E[A+80|0]=255,E[A+81|0]=255,E[A+82|0]=255,E[A+83|0]=255,E[A+84|0]=255,E[A+85|0]=255,E[A+86|0]=255,E[A+87|0]=255,MA((B=A+96|0)+r|0,0,256-r|0),h(A,B),i=a[A+4|0]|a[A+5|0]<<8|a[A+6|0]<<16|a[A+7|0]<<24,o[C>>2]=a[0|A]|a[A+1|0]<<8|a[A+2|0]<<16|a[A+3|0]<<24,o[C+4>>2]=i,i=a[A+12|0]|a[A+13|0]<<8|a[A+14|0]<<16|a[A+15|0]<<24,o[C+8>>2]=a[A+8|0]|a[A+9|0]<<8|a[A+10|0]<<16|a[A+11|0]<<24,o[C+12>>2]=i,i=a[A+20|0]|a[A+21|0]<<8|a[A+22|0]<<16|a[A+23|0]<<24,o[C+16>>2]=a[A+16|0]|a[A+17|0]<<8|a[A+18|0]<<16|a[A+19|0]<<24,o[C+20>>2]=i,i=a[A+28|0]|a[A+29|0]<<8|a[A+30|0]<<16|a[A+31|0]<<24,o[C+24>>2]=a[A+24|0]|a[A+25|0]<<8|a[A+26|0]<<16|a[A+27|0]<<24,o[C+28>>2]=i,i=a[A+36|0]|a[A+37|0]<<8|a[A+38|0]<<16|a[A+39|0]<<24,o[C+32>>2]=a[A+32|0]|a[A+33|0]<<8|a[A+34|0]<<16|a[A+35|0]<<24,o[C+36>>2]=i,i=a[A+44|0]|a[A+45|0]<<8|a[A+46|0]<<16|a[A+47|0]<<24,o[C+40>>2]=a[A+40|0]|a[A+41|0]<<8|a[A+42|0]<<16|a[A+43|0]<<24,o[C+44>>2]=i,i=a[A+52|0]|a[A+53|0]<<8|a[A+54|0]<<16|a[A+55|0]<<24,o[C+48>>2]=a[A+48|0]|a[A+49|0]<<8|a[A+50|0]<<16|a[A+51|0]<<24,o[C+52>>2]=i,i=a[A+60|0]|a[A+61|0]<<8|a[A+62|0]<<16|a[A+63|0]<<24,o[C+56>>2]=a[A+56|0]|a[A+57|0]<<8|a[A+58|0]<<16|a[A+59|0]<<24,o[C+60>>2]=i,HA(I,C,g),$A(A,64),$A(B,256),B=0}return D=C- -64|0,B}mA(),Q()}e(1280,1142,306,1086),Q()}function U(A,I){var g,C,B,Q,i,n,r,f,t,e,c,y,w,h,s,p,u=0,k=0,l=0,H=0,M=0,G=0,U=0;for(D=g=D-320|0,P(C=A+40|0,I),o[A+84>>2]=0,o[A+88>>2]=0,o[A+80>>2]=1,o[A+92>>2]=0,o[A+96>>2]=0,o[A+100>>2]=0,o[A+104>>2]=0,o[A+108>>2]=0,o[A+112>>2]=0,o[A+116>>2]=0,S(G=g+240|0,C),F(H=g+192|0,G,1344),U=-1,B=o[g+240>>2]-1|0,o[g+240>>2]=B,o[g+192>>2]=o[g+192>>2]+1,Q=o[g+244>>2],i=o[g+248>>2],n=o[g+252>>2],r=o[g+256>>2],f=o[g+260>>2],t=o[g+264>>2],e=o[g+268>>2],c=o[g+272>>2],y=o[g+276>>2],S(M=g+144|0,H),F(M,M,H),S(A,M),F(A,A,H),F(A,A,G),D=k=D-144|0,S(l=k+96|0,A),S(u=k+48|0,l),S(u,u),F(u,A,u),F(l,l,u),S(l,l),F(l,u,l),S(u,l),S(u,u),S(u,u),S(u,u),S(u,u),F(l,u,l),S(u,l),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),F(u,u,l),S(k,u),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),S(k,k),F(u,k,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),F(l,u,l),S(u,l),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),F(u,u,l),S(k,u),u=1;S(k,k),100!=(0|(u=u+1|0)););F(u=k+48|0,k,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),S(u,u),F(l=k+96|0,u,l),S(l,l),S(l,l),F(A,l,A),D=k+144|0,F(A,A,M),F(A,A,G),S(u=g+96|0,A),F(u,u,H),u=o[g+132>>2],o[g+84>>2]=u-y,k=o[g+128>>2],o[g+80>>2]=k-c,l=o[g+124>>2],o[g+76>>2]=l-e,H=o[g+120>>2],o[g+72>>2]=H-t,M=o[g+116>>2],o[g+68>>2]=M-f,G=o[g+112>>2],o[g+64>>2]=G-r,w=o[g+108>>2],o[g+60>>2]=w-n,h=o[g+104>>2],o[g+56>>2]=h-i,s=o[g+100>>2],o[g+52>>2]=s-Q,p=o[g+96>>2],o[g+48>>2]=p-B,W(g,g+48|0);A:{if(!iA(g,32)){if(o[g+36>>2]=u+y,o[g+32>>2]=k+c,o[g+28>>2]=l+e,o[g+24>>2]=H+t,o[g+20>>2]=M+f,o[g+16>>2]=G+r,o[g+12>>2]=n+w,o[g+8>>2]=i+h,o[g+4>>2]=Q+s,o[g>>2]=B+p,W(u=g+288|0,g),!iA(u,32))break A;F(A,A,1392)}W(g+288|0,A),(1&E[g+288|0])==(a[I+31|0]>>>7|0)&&(o[A>>2]=0-o[A>>2],o[A+36>>2]=0-o[A+36>>2],o[A+32>>2]=0-o[A+32>>2],o[A+28>>2]=0-o[A+28>>2],o[A+24>>2]=0-o[A+24>>2],o[A+20>>2]=0-o[A+20>>2],o[A+16>>2]=0-o[A+16>>2],o[A+12>>2]=0-o[A+12>>2],o[A+8>>2]=0-o[A+8>>2],o[A+4>>2]=0-o[A+4>>2]),F(A+120|0,A,C),U=0}return D=g+320|0,U}function J(A,I,g){var C,B,Q,i,o,n,r,f,t,e,c,y,D=0,w=0,h=0,s=0,p=0,u=0,k=0,F=0,l=0,S=0,H=0,M=0,G=0,U=0,J=0,N=0,Y=0,b=0,_=0,K=0;for(p=1634760805,w=C=a[0|g]|a[g+1|0]<<8|a[g+2|0]<<16|a[g+3|0]<<24,u=B=a[g+4|0]|a[g+5|0]<<8|a[g+6|0]<<16|a[g+7|0]<<24,k=Q=a[g+8|0]|a[g+9|0]<<8|a[g+10|0]<<16|a[g+11|0]<<24,F=i=a[g+12|0]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|0]=D>>>16,E[A+63|0]=D>>>24,D=J+e|0,E[A+56|0]=D,E[A+57|0]=D>>>8,E[A+58|0]=D>>>16,E[A+59|0]=D>>>24,D=G+c|0,E[A+52|0]=D,E[A+53|0]=D>>>8,E[A+54|0]=D>>>16,E[A+55|0]=D>>>24,g=g+y|0,E[A+48|0]=g,E[A+49|0]=g>>>8,E[A+50|0]=g>>>16,E[A+51|0]=g>>>24,g=s+t|0,E[A+44|0]=g,E[A+45|0]=g>>>8,E[A+46|0]=g>>>16,E[A+47|0]=g>>>24,I=I+2036477234|0,E[A+40|0]=I,E[A+41|0]=I>>>8,E[A+42|0]=I>>>16,E[A+43|0]=I>>>24,I=U+f|0,E[A+36|0]=I,E[A+37|0]=I>>>8,E[A+38|0]=I>>>16,E[A+39|0]=I>>>24,I=H+r|0,E[A+32|0]=I,E[A+33|0]=I>>>8,E[A+34|0]=I>>>16,E[A+35|0]=I>>>24,I=h+n|0,E[A+28|0]=I,E[A+29|0]=I>>>8,E[A+30|0]=I>>>16,E[A+31|0]=I>>>24,I=l+o|0,E[A+24|0]=I,E[A+25|0]=I>>>8,E[A+26|0]=I>>>16,E[A+27|0]=I>>>24,I=M+857760878|0,E[A+20|0]=I,E[A+21|0]=I>>>8,E[A+22|0]=I>>>16,E[A+23|0]=I>>>24,I=F+i|0,E[A+16|0]=I,E[A+17|0]=I>>>8,E[A+18|0]=I>>>16,E[A+19|0]=I>>>24,I=k+Q|0,E[A+12|0]=I,E[A+13|0]=I>>>8,E[A+14|0]=I>>>16,E[A+15|0]=I>>>24,I=u+B|0,E[A+8|0]=I,E[A+9|0]=I>>>8,E[A+10|0]=I>>>16,E[A+11|0]=I>>>24,I=w+C|0,E[A+4|0]=I,E[A+5|0]=I>>>8,E[A+6|0]=I>>>16,E[A+7|0]=I>>>24,I=p+1634760805|0,E[0|A]=I,E[A+1|0]=I>>>8,E[A+2|0]=I>>>16,E[A+3|0]=I>>>24}function N(A,I,g,C){var B=0,Q=0,i=0,E=0,n=0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]=y,o[A+24>>2]=t}function Y(A,I,g,C){A|=0,I|=0;var B=0;return B=-1,(C|=0)-65>>>0<4294967232|(g|=0)>>>0>64||(g&&I?(D=B=D-128|0,!I|((C&=255)-65&255)>>>0<=191|((g&=255)-65&255)>>>0<=191?(mA(),Q()):(MA(A- -64|0,0,293),E[A+56|0]=121,E[A+57|0]=33,E[A+58|0]=126,E[A+59|0]=19,E[A+60|0]=25,E[A+61|0]=205,E[A+62|0]=224,E[A+63|0]=91,E[A+48|0]=107,E[A+49|0]=189,E[A+50|0]=65,E[A+51|0]=251,E[A+52|0]=171,E[A+53|0]=217,E[A+54|0]=131,E[A+55|0]=31,E[A+40|0]=31,E[A+41|0]=108,E[A+42|0]=62,E[A+43|0]=43,E[A+44|0]=140,E[A+45|0]=104,E[A+46|0]=5,E[A+47|0]=155,E[A+32|0]=209,E[A+33|0]=130,E[A+34|0]=230,E[A+35|0]=173,E[A+36|0]=127,E[A+37|0]=82,E[A+38|0]=14,E[A+39|0]=81,E[A+24|0]=241,E[A+25|0]=54,E[A+26|0]=29,E[A+27|0]=95,E[A+28|0]=58,E[A+29|0]=245,E[A+30|0]=79,E[A+31|0]=165,E[A+16|0]=43,E[A+17|0]=248,E[A+18|0]=148,E[A+19|0]=254,E[A+20|0]=114,E[A+21|0]=243,E[A+22|0]=110,E[A+23|0]=60,E[A+8|0]=59,E[A+9|0]=167,E[A+10|0]=202,E[A+11|0]=132,E[A+12|0]=133,E[A+13|0]=174,E[A+14|0]=103,E[A+15|0]=187,C=-222443256^(g<<8|C),E[0|A]=C,E[A+1|0]=C>>>8,E[A+2|0]=C>>>16,E[A+3|0]=C>>>24,C=g>>>24^1779033703,E[A+4|0]=C,E[A+5|0]=C>>>8,E[A+6|0]=C>>>16,E[A+7|0]=C>>>24,MA(g+B|0,0,g<<24>>24>=0?128-g|0:0),g=HA(B,I,g),HA(A+96|0,g,128),I=128+(a[A+352|0]|a[A+353|0]<<8|a[A+354|0]<<16|a[A+355|0]<<24)|0,E[A+352|0]=I,E[A+353|0]=I>>>8,E[A+354|0]=I>>>16,E[A+355|0]=I>>>24,$A(g,128),D=g+128|0)):(((I=255&C)-65&255)>>>0<=191&&(mA(),Q()),MA(A- -64|0,0,293),E[A+56|0]=121,E[A+57|0]=33,E[A+58|0]=126,E[A+59|0]=19,E[A+60|0]=25,E[A+61|0]=205,E[A+62|0]=224,E[A+63|0]=91,E[A+48|0]=107,E[A+49|0]=189,E[A+50|0]=65,E[A+51|0]=251,E[A+52|0]=171,E[A+53|0]=217,E[A+54|0]=131,E[A+55|0]=31,E[A+40|0]=31,E[A+41|0]=108,E[A+42|0]=62,E[A+43|0]=43,E[A+44|0]=140,E[A+45|0]=104,E[A+46|0]=5,E[A+47|0]=155,E[A+32|0]=209,E[A+33|0]=130,E[A+34|0]=230,E[A+35|0]=173,E[A+36|0]=127,E[A+37|0]=82,E[A+38|0]=14,E[A+39|0]=81,E[A+24|0]=241,E[A+25|0]=54,E[A+26|0]=29,E[A+27|0]=95,E[A+28|0]=58,E[A+29|0]=245,E[A+30|0]=79,E[A+31|0]=165,E[A+16|0]=43,E[A+17|0]=248,E[A+18|0]=148,E[A+19|0]=254,E[A+20|0]=114,E[A+21|0]=243,E[A+22|0]=110,E[A+23|0]=60,E[A+8|0]=59,E[A+9|0]=167,E[A+10|0]=202,E[A+11|0]=132,E[A+12|0]=133,E[A+13|0]=174,E[A+14|0]=103,E[A+15|0]=187,I^=-222443256,E[0|A]=I,E[A+1|0]=I>>>8,E[A+2|0]=I>>>16,E[A+3|0]=I>>>24,E[A+4|0]=103,E[A+5|0]=230,E[A+6|0]=9,E[A+7|0]=106),B=0),0|B}function b(A,I,g){var C,B,Q,i,E,a,n,r,f,t,e,c=0,y=0,D=0,w=0,h=0,s=0,p=0,u=0,k=0,l=0,S=0,H=0,M=0,G=0,U=0,J=0,N=0,Y=0,b=0;c=o[I+40>>2],y=o[I+4>>2],w=o[I+44>>2],h=o[I+8>>2],s=o[I+48>>2],p=o[I+12>>2],u=o[I+52>>2],k=o[I+16>>2],l=o[I+56>>2],S=o[I+20>>2],H=o[I+60>>2],M=o[I+24>>2],G=o[(D=I- -64|0)>>2],U=o[I+28>>2],J=o[I+68>>2],N=o[I+32>>2],Y=o[I+72>>2],b=o[I>>2],o[A+36>>2]=o[I+36>>2]+o[I+76>>2],o[A+32>>2]=N+Y,o[A+28>>2]=U+J,o[A+24>>2]=M+G,o[A+20>>2]=S+H,o[A+16>>2]=k+l,o[A+12>>2]=p+u,o[A+8>>2]=h+s,o[A+4>>2]=y+w,o[A>>2]=c+b,w=o[I+40>>2],c=o[I+4>>2],h=o[I+44>>2],s=o[I+8>>2],p=o[I+48>>2],u=o[I+12>>2],k=o[I+52>>2],l=o[I+16>>2],S=o[I+56>>2],H=o[I+20>>2],M=o[I+60>>2],G=o[I+24>>2],D=o[D>>2],y=o[I+28>>2],U=o[I+68>>2],J=o[I+32>>2],N=o[I+72>>2],Y=o[I>>2],o[A+76>>2]=o[I+76>>2]-o[I+36>>2],o[A+72>>2]=N-J,o[A+68>>2]=U-y,o[(y=A- -64|0)>>2]=D-G,o[A+60>>2]=M-H,o[A+56>>2]=S-l,o[A+52>>2]=k-u,o[A+48>>2]=p-s,o[A+44>>2]=h-c,o[(c=A+40|0)>>2]=w-Y,F(A+80|0,A,g+40|0),F(c,c,g),F(A+120|0,g+120|0,I+120|0),F(A,I+80|0,g+80|0),b=o[A+4>>2],Q=o[A+8>>2],i=o[A+12>>2],E=o[A+16>>2],a=o[A+20>>2],n=o[A+24>>2],r=o[A+28>>2],f=o[A+32>>2],t=o[A+36>>2],I=o[c>>2],g=o[A+80>>2],w=o[A+44>>2],h=o[A+84>>2],s=o[A+48>>2],p=o[A+88>>2],u=o[A+52>>2],k=o[A+92>>2],l=o[A+56>>2],S=o[A+96>>2],H=o[A+60>>2],M=o[A+100>>2],D=o[y>>2],G=o[A+104>>2],U=o[A+68>>2],J=o[A+108>>2],N=o[A+72>>2],Y=o[A+112>>2],e=o[A>>2],C=o[A+76>>2],B=o[A+116>>2],o[A+76>>2]=C+B,o[A+72>>2]=N+Y,o[A+68>>2]=U+J,o[y>>2]=D+G,o[A+60>>2]=H+M,o[A+56>>2]=l+S,o[A+52>>2]=u+k,o[A+48>>2]=s+p,o[A+44>>2]=w+h,o[c>>2]=I+g,o[A+36>>2]=B-C,o[A+32>>2]=Y-N,o[A+28>>2]=J-U,o[A+24>>2]=G-D,o[A+20>>2]=M-H,o[A+16>>2]=S-l,o[A+12>>2]=k-u,o[A+8>>2]=p-s,o[A+4>>2]=h-w,o[A>>2]=g-I,I=o[A+156>>2],g=t<<1,o[A+156>>2]=I+g,c=o[A+152>>2],y=f<<1,o[A+152>>2]=c+y,w=o[A+148>>2],h=r<<1,o[A+148>>2]=w+h,s=o[A+144>>2],p=n<<1,o[A+144>>2]=s+p,u=o[A+140>>2],k=a<<1,o[A+140>>2]=u+k,l=o[A+136>>2],S=E<<1,o[A+136>>2]=l+S,H=o[A+132>>2],M=i<<1,o[A+132>>2]=H+M,D=o[A+128>>2],G=Q<<1,o[A+128>>2]=D+G,U=o[A+124>>2],J=b<<1,o[A+124>>2]=U+J,N=o[A+120>>2],Y=e<<1,o[A+120>>2]=N+Y,o[A+112>>2]=y-c,o[A+108>>2]=h-w,o[A+104>>2]=p-s,o[A+100>>2]=k-u,o[A+96>>2]=S-l,o[A+92>>2]=M-H,o[A+88>>2]=G-D,o[A+84>>2]=J-U,o[A+80>>2]=Y-N,o[A+116>>2]=g-I}function _(A,I,g){var C,B,Q,i,E,a,n,r,f,t,e,c=0,y=0,D=0,w=0,h=0,s=0,p=0,u=0,k=0,l=0,S=0,H=0,M=0,G=0,U=0,J=0,N=0,Y=0,b=0;c=o[I+40>>2],y=o[I+4>>2],w=o[I+44>>2],h=o[I+8>>2],s=o[I+48>>2],p=o[I+12>>2],u=o[I+52>>2],k=o[I+16>>2],l=o[I+56>>2],S=o[I+20>>2],H=o[I+60>>2],M=o[I+24>>2],G=o[(D=I- -64|0)>>2],U=o[I+28>>2],J=o[I+68>>2],N=o[I+32>>2],Y=o[I+72>>2],b=o[I>>2],o[A+36>>2]=o[I+36>>2]+o[I+76>>2],o[A+32>>2]=N+Y,o[A+28>>2]=U+J,o[A+24>>2]=M+G,o[A+20>>2]=S+H,o[A+16>>2]=k+l,o[A+12>>2]=p+u,o[A+8>>2]=h+s,o[A+4>>2]=y+w,o[A>>2]=c+b,w=o[I+40>>2],c=o[I+4>>2],h=o[I+44>>2],s=o[I+8>>2],p=o[I+48>>2],u=o[I+12>>2],k=o[I+52>>2],l=o[I+16>>2],S=o[I+56>>2],H=o[I+20>>2],M=o[I+60>>2],G=o[I+24>>2],D=o[D>>2],y=o[I+28>>2],U=o[I+68>>2],J=o[I+32>>2],N=o[I+72>>2],Y=o[I>>2],o[A+76>>2]=o[I+76>>2]-o[I+36>>2],o[A+72>>2]=N-J,o[A+68>>2]=U-y,o[(y=A- -64|0)>>2]=D-G,o[A+60>>2]=M-H,o[A+56>>2]=S-l,o[A+52>>2]=k-u,o[A+48>>2]=p-s,o[A+44>>2]=h-c,o[(c=A+40|0)>>2]=w-Y,F(A+80|0,A,g),F(c,c,g+40|0),F(A+120|0,g+120|0,I+120|0),F(A,I+80|0,g+80|0),b=o[A+4>>2],Q=o[A+8>>2],i=o[A+12>>2],E=o[A+16>>2],a=o[A+20>>2],n=o[A+24>>2],r=o[A+28>>2],f=o[A+32>>2],t=o[A+36>>2],I=o[c>>2],g=o[A+80>>2],w=o[A+44>>2],h=o[A+84>>2],s=o[A+48>>2],p=o[A+88>>2],u=o[A+52>>2],k=o[A+92>>2],l=o[A+56>>2],S=o[A+96>>2],H=o[A+60>>2],M=o[A+100>>2],D=o[y>>2],G=o[A+104>>2],U=o[A+68>>2],J=o[A+108>>2],N=o[A+72>>2],Y=o[A+112>>2],e=o[A>>2],C=o[A+76>>2],B=o[A+116>>2],o[A+76>>2]=C+B,o[A+72>>2]=N+Y,o[A+68>>2]=U+J,o[y>>2]=D+G,o[A+60>>2]=H+M,o[A+56>>2]=l+S,o[A+52>>2]=u+k,o[A+48>>2]=s+p,o[A+44>>2]=w+h,o[c>>2]=I+g,o[A+36>>2]=B-C,o[A+32>>2]=Y-N,o[A+28>>2]=J-U,o[A+24>>2]=G-D,o[A+20>>2]=M-H,o[A+16>>2]=S-l,o[A+12>>2]=k-u,o[A+8>>2]=p-s,o[A+4>>2]=h-w,o[A>>2]=g-I,I=t<<1,g=o[A+156>>2],o[A+156>>2]=I-g,c=f<<1,y=o[A+152>>2],o[A+152>>2]=c-y,w=r<<1,h=o[A+148>>2],o[A+148>>2]=w-h,s=n<<1,p=o[A+144>>2],o[A+144>>2]=s-p,u=a<<1,k=o[A+140>>2],o[A+140>>2]=u-k,l=E<<1,S=o[A+136>>2],o[A+136>>2]=l-S,H=i<<1,M=o[A+132>>2],o[A+132>>2]=H-M,D=Q<<1,G=o[A+128>>2],o[A+128>>2]=D-G,U=b<<1,J=o[A+124>>2],o[A+124>>2]=U-J,N=e<<1,Y=o[A+120>>2],o[A+120>>2]=N-Y,o[A+112>>2]=c+y,o[A+108>>2]=w+h,o[A+104>>2]=s+p,o[A+100>>2]=u+k,o[A+96>>2]=l+S,o[A+92>>2]=H+M,o[A+88>>2]=D+G,o[A+84>>2]=U+J,o[A+80>>2]=N+Y,o[A+116>>2]=I+g}function K(A,I,g){var C,B,Q,i,E,a,n,r,f,t,e,c=0,y=0,D=0,w=0,h=0,s=0,p=0,u=0,k=0,l=0,S=0,H=0,M=0,G=0,U=0,J=0,N=0,Y=0,b=0;c=o[I+40>>2],y=o[I+4>>2],w=o[I+44>>2],h=o[I+8>>2],s=o[I+48>>2],p=o[I+12>>2],u=o[I+52>>2],k=o[I+16>>2],l=o[I+56>>2],S=o[I+20>>2],H=o[I+60>>2],M=o[I+24>>2],G=o[(D=I- -64|0)>>2],U=o[I+28>>2],J=o[I+68>>2],N=o[I+32>>2],Y=o[I+72>>2],b=o[I>>2],o[A+36>>2]=o[I+36>>2]+o[I+76>>2],o[A+32>>2]=N+Y,o[A+28>>2]=U+J,o[A+24>>2]=M+G,o[A+20>>2]=S+H,o[A+16>>2]=k+l,o[A+12>>2]=p+u,o[A+8>>2]=h+s,o[A+4>>2]=y+w,o[A>>2]=c+b,w=o[I+40>>2],c=o[I+4>>2],h=o[I+44>>2],s=o[I+8>>2],p=o[I+48>>2],u=o[I+12>>2],k=o[I+52>>2],l=o[I+16>>2],S=o[I+56>>2],H=o[I+20>>2],M=o[I+60>>2],G=o[I+24>>2],D=o[D>>2],y=o[I+28>>2],U=o[I+68>>2],J=o[I+32>>2],N=o[I+72>>2],Y=o[I>>2],o[A+76>>2]=o[I+76>>2]-o[I+36>>2],o[A+72>>2]=N-J,o[A+68>>2]=U-y,o[(y=A- -64|0)>>2]=D-G,o[A+60>>2]=M-H,o[A+56>>2]=S-l,o[A+52>>2]=k-u,o[A+48>>2]=p-s,o[A+44>>2]=h-c,o[(c=A+40|0)>>2]=w-Y,F(A+80|0,A,g),F(c,c,g+40|0),F(A+120|0,g+80|0,I+120|0),b=o[I+80>>2],Q=o[I+84>>2],i=o[I+88>>2],E=o[I+92>>2],a=o[I+96>>2],n=o[I+100>>2],r=o[I+104>>2],f=o[I+108>>2],t=o[I+112>>2],e=o[I+116>>2],I=o[c>>2],g=o[A+80>>2],w=o[A+44>>2],h=o[A+84>>2],s=o[A+48>>2],p=o[A+88>>2],u=o[A+52>>2],k=o[A+92>>2],l=o[A+56>>2],S=o[A+96>>2],H=o[A+60>>2],M=o[A+100>>2],D=o[y>>2],G=o[A+104>>2],U=o[A+68>>2],J=o[A+108>>2],N=o[A+72>>2],Y=o[A+112>>2],C=o[A+76>>2],B=o[A+116>>2],o[A+76>>2]=C+B,o[A+72>>2]=N+Y,o[A+68>>2]=U+J,o[y>>2]=D+G,o[A+60>>2]=H+M,o[A+56>>2]=l+S,o[A+52>>2]=u+k,o[A+48>>2]=s+p,o[A+44>>2]=w+h,o[c>>2]=I+g,o[A+36>>2]=B-C,o[A+32>>2]=Y-N,o[A+28>>2]=J-U,o[A+24>>2]=G-D,o[A+20>>2]=M-H,o[A+16>>2]=S-l,o[A+12>>2]=k-u,o[A+8>>2]=p-s,o[A+4>>2]=h-w,o[A>>2]=g-I,I=e<<1,g=o[A+156>>2],o[A+156>>2]=I-g,c=t<<1,y=o[A+152>>2],o[A+152>>2]=c-y,w=f<<1,h=o[A+148>>2],o[A+148>>2]=w-h,s=r<<1,p=o[A+144>>2],o[A+144>>2]=s-p,u=n<<1,k=o[A+140>>2],o[A+140>>2]=u-k,l=a<<1,S=o[A+136>>2],o[A+136>>2]=l-S,H=E<<1,M=o[A+132>>2],o[A+132>>2]=H-M,D=i<<1,G=o[A+128>>2],o[A+128>>2]=D-G,U=Q<<1,J=o[A+124>>2],o[A+124>>2]=U-J,N=b<<1,Y=o[A+120>>2],o[A+120>>2]=N-Y,o[A+112>>2]=c+y,o[A+108>>2]=w+h,o[A+104>>2]=s+p,o[A+100>>2]=u+k,o[A+96>>2]=l+S,o[A+92>>2]=H+M,o[A+88>>2]=D+G,o[A+84>>2]=U+J,o[A+80>>2]=N+Y,o[A+116>>2]=I+g}function P(A,I){var g,C,B,Q,i,E,n,r,f,t,e,c,y,D=0,h=0,s=0,p=0,u=0,k=0,F=0,l=0,S=0,H=0,M=0,G=0,U=0,J=0;c=a[I+31|0],g=a[I+30|0],C=a[I+29|0],B=a[I+6|0],Q=a[I+5|0],i=a[I+4|0],E=a[I+9|0],n=a[I+8|0],r=a[I+7|0],H=a[I+12|0],M=a[I+11|0],f=a[I+10|0],t=a[I+15|0],G=a[I+14|0],e=a[I+13|0],F=a[I+28|0],S=a[I+27|0],l=a[I+26|0],k=a[I+25|0],p=a[I+24|0],s=a[I+23|0],y=a[0|I]|a[I+1|0]<<8|a[I+2|0]<<16|a[I+3|0]<<24,u=(D=a[I+21|0])<<15,D=h=D>>>17|0,J=u,h=(u=a[I+20|0])>>>25|0,u=J|u<<7,U=D|h,D=(h=a[I+22|0])>>>9|0,u|=h<<23,D|=U,h=a[I+16|0]|a[I+17|0]<<8|a[I+18|0]<<16|a[I+19|0]<<24,I=0,J=h,h=(33554431&(I=(U=h+16777216|0)>>>0<16777216?1:I))<<7|U>>>25,I=(I>>>25|0)+D|0,h=(D=u=h+u|0)>>>0>>0?I+1|0:I,I=(u=D+33554432|0)>>>0<33554432?h+1|0:h,o[A+24>>2]=D-(-67108864&u),h=(D=s>>>27|0)|p>>>19|k>>>11,D=s=(p=k<<21|(s=p<<13|s<<5))+(D=(67108863&(D=I))<<6|u>>>26)|0,I=h,h=(s=p+16777216|0)>>>0<16777216?I+1|0:I,o[A+28>>2]=D-(1040187392&s),D=(D=S>>>20|l>>>28|F>>>12)+(h=(I=h)>>>25|0)|0,I=(h=s=(I=(33554431&I)<<7|s>>>25)+(S<<12|l<<4|F<<20)|0)>>>0>>0?D+1|0:D,s=(F=h+33554432|0)>>>0<33554432?I+1|0:I,o[A+32>>2]=h-(-67108864&F),D=(I=H>>>13|0)|(h=M>>>21|f>>>29),I=(D=(S=16777216+(H=M<<11|f<<3|H<<19)|0)>>>0<16777216?D+1|0:D)>>>25|0,D=(h=p=G<<10|e<<2|t<<18)+(p=(33554431&D)<<7|S>>>25)|0,h=I+(k=G>>>22|e>>>30|t>>>14)|0,I=D>>>0

>>0?h+1|0:h,p=I=(67108863&(I=(h=D+33554432|0)>>>0<33554432?I+1|0:I))<<6|h>>>26,I=I+(l=J-(-33554432&U)|0)|0,o[A+20>>2]=I,o[A+16>>2]=D-(-67108864&h),h=Q>>>18|i>>>26|B>>>10,D=(h=(l=16777216+(M=Q<<14|i<<6|B<<22)|0)>>>0<16777216?h+1|0:h)>>>25|0,h=(I=p=n<<13|r<<5|E<<21)+(p=(33554431&h)<<7|l>>>25)|0,I=D+(k=n>>>19|r>>>27|E>>>11)|0,I=h>>>0

>>0?I+1|0:I,D=(k=h+33554432|0)>>>0<33554432?I+1|0:I,o[A+8>>2]=h-(-67108864&k),F=(s=(67108863&s)<<6|F>>>26)+(G=c<<18&33292288|g<<10|C<<2)|0,I=h=g>>>22|C>>>30,h=(s=G+16777216|0)>>>0<16777216?I+1|0:I,o[A+36>>2]=F-(33554432&s),D=H+((67108863&D)<<6|k>>>26)|0,o[A+12>>2]=D-(234881024&S),p=M-(2113929216&l)|0,D=DA((33554431&(I=h))<<7|s>>>25,h=I>>>25|0,19,0),I=w,D=D>>>0>(h=D+y|0)>>>0?I+1|0:I,s=D=(67108863&(D=(I=h+33554432|0)>>>0<33554432?D+1|0:D))<<6|I>>>26,D=D+p|0,o[A+4>>2]=D,o[A>>2]=h-(-67108864&I)}function v(A,I){var g,C,B,Q=0,i=0,n=0,r=0,f=0,t=0,e=0,c=0,y=0,w=0,h=0,s=0;for(D=g=D-480|0;i=(n=g+288|0)+(Q<<1)|0,c=a[I+Q|0],E[i+1|0]=c>>>4,E[0|i]=15&c,n=n+((i=1|Q)<<1)|0,i=a[I+i|0],E[n+1|0]=i>>>4,E[0|n]=15&i,32!=(0|(Q=Q+2|0)););for(I=0;Q=8+(n=(Q=I)+a[0|(I=(g+288|0)+r|0)]|0)|0,E[0|I]=n-(240&Q),Q=8+(n=a[I+1|0]+(Q<<24>>24>>4)|0)|0,E[I+1|0]=n-(240&Q),Q=8+(n=a[I+2|0]+(Q<<24>>24>>4)|0)|0,E[I+2|0]=n-(240&Q),I=Q<<24>>24>>4,63!=(0|(r=r+3|0)););for(E[g+351|0]=a[g+351|0]+I,o[A+32>>2]=0,o[A+36>>2]=0,o[A+24>>2]=0,o[A+28>>2]=0,o[A+16>>2]=0,o[A+20>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0,o[A>>2]=0,o[A+4>>2]=0,o[A+44>>2]=0,o[A+48>>2]=0,o[(c=A+40|0)>>2]=1,o[A+52>>2]=0,o[A+56>>2]=0,o[A+60>>2]=0,o[A+64>>2]=0,o[A+68>>2]=0,o[A+72>>2]=0,o[A+76>>2]=0,o[A+80>>2]=1,MA(A+84|0,0,76),C=A+120|0,B=A+80|0,I=g+208|0,n=g+168|0,r=g+248|0,Q=1;q(f=g+8|0,Q>>>1|0,E[(g+288|0)+Q|0]),K(i=g+128|0,A,f),F(A,i,r),F(c,n,I),F(B,I,r),F(C,i,n),i=Q>>>0<62,Q=Q+2|0,i;);for(Q=o[A+8>>2],i=o[A+12>>2],f=o[A+16>>2],t=o[A+20>>2],y=o[A+24>>2],w=o[A+28>>2],e=o[A>>2],h=o[A+4>>2],s=o[A+36>>2],o[g+392>>2]=o[A+32>>2],o[g+396>>2]=s,o[g+384>>2]=y,o[g+388>>2]=w,o[g+376>>2]=f,o[g+380>>2]=t,o[g+368>>2]=Q,o[g+372>>2]=i,o[g+360>>2]=e,o[g+364>>2]=h,Q=o[A+40>>2],i=o[A+44>>2],f=o[A+48>>2],t=o[A+52>>2],y=o[A+56>>2],w=o[A+60>>2],h=o[(e=A- -64|0)>>2],e=o[e+4>>2],s=o[A+76>>2],o[g+432>>2]=o[A+72>>2],o[g+436>>2]=s,o[g+424>>2]=h,o[g+428>>2]=e,o[g+416>>2]=y,o[g+420>>2]=w,o[g+408>>2]=f,o[g+412>>2]=t,o[g+400>>2]=Q,o[g+404>>2]=i,Q=o[A+80>>2],i=o[A+84>>2],f=o[A+88>>2],t=o[A+92>>2],y=o[A+96>>2],w=o[A+100>>2],e=o[A+104>>2],h=o[A+108>>2],s=o[A+116>>2],o[g+472>>2]=o[A+112>>2],o[g+476>>2]=s,o[g+464>>2]=e,o[g+468>>2]=h,o[g+456>>2]=y,o[g+460>>2]=w,o[g+448>>2]=f,o[g+452>>2]=t,o[g+440>>2]=Q,o[g+444>>2]=i,l(Q=g+128|0,i=g+360|0),F(i,Q,r),F(f=g+400|0,n,I),F(t=g+440|0,I,r),l(Q,i),F(i,Q,r),F(f,n,I),F(t,I,r),l(Q,i),F(i,Q,r),F(f,n,I),F(t,I,r),l(Q,i),F(A,Q,r),F(c,n,I),F(B,I,r),F(C,Q,n),Q=0;q(f=g+8|0,Q>>>1|0,E[(g+288|0)+Q|0]),K(i=g+128|0,A,f),F(A,i,r),F(c,n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<<16|a[I+7|0]<<24,e=a[g+28|0]|a[g+29|0]<<8|a[g+30|0]<<16|a[g+31|0]<<24,r=a[g+24|0]|a[g+25|0]<<8|a[g+26|0]<<16|a[g+27|0]<<24,p=a[g+20|0]|a[g+21|0]<<8|a[g+22|0]<<16|a[g+23|0]<<24,c=a[g+16|0]|a[g+17|0]<<8|a[g+18|0]<<16|a[g+19|0]<<24,y=a[g+12|0]|a[g+13|0]<<8|a[g+14|0]<<16|a[g+15|0]<<24,D=a[g+8|0]|a[g+9|0]<<8|a[g+10|0]<<16|a[g+11|0]<<24,w=a[g+4|0]|a[g+5|0]<<8|a[g+6|0]<<16|a[g+7|0]<<24,I=a[0|I]|a[I+1|0]<<8|a[I+2|0]<<16|a[I+3|0]<<24,g=a[0|g]|a[g+1|0]<<8|a[g+2|0]<<16|a[g+3|0]<<24;f=g,g=YA((h=I)^(I=g+C|0),16),f=c=YA(f^(C=g+c|0),12),u=YA((h=I+c|0)^g,8),I=YA(f^(c=u+C|0),7),C=y,y=YA((g=n+y|0)^Q,16),C=YA(C^(e=y+e|0),12),Q=D,n=YA((B=B+D|0)^t,16),Q=YA(Q^(D=n+r|0),12),r=YA((B=Q+B|0)^n,8),g=YA(r^(n=I+(s=g+C|0)|0),16),t=YA((i=i+w|0)^o,16),w=YA((o=t+p|0)^w,12),f=I,I=YA((i=i+w|0)^t,8),f=YA(f^(o=g+(k=I+o|0)|0),12),t=YA(g^(n=f+n|0),8),g=YA((p=t+o|0)^f,7),f=B,B=C,s=YA(y^s,8),B=YA(B^(C=s+e|0),7),y=YA((o=f+B|0)^I,16),e=YA((I=y+c|0)^B,12),o=YA(y^(B=e+o|0),8),y=YA((c=I+o|0)^e,7),I=YA((I=Q)^(Q=r+D|0),7),D=YA((i=I+i|0)^u,16),r=YA(I^(C=D+C|0),12),I=YA(D^(i=r+i|0),8),D=YA((e=C+I|0)^r,7),f=Q,C=YA(w^k,7),r=YA((Q=C+h|0)^s,16),h=YA(C^(w=f+r|0),12),Q=YA(r^(C=h+Q|0),8),w=YA((r=w+Q|0)^h,7),10!=(0|(F=F+1|0)););E[0|A]=C,E[A+1|0]=C>>>8,E[A+2|0]=C>>>16,E[A+3|0]=C>>>24,E[A+28|0]=Q,E[A+29|0]=Q>>>8,E[A+30|0]=Q>>>16,E[A+31|0]=Q>>>24,E[A+24|0]=t,E[A+25|0]=t>>>8,E[A+26|0]=t>>>16,E[A+27|0]=t>>>24,E[A+20|0]=o,E[A+21|0]=o>>>8,E[A+22|0]=o>>>16,E[A+23|0]=o>>>24,E[A+16|0]=I,E[A+17|0]=I>>>8,E[A+18|0]=I>>>16,E[A+19|0]=I>>>24,E[A+12|0]=n,E[A+13|0]=n>>>8,E[A+14|0]=n>>>16,E[A+15|0]=n>>>24,E[A+8|0]=B,E[A+9|0]=B>>>8,E[A+10|0]=B>>>16,E[A+11|0]=B>>>24,E[A+4|0]=i,E[A+5|0]=i>>>8,E[A+6|0]=i>>>16,E[A+7|0]=i>>>24}function L(A,I,g){var C=0,B=0,Q=0,i=0,o=0,n=0,r=0,f=0,t=0,e=0,c=0,y=0,D=0,w=0,h=0,s=0,p=0,u=0,k=0,F=0;for(C=1797285236,r=2036477234,f=857760878,B=1634760805,Q=a[I+12|0]|a[I+13|0]<<8|a[I+14|0]<<16|a[I+15|0]<<24,o=a[I+8|0]|a[I+9|0]<<8|a[I+10|0]<<16|a[I+11|0]<<24,i=a[I+4|0]|a[I+5|0]<<8|a[I+6|0]<<16|a[I+7|0]<<24,h=a[g+28|0]|a[g+29|0]<<8|a[g+30|0]<<16|a[g+31|0]<<24,w=a[g+24|0]|a[g+25|0]<<8|a[g+26|0]<<16|a[g+27|0]<<24,s=20,y=a[g+20|0]|a[g+21|0]<<8|a[g+22|0]<<16|a[g+23|0]<<24,D=a[g+16|0]|a[g+17|0]<<8|a[g+18|0]<<16|a[g+19|0]<<24,t=a[g+12|0]|a[g+13|0]<<8|a[g+14|0]<<16|a[g+15|0]<<24,e=a[g+8|0]|a[g+9|0]<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>16,E[A+15|0]=C>>>24,E[A+8|0]=r,E[A+9|0]=r>>>8,E[A+10|0]=r>>>16,E[A+11|0]=r>>>24,E[A+4|0]=f,E[A+5|0]=f>>>8,E[A+6|0]=f>>>16,E[A+7|0]=f>>>24,0}function R(A,I,g,C,B,i,E){var a=0,n=0,r=0,f=0,t=0,e=0,c=0;if(I-65>>>0<4294967232|E>>>0>64)A=-1;else{e=a=D,D=a=a-512&-64;A:{I:if(!(!(!(C|B)|g)|!A|((n=255&I)-65&255)>>>0<=191|!(!(I=255&E)||i)|I>>>0>=65)){if(I){if(!i)break I;MA(a- -64|0,0,293),o[a+56>>2]=327033209,o[a+60>>2]=1541459225,o[a+48>>2]=-79577749,o[a+52>>2]=528734635,o[a+40>>2]=725511199,o[a+44>>2]=-1694144372,o[a+32>>2]=-1377402159,o[a+36>>2]=1359893119,o[a+24>>2]=1595750129,o[a+28>>2]=-1521486534,o[a+16>>2]=-23791573,o[a+20>>2]=1013904242,o[a+8>>2]=-2067093701,o[a+12>>2]=-1150833019,o[a>>2]=-222443256^(I<<8|n),o[a+4>>2]=I>>>24^1779033703,MA((E=a+384|0)+I|0,0,128-I|0),HA(E,i,I),HA(a+96|0,E,128),o[a+352>>2]=128,$A(E,128),I=128}else MA(a- -64|0,0,293),o[a+56>>2]=327033209,o[a+60>>2]=1541459225,o[a+48>>2]=-79577749,o[a+52>>2]=528734635,o[a+40>>2]=725511199,o[a+44>>2]=-1694144372,o[a+32>>2]=-1377402159,o[a+36>>2]=1359893119,o[a+24>>2]=1595750129,o[a+28>>2]=-1521486534,o[a+16>>2]=-23791573,o[a+20>>2]=1013904242,o[a+8>>2]=-2067093701,o[a+12>>2]=-1150833019,o[a>>2]=-222443256^n,o[a+4>>2]=1779033703,I=0;g:if(C|B)for(c=a+224|0,r=a+96|0;;){if(E=I+r|0,!B&C>>>0<=(i=256-I|0)>>>0){HA(E,g,C),o[a+352>>2]=C+o[a+352>>2];break g}if(HA(E,g,i),o[a+352>>2]=i+o[a+352>>2],f=I=o[a+68>>2],I=(t=(E=o[a+64>>2])+128|0)>>>0<128?I+1|0:I,o[a+64>>2]=t,o[a+68>>2]=I,I=o[a+76>>2],I=(f=E=-1==(0|f)&E>>>0>4294967167)>>>0>(E=E+o[a+72>>2]|0)>>>0?I+1|0:I,o[a+72>>2]=E,o[a+76>>2]=I,h(a,r),HA(r,c,128),I=o[a+352>>2]-128|0,o[a+352>>2]=I,g=g+i|0,!((B=B-(C>>>0>>0)|0)|(C=C-i|0)))break}G(a,A,n),D=e;break A}mA(),Q()}A=0}return A}function x(A,I,g,C){var B=0,Q=0,i=0,n=0,r=0,f=0,t=0,e=0,c=0,y=0,D=0,w=0;A:{if((i=o[A+56>>2])|(B=o[A+60>>2])){if(c=Q=16-i|0,r=(Q=(0|(n=0-((i>>>0>16)+B|0)|0))==(0|C)&g>>>0>Q>>>0|C>>>0>n>>>0)?c:g,c=Q=Q?n:C,Q|r){if(Q=0,i=0,!c&r>>>0>=4|c)for(f=-4&r,n=A- -64|0;B=Q+o[A+56>>2]|0,E[B+n|0]=a[I+Q|0],B=(y=1|Q)+o[A+56>>2]|0,E[B+n|0]=a[I+y|0],B=(y=2|Q)+o[A+56>>2]|0,E[B+n|0]=a[I+y|0],B=(y=3|Q)+o[A+56>>2]|0,E[B+n|0]=a[I+y|0],B=i,i=(Q=Q+4|0)>>>0<4?B+1|0:B,B=t,t=B=(e=e+4|0)>>>0<4?B+1|0:B,(0|e)!=(0|f)|(0|c)!=(0|B););if(n=B=0,B|(t=3&r))for(;e=Q+o[A+56>>2]|0,E[(A+e|0)- -64|0]=a[I+Q|0],i=(Q=Q+1|0)?i:i+1|0,B=w,w=B=(D=D+1|0)?B:B+1|0,(0|t)!=(0|D)|(0|n)!=(0|B););i=o[A+56>>2],B=o[A+60>>2]}if(B=B+c|0,B=(i=i+r|0)>>>0>>0?B+1|0:B,o[A+56>>2]=i,o[A+60>>2]=B,!B&i>>>0<16)break A;N(A,A- -64|0,16,0),o[A+56>>2]=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n^p),o[A+20>>2]=a^g&(a^s),o[A+16>>2]=E^g&(E^h),o[A+12>>2]=i^g&(i^w),o[A+8>>2]=Q^g&(Q^D),o[A+4>>2]=B^g&(B^y),B=o[A+40>>2],y=o[I+40>>2],Q=o[A+44>>2],D=o[I+44>>2],i=o[A+48>>2],w=o[I+48>>2],E=o[A+52>>2],h=o[I+52>>2],a=o[A+56>>2],s=o[I+56>>2],n=o[A+60>>2],p=o[I+60>>2],r=o[(e=A- -64|0)>>2],u=o[I- -64>>2],f=o[A+68>>2],k=o[I+68>>2],t=o[A+72>>2],c=o[I+72>>2],C=o[A+76>>2],o[A+76>>2]=C^g&(o[I+76>>2]^C),o[A+72>>2]=t^g&(t^c),o[A+68>>2]=f^g&(f^k),o[e>>2]=r^g&(r^u),o[A+60>>2]=n^g&(n^p),o[A+56>>2]=a^g&(a^s),o[A+52>>2]=E^g&(E^h),o[A+48>>2]=i^g&(i^w),o[A+44>>2]=Q^g&(Q^D),o[A+40>>2]=B^g&(B^y),B=o[A+80>>2],y=o[I+80>>2],Q=o[A+84>>2],D=o[I+84>>2],i=o[A+88>>2],w=o[I+88>>2],E=o[A+92>>2],h=o[I+92>>2],a=o[A+96>>2],s=o[I+96>>2],n=o[A+100>>2],p=o[I+100>>2],r=o[A+104>>2],e=o[I+104>>2],f=o[A+108>>2],u=o[I+108>>2],t=o[A+112>>2],k=o[I+112>>2],c=o[I+116>>2],I=o[A+116>>2],o[A+116>>2]=g&(c^I)^I,o[A+112>>2]=t^g&(t^k),o[A+108>>2]=f^g&(f^u),o[A+104>>2]=r^g&(r^e),o[A+100>>2]=n^g&(n^p),o[A+96>>2]=a^g&(a^s),o[A+92>>2]=E^g&(E^h),o[A+88>>2]=i^g&(i^w),o[A+84>>2]=Q^g&(Q^D),o[A+80>>2]=B^g&(B^y)}function X(A,I){var g,C,B=0;for(D=g=D-192|0,S(C=g+144|0,I),S(B=g+96|0,C),S(B,B),F(B,I,B),F(C,C,B),S(I=g+48|0,C),F(B,B,I),S(I,B),S(I,I),S(I,I),S(I,I),S(I,I),F(B,I,B),S(I,B),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),F(I,I,B),S(g,I),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),S(g,g),F(I,g,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),F(B,I,B),S(I,B),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),F(I,I,B),S(g,I),I=1;S(g,g),100!=(0|(I=I+1|0)););F(I=g+48|0,g,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),S(I,I),F(B=g+96|0,I,B),S(B,B),S(B,B),S(B,B),S(B,B),S(B,B),F(A,B,g+144|0),D=g+192|0}function q(A,I,g){var C,B=0,Q=0,i=0,E=0,a=0,n=0,f=0,t=0;D=C=D-128|0,o[A>>2]=1,o[A+4>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0,o[A+16>>2]=0,o[A+20>>2]=0,o[A+24>>2]=0,o[A+28>>2]=0,o[A+32>>2]=0,o[A+36>>2]=0,o[A+40>>2]=1,MA(A+44|0,0,76),j(A,B=r(I,960)+2704|0,(255&(1^(I=g-((g>>31&g)<<1)|0)))-1>>>31|0),j(A,B+120|0,(255&(2^I))-1>>>31|0),j(A,B+240|0,(255&(3^I))-1>>>31|0),j(A,B+360|0,(255&(4^I))-1>>>31|0),j(A,B+480|0,(255&(5^I))-1>>>31|0),j(A,B+600|0,(255&(6^I))-1>>>31|0),j(A,B+720|0,(255&(7^I))-1>>>31|0),j(A,B+840|0,(255&(8^I))-1>>>31|0),Q=o[A+40>>2],i=o[A+44>>2],E=o[A+48>>2],a=o[A+52>>2],n=o[A+56>>2],f=o[A+60>>2],t=o[(I=A- -64|0)>>2],B=o[I+4>>2],I=o[A+76>>2],o[C+40>>2]=o[A+72>>2],o[C+44>>2]=I,o[C+32>>2]=t,o[C+36>>2]=B,o[C+24>>2]=n,o[C+28>>2]=f,o[C+16>>2]=E,o[C+20>>2]=a,o[C+8>>2]=Q,o[C+12>>2]=i,Q=o[A+8>>2],i=o[A+12>>2],E=o[A+16>>2],a=o[A+20>>2],n=o[A+24>>2],f=o[A+28>>2],t=o[A>>2],B=o[A+4>>2],I=o[A+36>>2],o[C+80>>2]=o[A+32>>2],o[C+84>>2]=I,o[C+72>>2]=n,o[C+76>>2]=f,o[(I=C- -64|0)>>2]=E,o[I+4>>2]=a,o[C+56>>2]=Q,o[C+60>>2]=i,o[C+48>>2]=t,o[C+52>>2]=B,Q=o[A+80>>2],i=o[A+84>>2],E=o[A+88>>2],a=o[A+92>>2],n=o[A+96>>2],f=o[A+100>>2],t=o[A+104>>2],B=o[A+108>>2],I=o[A+112>>2],o[C+124>>2]=0-o[A+116>>2],o[C+120>>2]=0-I,o[C+116>>2]=0-B,o[C+112>>2]=0-t,o[C+108>>2]=0-f,o[C+104>>2]=0-n,o[C+100>>2]=0-a,o[C+96>>2]=0-E,o[C+92>>2]=0-i,o[C+88>>2]=0-Q,j(A,C+8|0,(128&g)>>>7|0),D=C+128|0}function z(A,I,g,C){var B=0,Q=0,i=0,o=0,n=0,r=0,f=0;if(g|C)A:for(f=A+224|0,n=A+96|0,Q=a[A+352|0]|a[A+353|0]<<8|a[A+354|0]<<16|a[A+355|0]<<24;;){if(B=Q+n|0,!C&g>>>0<=(i=256-Q|0)>>>0){HA(B,I,g),I=(a[A+352|0]|a[A+353|0]<<8|a[A+354|0]<<16|a[A+355|0]<<24)+g|0,E[A+352|0]=I,E[A+353|0]=I>>>8,E[A+354|0]=I>>>16,E[A+355|0]=I>>>24;break A}if(HA(B,I,i),B=(a[A+352|0]|a[A+353|0]<<8|a[A+354|0]<<16|a[A+355|0]<<24)+i|0,E[A+352|0]=B,E[A+353|0]=B>>>8,E[A+354|0]=B>>>16,E[A+355|0]=B>>>24,r=Q=a[A+68|0]|a[A+69|0]<<8|a[A+70|0]<<16|a[A+71|0]<<24,Q=(o=128+(B=a[A+64|0]|a[A+65|0]<<8|a[A+66|0]<<16|a[A+67|0]<<24)|0)>>>0<128?Q+1|0:Q,E[A+64|0]=o,E[A+65|0]=o>>>8,E[A+66|0]=o>>>16,E[A+67|0]=o>>>24,E[A+68|0]=Q,E[A+69|0]=Q>>>8,E[A+70|0]=Q>>>16,E[A+71|0]=Q>>>24,Q=a[A+76|0]|a[A+77|0]<<8|a[A+78|0]<<16|a[A+79|0]<<24,Q=(r=B=-1==(0|r)&B>>>0>4294967167)>>>0>(B=B+(a[A+72|0]|a[A+73|0]<<8|a[A+74|0]<<16|a[A+75|0]<<24)|0)>>>0?Q+1|0:Q,E[A+72|0]=B,E[A+73|0]=B>>>8,E[A+74|0]=B>>>16,E[A+75|0]=B>>>24,E[A+76|0]=Q,E[A+77|0]=Q>>>8,E[A+78|0]=Q>>>16,E[A+79|0]=Q>>>24,h(A,n),HA(n,f,128),B=Q=(a[A+352|0]|a[A+353|0]<<8|a[A+354|0]<<16|a[A+355|0]<<24)-128|0,E[A+352|0]=B,E[A+353|0]=B>>>8,E[A+354|0]=B>>>16,E[A+355|0]=B>>>24,I=I+i|0,!((C=C-(g>>>0>>0)|0)|(g=g-i|0)))break}return 0}function V(A,I){var g,C=0,B=0,Q=0,i=0,E=0,a=0,n=0,r=0,f=0,t=0,e=0,c=0,y=0,D=0,w=0,h=0,s=0,p=0;C=o[I+40>>2],B=o[I+4>>2],Q=o[I+44>>2],i=o[I+8>>2],E=o[I+48>>2],a=o[I+12>>2],n=o[I+52>>2],r=o[I+16>>2],f=o[I+56>>2],e=o[I+20>>2],c=o[I+60>>2],y=o[I+24>>2],D=o[(t=I- -64|0)>>2],w=o[I+28>>2],h=o[I+68>>2],s=o[I+32>>2],p=o[I+72>>2],g=o[I>>2],o[A+36>>2]=o[I+36>>2]+o[I+76>>2],o[A+32>>2]=s+p,o[A+28>>2]=w+h,o[A+24>>2]=y+D,o[A+20>>2]=e+c,o[A+16>>2]=r+f,o[A+12>>2]=a+n,o[A+8>>2]=i+E,o[A+4>>2]=B+Q,o[A>>2]=C+g,C=o[I+40>>2],B=o[I+4>>2],Q=o[I+44>>2],i=o[I+8>>2],E=o[I+48>>2],a=o[I+12>>2],n=o[I+52>>2],r=o[I+16>>2],f=o[I+56>>2],e=o[I+20>>2],c=o[I+60>>2],y=o[I+24>>2],t=o[t>>2],D=o[I+28>>2],w=o[I+68>>2],h=o[I+32>>2],s=o[I+72>>2],p=o[I>>2],o[A+76>>2]=o[I+76>>2]-o[I+36>>2],o[A+72>>2]=s-h,o[A+68>>2]=w-D,o[A- -64>>2]=t-y,o[A+60>>2]=c-e,o[A+56>>2]=f-r,o[A+52>>2]=n-a,o[A+48>>2]=E-i,o[A+44>>2]=Q-B,o[A+40>>2]=C-p,C=o[I+80>>2],B=o[I+84>>2],Q=o[I+88>>2],i=o[I+92>>2],E=o[I+96>>2],a=o[I+100>>2],n=o[I+104>>2],r=o[I+108>>2],f=o[I+116>>2],o[A+112>>2]=o[I+112>>2],o[A+116>>2]=f,o[A+104>>2]=n,o[A+108>>2]=r,o[A+96>>2]=E,o[A+100>>2]=a,o[A+88>>2]=Q,o[A+92>>2]=i,o[A+80>>2]=C,o[A+84>>2]=B,F(A+120|0,I+120|0,1440)}function O(A,I){var g,C,B,Q,i,a=0,n=0,f=0,t=0,e=0,c=0,y=0,D=0,w=0,h=0;(f=o[A+56>>2])|(a=o[A+60>>2])&&(E[f+(n=A- -64|0)|0]=1,!((h=f+1|0)?a:a+1|0)&h>>>0<=15&&MA(65+(A+f|0)|0,0,15-f|0),E[A+80|0]=1,N(A,n,16,0)),h=o[A+52>>2],D=o[A+48>>2],n=o[A+44>>2],f=o[A+24>>2],e=o[A+28>>2]+(f>>>26|0)|0,t=o[A+32>>2]+(e>>>26|0)|0,g=o[A+36>>2]+(t>>>26|0)|0,a=(y=(f=(f=(67108863&f)+((c=o[A+20>>2]+r(g>>>26|0,5)|0)>>>26|0)|0)&(e=(t=(i=(67108863&g)+((Q=(C=67108863&t)+((B=(w=67108863&e)+((c=f+((a=5+(y=67108863&c)|0)>>>26|0)|0)>>>26|0)|0)>>>26|0)|0)>>>26|0)|0)-67108864|0)>>31)|c&(t=67108863&(c=(t>>>31|0)-1|0)))<<26|a&t|e&y)+o[A+40>>2]|0,E[0|I]=a,E[I+1|0]=a>>>8,E[I+2|0]=a>>>16,E[I+3|0]=a>>>24,y=a>>>0>>0,a=(w=e&w|t&B)<<20|f>>>6,f=0,a=(n=a+n|0)>>>0>>0?1:f,a=(f=n+y|0)>>>0>>0?a+1|0:a,E[(n=I)+4|0]=f,E[n+5|0]=f>>>8,E[n+6|0]=f>>>16,E[n+7|0]=f>>>24,f=0,n=(n=(t=e&C|t&Q)<<14|w>>>12)>>>0>(D=n+D|0)>>>0?1:f,f=D,D=a,f=(a=f+a|0)>>>0>>0?n+1|0:n,E[(n=I)+8|0]=a,E[n+9|0]=a>>>8,E[n+10|0]=a>>>16,E[n+11|0]=a>>>24,a=n=(c&i|e&g)<<8|t>>>18,a=(a=f)+(n=n+h|0)|0,E[I+12|0]=a,E[I+13|0]=a>>>8,E[I+14|0]=a>>>16,E[I+15|0]=a>>>24,$A(A,88)}function T(A,I,g){var C,B=0;return D=C=D-16|0,E[C+15|0]=0,B=-1,0|nI[o[8722]](A,I,g)||(E[C+15|0]=a[0|A]|a[C+15|0],E[C+15|0]=a[A+1|0]|a[C+15|0],E[C+15|0]=a[A+2|0]|a[C+15|0],E[C+15|0]=a[A+3|0]|a[C+15|0],E[C+15|0]=a[A+4|0]|a[C+15|0],E[C+15|0]=a[A+5|0]|a[C+15|0],E[C+15|0]=a[A+6|0]|a[C+15|0],E[C+15|0]=a[A+7|0]|a[C+15|0],E[C+15|0]=a[A+8|0]|a[C+15|0],E[C+15|0]=a[A+9|0]|a[C+15|0],E[C+15|0]=a[A+10|0]|a[C+15|0],E[C+15|0]=a[A+11|0]|a[C+15|0],E[C+15|0]=a[A+12|0]|a[C+15|0],E[C+15|0]=a[A+13|0]|a[C+15|0],E[C+15|0]=a[A+14|0]|a[C+15|0],E[C+15|0]=a[A+15|0]|a[C+15|0],E[C+15|0]=a[A+16|0]|a[C+15|0],E[C+15|0]=a[A+17|0]|a[C+15|0],E[C+15|0]=a[A+18|0]|a[C+15|0],E[C+15|0]=a[A+19|0]|a[C+15|0],E[C+15|0]=a[A+20|0]|a[C+15|0],E[C+15|0]=a[A+21|0]|a[C+15|0],E[C+15|0]=a[A+22|0]|a[C+15|0],E[C+15|0]=a[A+23|0]|a[C+15|0],E[C+15|0]=a[A+24|0]|a[C+15|0],E[C+15|0]=a[A+25|0]|a[C+15|0],E[C+15|0]=a[A+26|0]|a[C+15|0],E[C+15|0]=a[A+27|0]|a[C+15|0],E[C+15|0]=a[A+28|0]|a[C+15|0],E[C+15|0]=a[A+29|0]|a[C+15|0],E[C+15|0]=a[A+30|0]|a[C+15|0],E[C+15|0]=a[A+31|0]|a[C+15|0],B=(a[C+15|0]<<23)-8388608>>31),D=C+16|0,B}function W(A,I){var g,C,B,Q,i,a,n,f=0,t=0;C=o[I+32>>2],B=o[I+28>>2],Q=o[I+24>>2],i=o[I+20>>2],a=o[I+16>>2],n=o[I+12>>2],f=o[I+4>>2],t=o[I>>2],g=o[I+36>>2],I=o[I+8>>2],t=r((C+(B+(Q+(i+(a+(n+((f+(t+(r(g,19)+16777216>>>25|0)>>26)>>25)+I>>26)>>25)>>26)>>25)>>26)>>25)>>26)+g>>25,19)+t|0,E[0|A]=t,E[A+2|0]=t>>>16,E[A+1|0]=t>>>8,f=f+(t>>26)|0,E[A+5|0]=f>>>14,E[A+4|0]=f>>>6,E[A+3|0]=t>>>24&3|f<<2,I=I+(f>>25)|0,E[A+8|0]=I>>>13,E[A+7|0]=I>>>5,E[A+6|0]=I<<3|(29360128&f)>>>22,t=(I>>26)+n|0,E[A+11|0]=t>>>11,E[A+10|0]=t>>>3,E[A+9|0]=t<<5|(65011712&I)>>>21,f=(t>>25)+a|0,E[A+15|0]=f>>>18,E[A+14|0]=f>>>10,E[A+13|0]=f>>>2,I=(f>>26)+i|0,E[A+16|0]=I,E[A+12|0]=f<<6|(33030144&t)>>>19,E[A+18|0]=I>>>16,E[A+17|0]=I>>>8,f=(I>>25)+Q|0,E[A+21|0]=f>>>15,E[A+20|0]=f>>>7,E[A+19|0]=I>>>24&1|f<<1,I=(f>>26)+B|0,E[A+24|0]=I>>>13,E[A+23|0]=I>>>5,E[A+22|0]=I<<3|(58720256&f)>>>23,f=(I>>25)+C|0,E[A+27|0]=f>>>12,E[A+26|0]=f>>>4,E[A+25|0]=f<<4|(31457280&I)>>>21,I=g+(f>>26)|0,E[A+30|0]=I>>>10,E[A+29|0]=I>>>2,E[A+31|0]=(33292288&I)>>>18,E[A+28|0]=I<<6|(66060288&f)>>>20}function Z(A,I){var g;return o[12+(g=D-16|0)>>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009);;){if((-1^(I^=C))&I-16843009&-2139062144)break I;if(I=o[A+4>>2],A=A+4|0,I-16843009&(-1^I)&-2139062144)break}for(;I=A,(C=a[0|A])&&(A=I+1|0,(0|C)!=(255&g)););A=I}else{C=A;I:{if(3&A)for(;;){if(!a[0|A])break I;if(!(3&(A=A+1|0)))break}for(;I=A,A=A+4|0,!((-1^(B=o[I>>2]))&B-16843009&-2139062144););for(;I=(A=I)+1|0,a[0|A];);}A=C+(A-C|0)|0}return a[0|A]==(255&g)?A:0}function AA(A,I){var g,C=0,B=0,Q=0,i=0,o=0;for(D=g=D-192|0,EA(A),MA(g- -64|0,54,128);E[0|(C=(i=g- -64|0)+B|0)]=a[0|C]^a[I+B|0],E[0|(Q=(C=1|B)+i|0)]=a[0|Q]^a[I+C|0],E[0|(Q=(C=2|B)+i|0)]=a[0|Q]^a[I+C|0],E[0|(C=(C=i)+(i=3|B)|0)]=a[0|C]^a[I+i|0],B=B+4|0,32!=(0|(o=o+4|0)););for(m(A,B=g- -64|0,128,0),EA(i=A+208|0),MA(B,92,128),B=0,o=0;E[0|(C=(A=g- -64|0)+B|0)]=a[0|C]^a[I+B|0],E[0|(Q=(C=1|B)+A|0)]=a[0|Q]^a[I+C|0],E[0|(Q=(C=2|B)+A|0)]=a[0|Q]^a[I+C|0],E[0|(C=(C=A)+(A=3|B)|0)]=a[0|C]^a[A+I|0],B=B+4|0,32!=(0|(o=o+4|0)););m(i,A=g- -64|0,128,0),$A(A,128),$A(g,64),D=g+192|0}function IA(A,I,g,C,B,Q,i){var E,a,n,r,f,t=0;return D=E=D-352|0,L(E,Q,i),!((!B&C>>>0>A-g>>>0|0!=(0|B))&A>>>0>g>>>0)&(!B&C>>>0<=g-A>>>0|A>>>0>=g>>>0)||(g=kA(A,g,C)),o[E+56>>2]=0,o[E+60>>2]=0,o[E+48>>2]=0,o[E+52>>2]=0,o[E+40>>2]=0,o[E+44>>2]=0,o[E+32>>2]=0,o[E+36>>2]=0,i=(t=!B&C>>>0>=32|0!=(0|B))?32:C,f=t=t?0:B,(n=!(i|t))||HA(E- -64|0,g,i),LA(a=E+32|0,a,r=i+32|0,t=r>>>0<32?t+1|0:t,Q=Q+16|0,E),OA(E+96|0,a),n||HA(A,E- -64|0,i),$A(E+32|0,64),!B&C>>>0>=33|B&&vA(A+i|0,g+i|0,C-i|0,B-(f+(C>>>0>>0)|0)|0,Q,E),$A(E,32),zA(g=E+96|0,A,C,B),TA(g,I),$A(g,256),D=E+352|0,0}function gA(A,I,g,C,B,Q,i){var E,a,n=0,r=0;D=E=D-96|0,L(E,Q,i),i=E+32|0,a=Q+16|0,nI[o[8724]](i,32,0,a,E),Q=-1;A:{if(!(0|nI[o[8718]](g,I,C,B,i))){if(Q=0,!A)break A;!((!B&C>>>0>I-A>>>0|0!=(0|B))&A>>>0>>0)&(!B&C>>>0<=A-I>>>0|A>>>0<=I>>>0)||(I=kA(A,I,C)),(i=(g=!B&C>>>0>=32|0!=(0|B))?32:C)|(g=g?0:B)?(r=HA(E- -64|0,I,i),LA(Q=E+32|0,Q,n=i+32|0,n>>>0<32?g+1|0:g,a,E),HA(A,r,i)):LA(Q=E+32|0,Q,n=i+32|0,n>>>0<32?g+1|0:g,a,E),$A(E+32|0,64),Q=0,!B&C>>>0<33||vA(A+i|0,I+i|0,C-i|0,B-(g+(C>>>0>>0)|0)|0,a,E)}$A(E,32)}return D=E+96|0,Q}function CA(A,I,g,C,B,Q,i,E,n,r){var f,t;return D=f=D-400|0,o[f+4>>2]=0,d(t=f+16|0,n,r),r=a[n+20|0]|a[n+21|0]<<8|a[n+22|0]<<16|a[n+23|0]<<24,o[f+8>>2]=a[n+16|0]|a[n+17|0]<<8|a[n+18|0]<<16|a[n+19|0]<<24,o[f+12>>2]=r,XA(r=f+80|0,64,f+4|0,t),OA(n=f+144|0,r),$A(r,64),zA(n,Q,i,E),zA(n,34816,0-i&15,0),zA(n,I,g,C),zA(n,34816,0-g&15,0),o[f+72>>2]=i,o[f+76>>2]=E,zA(n,Q=f+72|0,8,0),o[f+72>>2]=g,o[f+76>>2]=C,zA(n,Q,8,0),TA(n,Q=f+48|0),$A(n,256),n=Z(Q,B),$A(Q,16),A&&(n?(MA(A,0,g),n=-1):(_A(A,I,g,C,f+4|0,f+16|0),n=0)),$A(f+16|0,32),D=f+400|0,n}function BA(A,I,g,C,B,Q,i,E,n,r,f){var t,e,c;return D=t=D-384|0,o[t+4>>2]=0,d(e=t+16|0,r,f),f=a[r+20|0]|a[r+21|0]<<8|a[r+22|0]<<16|a[r+23|0]<<24,o[t+8>>2]=a[r+16|0]|a[r+17|0]<<8|a[r+18|0]<<16|a[r+19|0]<<24,o[t+12>>2]=f,XA(f=t- -64|0,64,c=t+4|0,e),OA(r=t+128|0,f),$A(f,64),zA(r,i,E,n),zA(r,34816,0-E&15,0),_A(A,C,B,Q,c,e),zA(r,A,B,Q),zA(r,34816,0-B&15,0),o[t+56>>2]=E,o[t+60>>2]=n,zA(r,A=t+56|0,8,0),o[t+56>>2]=B,o[t+60>>2]=Q,zA(r,A,8,0),TA(r,I),$A(r,256),g&&(o[g>>2]=16,o[g+4>>2]=0),$A(t+16|0,32),D=t+384|0,0}function QA(A,I,g,C){var B,Q=0;return D=B=D-208|0,o[B+72>>2]=0,o[B+76>>2]=0,Q=o[8487],o[B+8>>2]=o[8486],o[B+12>>2]=Q,Q=o[8489],o[B+16>>2]=o[8488],o[B+20>>2]=Q,Q=o[8491],o[B+24>>2]=o[8490],o[B+28>>2]=Q,Q=o[8493],o[B+32>>2]=o[8492],o[B+36>>2]=Q,Q=o[8495],o[B+40>>2]=o[8494],o[B+44>>2]=Q,Q=o[8497],o[B+48>>2]=o[8496],o[B+52>>2]=Q,Q=o[8499],o[B+56>>2]=o[8498],o[B+60>>2]=Q,o[B+64>>2]=0,o[B+68>>2]=0,Q=o[8485],o[B>>2]=o[8484],o[B+4>>2]=Q,m(B,I,g,C),M(B,A),D=B+208|0,0}function iA(A,I){var g,C=0,B=0,Q=0;if(E[15+(g=D-16|0)|0]=0,I){if(B=3&I,I>>>0>=4)for(Q=-4&I,I=0;E[g+15|0]=a[A+C|0]|a[g+15|0],E[g+15|0]=a[(1|C)+A|0]|a[g+15|0],E[g+15|0]=a[(2|C)+A|0]|a[g+15|0],E[g+15|0]=a[(3|C)+A|0]|a[g+15|0],C=C+4|0,(0|Q)!=(0|(I=I+4|0)););if(B)for(I=0;E[g+15|0]=a[A+C|0]|a[g+15|0],C=C+1|0,(0|B)!=(0|(I=I+1|0)););}return a[g+15|0]-1>>>8&1}function EA(A){var I=0;o[A+64>>2]=0,o[A+68>>2]=0,o[A+72>>2]=0,o[A+76>>2]=0,I=o[8485],o[A>>2]=o[8484],o[A+4>>2]=I,I=o[8487],o[A+8>>2]=o[8486],o[A+12>>2]=I,I=o[8489],o[A+16>>2]=o[8488],o[A+20>>2]=I,I=o[8491],o[A+24>>2]=o[8490],o[A+28>>2]=I,I=o[8493],o[A+32>>2]=o[8492],o[A+36>>2]=I,I=o[8495],o[A+40>>2]=o[8494],o[A+44>>2]=I,I=o[8497],o[A+48>>2]=o[8496],o[A+52>>2]=I,I=o[8499],o[A+56>>2]=o[8498],o[A+60>>2]=I}function oA(A,I,g){var C,B=0,Q=0;if(o[12+(C=D-16|0)>>2]=A,o[C+8>>2]=I,A=0,E[C+7|0]=0,g){if(I=1&g,1!=(0|g))for(Q=-2&g,g=0;E[C+7|0]=a[C+7|0]|a[o[C+12>>2]+A|0]^a[o[C+8>>2]+A|0],B=1|A,E[C+7|0]=a[C+7|0]|a[B+o[C+12>>2]|0]^a[o[C+8>>2]+B|0],A=A+2|0,(0|Q)!=(0|(g=g+2|0)););I&&(E[C+7|0]=a[C+7|0]|a[o[C+12>>2]+A|0]^a[o[C+8>>2]+A|0])}return(a[C+7|0]-1>>>8&1)-1|0}function aA(A){for(var I=0,g=0,C=0,B=0,Q=0,i=0,E=0,o=0,n=0,r=0;B=(g=a[A+C|0])^a[0|(I=C+2448|0)]|B,Q=g^a[I+192|0]|Q,i=g^a[I+160|0]|i,E=g^a[I+128|0]|E,o=g^a[I+96|0]|o,n=g^a[I- -64|0]|n,r=g^a[I+32|0]|r,31!=(0|(C=C+1|0)););return((255&((I=127^(A=127&a[A+31|0]))|Q))-1|(255&(I|i))-1|(255&(I|E))-1|(255&(122^A|o))-1|(255&(5^A|n))-1|(255&(A|r))-1|(255&(A|B))-1)>>>8&1}function nA(A,I,g){var C=0,B=0,Q=0,i=0;return B=31&(Q=i=63&g),Q=Q>>>0>=32?-1>>>B|0:(C=-1>>>B|0)|(1<>>0>=32?(C=Q<>>32-B|C<>>0>=32?(C=-1<>>32-C,A&=g,I&=C,C=31&B,B>>>0>=32?(g=0,A=I>>>C|0):(g=I>>>C|0,A=((1<>>C),w=g|Q,A|i}function rA(A,I,g,C,B,Q,i,E,a,n){var r,f,t;return D=r=D-352|0,XA(t=r+32|0,64,a,n),OA(f=r+96|0,t),$A(t,64),zA(f,Q,i,E),zA(f,33920,0-i&15,0),zA(f,I,g,C),zA(f,33920,0-g&15,0),o[r+24>>2]=i,o[r+28>>2]=E,zA(f,Q=r+24|0,8,0),o[r+24>>2]=g,o[r+28>>2]=C,zA(f,Q,8,0),TA(f,r),$A(f,256),Q=Z(r,B),$A(r,16),A&&(Q?(MA(A,0,g),Q=-1):(wA(A,I,g,C,a,1,n),Q=0)),D=r+352|0,Q}function fA(A,I,g,C,B,Q,i,E,a,n,r){var f,t,e;return D=f=D-336|0,XA(e=f+16|0,64,n,r),OA(t=f+80|0,e),$A(e,64),zA(t,i,E,a),zA(t,33920,0-E&15,0),wA(A,C,B,Q,n,1,r),zA(t,A,B,Q),zA(t,33920,0-B&15,0),o[f+8>>2]=E,o[f+12>>2]=a,zA(t,A=f+8|0,8,0),o[f+8>>2]=B,o[f+12>>2]=Q,zA(t,A,8,0),TA(t,I),$A(t,256),g&&(o[g>>2]=16,o[g+4>>2]=0),D=f+336|0,0}function tA(A,I,g,C,B,Q,i,E,a,n){var r,f,t;return D=r=D-352|0,qA(t=r+32|0,a,n),OA(f=r+96|0,t),$A(t,64),zA(f,Q,i,E),o[r+24>>2]=i,o[r+28>>2]=E,zA(f,Q=r+24|0,8,0),zA(f,I,g,C),o[r+24>>2]=g,o[r+28>>2]=C,zA(f,Q,8,0),TA(f,r),$A(f,256),Q=Z(r,B),$A(r,16),A&&(Q?(MA(A,0,g),Q=-1):(bA(A,I,g,C,a,n),Q=0)),D=r+352|0,Q}function eA(A,I,g,C,B,Q,i,E,a,n,r){var f,t,e;return D=f=D-336|0,qA(e=f+16|0,n,r),OA(t=f+80|0,e),$A(e,64),zA(t,i,E,a),o[f+8>>2]=E,o[f+12>>2]=a,zA(t,i=f+8|0,8,0),bA(A,C,B,Q,n,r),zA(t,A,B,Q),o[f+8>>2]=B,o[f+12>>2]=Q,zA(t,i,8,0),TA(t,I),$A(t,256),g&&(o[g>>2]=16,o[g+4>>2]=0),D=f+336|0,0}function cA(A,I){var g;for(o[12+(g=D-16|0)>>2]=A,o[g+8>>2]=I,A=0,o[g+4>>2]=0;o[g+4>>2]=o[g+4>>2]|a[o[g+12>>2]+A|0]^a[o[g+8>>2]+A|0],I=1|A,o[g+4>>2]=o[g+4>>2]|a[I+o[g+12>>2]|0]^a[I+o[g+8>>2]|0],32!=(0|(A=A+2|0)););return(o[g+4>>2]-1>>>8&1)-1|0}function yA(A){var I=0,g=0,C=0,B=0;for(I=1;I=a[0|(g=A+C|0)]+I|0,E[0|g]=I,I=a[0|(g=(1|C)+A|0)]+(I>>>8|0)|0,E[0|g]=I,I=a[0|(g=(2|C)+A|0)]+(I>>>8|0)|0,E[0|g]=I,I=a[0|(g=(3|C)+A|0)]+(I>>>8|0)|0,E[0|g]=I,I=I>>>8|0,C=C+4|0,4!=(0|(B=B+4|0)););}function DA(A,I,g,C){var B,Q,i,E,o=0,a=0;return E=r(o=g>>>16|0,a=A>>>16|0),o=(65535&(a=((i=r(B=65535&g,Q=65535&A))>>>16|0)+r(a,B)|0))+r(o,Q)|0,w=(r(I,g)+E|0)+r(A,C)+(a>>>16)+(o>>>16)|0,65535&i|o<<16}function wA(A,I,g,C,B,i,E){var a=0,n=0;a=C,1==(((a=(n=g+63|0)>>>0<63?a+1|0:a)>>>6|0)+(0!=(0|(a=(63&a)<<26|n>>>6)))|0)&i>>>0>(n=0-a|0)>>>0|1==(0|C)|C>>>0>1?(mA(),Q()):nI[o[8716]](A,I,g,C,B,i,E)}function hA(A,I){A|=0;var g,C=0,B=0,Q=0;if(D=g=D-16|0,I|=0)for(;E[g+15|0]=0,B=A+C|0,Q=0|t(34904,g+15|0,0),E[0|B]=Q,(0|(C=C+1|0))!=(0|I););D=g+16|0}function sA(A,I,g,C,B,Q,i){var E,o=0;return D=E=D-32|0,o=-1,!C&g>>>0<16||SA(E,Q,i)||(o=gA(A,I+16|0,I,g-16|0,C-(g>>>0<16)|0,B,E),$A(E,32)),D=E+32|0,o}function pA(A){var I,g;return(A=(I=o[8712])+(g=A+7&-8)|0)>>>0<=I>>>0&&g||A>>>0>rI()<<16>>>0&&!(0|y(0|A))?(o[8916]=48,-1):(o[8712]=A,I)}function uA(A,I){var g,C,B;D=g=D-176|0,X(C=g+96|0,I+80|0),F(B=g+48|0,I,C),F(g,I+40|0,C),W(A,g),W(g+144|0,B),E[A+31|0]=a[A+31|0]^a[g+144|0]<<7,D=g+176|0}function kA(A,I,g){var C=0;if(A>>>0>>0)return HA(A,I,g);if(g)for(C=A+g|0,I=I+g|0;I=I-1|0,E[0|(C=C-1|0)]=a[0|I],g=g-1|0;);return A}function FA(A,I,g,C,B,i,E){var o,a=0;if(D=o=D-32|0,!C&g>>>0<4294967280)return a=-1,SA(o,i,E)||(a=IA(A+16|0,A,I,g,C,B,o),$A(o,32)),D=o+32|0,a;mA(),Q()}function lA(A,I,g,C,B,Q){return I|=0,0|(!(C|=0)&(g|=0)>>>0>=16|C?gA(A|=0,I+16|0,I,g-16|0,C-(g>>>0<16)|0,B|=0,Q|=0):-1)}function SA(A,I,g){A|=0;var C,B=0;return D=C=D-32|0,B=-1,T(C,g|=0,I|=0)||(B=L(A,34832,C)),D=C+32|0,0|B}function HA(A,I,g){var C=0;if(g)for(C=A;E[0|C]=a[0|I],C=C+1|0,I=I+1|0,g=g-1|0;);return A}function MA(A,I,g){var C=0;if(g)for(C=A;E[0|C]=I,C=C+1|0,g=g-1|0;);return A}function GA(A,I,g){return A|=0,I|=0,(g|=0)>>>0>=256&&(e(1260,1187,107,1067),Q()),0|G(A,I,255&g)}function UA(A,I){var g;D=g=D+-64|0,M(A,g),m(A=A+208|0,g,64,0),M(A,I),$A(g,64),D=g- -64|0}function JA(A,I,g,C,B,Q,i){return 0|IA(A|=0,I|=0,g|=0,C|=0,B|=0,Q|=0,i|=0)}function NA(A,I,g,C,B,Q,i){return 0|gA(A|=0,I|=0,g|=0,C|=0,B|=0,Q|=0,i|=0)}function YA(A,I){var g=0;return(-1>>>(g=31&I)&A)<>>A}function bA(A,I,g,C,B,i){1==(0|C)|C>>>0>1&&(mA(),Q()),nI[o[8715]](A,I,g,C,B,1,0,i)}function _A(A,I,g,C,B,i){1==(0|C)|C>>>0>1&&(mA(),Q()),nI[o[8716]](A,I,g,C,B,1,i)}function KA(){var A;D=A=D-16|0,E[A+15|0]=0,t(34940,A+15|0,0),D=A+16|0}function PA(A,I,g){return 0|T(A|=0,I|=0,g|=0)}function vA(A,I,g,C,B,Q){nI[o[8725]](A,I,g,C,B,1,0,Q)}function mA(){var A;(A=o[9050])&&nI[0|A](),c(),Q()}function dA(A,I){return A|=0,hA(I|=0,32),0|VA(A,I)}function LA(A,I,g,C,B,Q){nI[o[8725]](A,I,g,C,B,0,0,Q)}function RA(A){return A?31-f(A-1^A)|0:32}function xA(A,I,g,C){nI[o[8716]](A,I,40,0,g,0,C)}function jA(A,I){return 0|VA(A|=0,I|=0)}function XA(A,I,g,C){nI[o[8714]](A,I,0,g,C)}function qA(A,I,g){nI[o[8713]](A,64,0,I,g)}function zA(A,I,g,C){nI[o[8720]](A,I,g,C)}function VA(A,I){return 0|nI[o[8723]](A,I)}function OA(A,I){nI[o[8719]](A,I)}function TA(A,I){nI[o[8721]](A,I)}function WA(A,I,g,C){m(A,I,g,C)}function ZA(A){hA(A|=0,32)}function $A(A,I){MA(A,0,I)}function AI(){return 16}function II(){return 32}function gI(){return 24}function CI(){return-17}function BI(){return 64}function QI(){return 1}function iI(){return 3}function EI(){return 8}function oI(){return 0}B(I=a,1024,"TGlic29kaXVtRFJHcmFuZG9tYnl0ZXMAYjY0X3BvcyA8PSBiNjRfbGVuAGNyeXB0b19nZW5lcmljaGFzaF9ibGFrZTJiX2ZpbmFsAHJhbmRvbWJ5dGVzL3JhbmRvbWJ5dGVzLmMAc29kaXVtL2NvZGVjcy5jAGNyeXB0b19nZW5lcmljaGFzaC9ibGFrZTJiL3JlZi9ibGFrZTJiLXJlZi5jAGNyeXB0b19nZW5lcmljaGFzaC9ibGFrZTJiL3JlZi9nZW5lcmljaGFzaF9ibGFrZTJiLmMAYnVmX2xlbiA8PSBTSVpFX01BWABvdXRsZW4gPD0gVUlOVDhfTUFYAFMtPmJ1ZmxlbiA8PSBCTEFLRTJCX0JMT0NLQllURVMAMS4wLjE4AHNvZGl1bV9iaW4yYmFzZTY0AAAAAAAAAAC2eFn/hXLTAL1uFf8PCmoAKcABAJjoef+8PKD/mXHO/wC34v60DUj/AAAAAAAAAACwoA7+08mG/54YjwB/aTUAYAy9AKfX+/+fTID+amXh/x78BACSDK4="),B(I,1440,"WfGy/grlpv973Sr+HhTUAFKAAwAw0fMAd3lA/zLjnP8AbsUBZxuQ"),B(I,1488,"hTuMAb3xJP/4JcMBYNw3ALdMPv/DQj0AMkykAeGkTP9MPaP/dT4fAFGRQP92QQ4AonPW/waKLgB85vT/CoqPADQawgC49EwAgY8pAb70E/97qnr/YoFEAHnVkwBWZR7/oWebAIxZQ//v5b4BQwu1AMbwif7uRbz/Q5fuABMqbP/lVXEBMkSH/xFqCQAyZwH/UAGoASOYHv8QqLkBOFno/2XS/AAp+kcAzKpP/w4u7/9QTe8AvdZL/x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8u+Y8NXfrAXTxjM5sTgCiG1T/AXHF2pwPU3YT7o8C3YNEGcPKiBT+iw5zMZOx/13kqwDeuz///////////////////////////////////////9/7f///////////////////////////////////////3/u////////////////////////////////////////f+3T9VwaYxJY1pz3ot753hQ="),B(I,2703,"EIU7jAG98ST/+CXDAWDcNwC3TD7/w0I9ADJMpAHhpEz/TD2j/3U+HwBRkUD/dkEOAKJz1v8Gii4AfOb0/wqKjwA0GsIAuPRMAIGPKQG+9BP/e6p6/2KBRAB51ZMAVmUe/6FnmwCMWUP/7+W+AUMLtQDG8In+7kW8/+pxPP8l/zn/RbK2/oDQswB2Gn3+AwfW//EyTf9Vy8X/04f6/xkwZP+71bT+EVhpAFPRngEFc2IABK48/qs3bv/ZtRH/FLyqAJKcZv5X1q7/cnqbAeksqgB/CO8B1uzqAK8F2wAxaj3/BkLQ/wJqbv9R6hP/12vA/0OX7gATKmz/5VVxATJEh/8RagkAMmcB/1ABqAEjmB7/EKi5AThZ6P9l0vwAKfpHAMyqT/8OLu//UE3vAL3WS/8RjfkAJlBM/75VdQBW5KoAnNjQAcPPpP+WQkz/r+EQ/41QYgFM2/IAxqJyAC7amACbK/H+m6Bo/7IJ/P5kbtQADgWnAOnvo/8cl50BZZIK//6eRv5H+eQAWB4yAEQ6oP+/GGgBgUKB/8AyVf8Is4r/JvrJAHNQoACD5nEAfViTAFpExwD9TJ4AHP92AHH6/gBCSy4A5torAOV4ugGURCsAiHzuAbtrxf9UNfb/M3T+/zO7pQACEa8AQlSgAfc6HgAjQTX+Rey/AC2G9QGje90AIG4U/zQXpQC61kcA6bBgAPLvNgE5WYoAUwBU/4igZABcjnj+aHy+ALWxPv/6KVUAmIIqAWD89gCXlz/+74U+ACA4nAAtp73/joWzAYNW0wC7s5b++qoO/0RxFf/eujv/QgfxAUUGSABWnGz+N6dZAG002/4NsBf/xCxq/++VR/+kjH3/n60BADMp5wCRPiEAim9dAblTRQCQcy4AYZcQ/xjkGgAx2eIAcUvq/sGZDP+2MG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7f+RfsL/3Sr9/xljlwBh/d8BSnMx/wavSP87sMsAfLf5AeTkYwCBDM/+qMDD/8ywEP6Y6qsATSVV/yF4h/+OwuMBH9Y6ANW7ff/oLjz/vnQq/peyE/8zPu3+zOzBAMLoPACsIp3/vRC4/mcDX/+N6ST+KRkL/xXDpgB29S0AQ9WV/58MEv+7pOMBoBkFAAxOwwErxeEAMI4p/sSbPP/fxxIBkYicAPx1qf6R4u4A7xdrAG21vP/mcDH+Sart/+e34/9Q3BQAwmt/AX/NZQAuNMUB0qsk/1gDWv84l40AYLv//ypOyAD+RkYB9H2oAMxEigF810YAZkLI/hE05AB13I/+y/h7ADgSrv+6l6T/M+jQAaDkK//5HRkBRL4/AA0AAAAA/wAAAAD1AAAAAAAA+wAAAAAAAP0AAAAA8wAAAAAHAAAAAAADAAAAAPMAAAAABQAAAAAAAAAACwAAAAAACwAAAADzAAAAAAAA/QAAAAAA/wAAAAADAAAAAPUAAAAAAAAADwAAAAAA/wAAAAD/AAAAAAcAAAAABQ=="),B(I,33676,"AQ=="),B(I,33712,"AQ=="),B(I,33744,"4Ot6fDtBuK4WVuP68Z/EatoJjeucMrH9hmIFFl9JuABfnJW8o1CMJLHQsVWcg+9bBERcxFgcjobYIk7d0J8RV+z///////////////////////////////////////9/7f///////////////////////////////////////3/u////////////////////////////////////////fw=="),B(I,33936,"CMm882fmCWo7p8qEha5nuyv4lP5y82488TYdXzr1T6XRguatf1IOUR9sPiuMaAWba71B+6vZgx95IX4TGc3gWyKuKNeYL4pCzWXvI5FEN3EvO03sz/vAtbzbiYGl27XpOLVI81vCVjkZ0AW28RHxWZtPGa+kgj+SGIFt2tVeHKtCAgOjmKoH2L5vcEUBW4MSjLLkTr6FMSTitP/Vw30MVW+Je/J0Xb5ysZYWO/6x3oA1Esclpwbcm5Qmac908ZvB0krxnsFpm+TjJU84hke+77XVjIvGncEPZZysd8yhDCR1AitZbyzpLYPkpm6qhHRK1PtBvdypsFy1UxGD2oj5dqvfZu5SUT6YED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[B+14|0]<<16|a[B+15|0]<<24,o[Q+32>>2]=a[B+16|0]|a[B+17|0]<<8|a[B+18|0]<<16|a[B+19|0]<<24,o[Q+36>>2]=a[B+20|0]|a[B+21|0]<<8|a[B+22|0]<<16|a[B+23|0]<<24,o[Q+40>>2]=a[B+24|0]|a[B+25|0]<<8|a[B+26|0]<<16|a[B+27|0]<<24,B=a[B+28|0]|a[B+29|0]<<8|a[B+30|0]<<16|a[B+31|0]<<24,o[Q+48>>2]=0,o[Q+52>>2]=0,o[Q+44>>2]=B,o[Q+56>>2]=a[0|C]|a[C+1|0]<<8|a[C+2|0]<<16|a[C+3|0]<<24,o[Q+60>>2]=a[C+4|0]|a[C+5|0]<<8|a[C+6|0]<<16|a[C+7|0]<<24,H(Q,A=MA(A,0,I),A,I,g),$A(Q,64)),D=Q- -64|0,0},function(A,I,g,C,B){var Q;return A|=0,C|=0,B|=0,D=Q=D+-64|0,(I|=0)|(g|=0)&&(o[Q+8>>2]=2036477234,o[Q+12>>2]=1797285236,o[Q>>2]=1634760805,o[Q+4>>2]=857760878,o[Q+16>>2]=a[0|B]|a[B+1|0]<<8|a[B+2|0]<<16|a[B+3|0]<<24,o[Q+20>>2]=a[B+4|0]|a[B+5|0]<<8|a[B+6|0]<<16|a[B+7|0]<<24,o[Q+24>>2]=a[B+8|0]|a[B+9|0]<<8|a[B+10|0]<<16|a[B+11|0]<<24,o[Q+28>>2]=a[B+12|0]|a[B+13|0]<<8|a[B+14|0]<<16|a[B+15|0]<<24,o[Q+32>>2]=a[B+16|0]|a[B+17|0]<<8|a[B+18|0]<<16|a[B+19|0]<<24,o[Q+36>>2]=a[B+20|0]|a[B+21|0]<<8|a[B+22|0]<<16|a[B+23|0]<<24,o[Q+40>>2]=a[B+24|0]|a[B+25|0]<<8|a[B+26|0]<<16|a[B+27|0]<<24,B=a[B+28|0]|a[B+29|0]<<8|a[B+30|0]<<16|a[B+31|0]<<24,o[Q+48>>2]=0,o[Q+44>>2]=B,o[Q+52>>2]=a[0|C]|a[C+1|0]<<8|a[C+2|0]<<16|a[C+3|0]<<24,o[Q+56>>2]=a[C+4|0]|a[C+5|0]<<8|a[C+6|0]<<16|a[C+7|0]<<24,o[Q+60>>2]=a[C+8|0]|a[C+9|0]<<8|a[C+10|0]<<16|a[C+11|0]<<24,H(Q,A=MA(A,0,I),A,I,g),$A(Q,64)),D=Q- -64|0,0},function(A,I,g,C,B,Q,i,E){var n;return A|=0,I|=0,B|=0,Q|=0,i|=0,E|=0,D=n=D+-64|0,(g|=0)|(C|=0)&&(o[n+8>>2]=2036477234,o[n+12>>2]=1797285236,o[n>>2]=1634760805,o[n+4>>2]=857760878,o[n+16>>2]=a[0|E]|a[E+1|0]<<8|a[E+2|0]<<16|a[E+3|0]<<24,o[n+20>>2]=a[E+4|0]|a[E+5|0]<<8|a[E+6|0]<<16|a[E+7|0]<<24,o[n+24>>2]=a[E+8|0]|a[E+9|0]<<8|a[E+10|0]<<16|a[E+11|0]<<24,o[n+28>>2]=a[E+12|0]|a[E+13|0]<<8|a[E+14|0]<<16|a[E+15|0]<<24,o[n+32>>2]=a[E+16|0]|a[E+17|0]<<8|a[E+18|0]<<16|a[E+19|0]<<24,o[n+36>>2]=a[E+20|0]|a[E+21|0]<<8|a[E+22|0]<<16|a[E+23|0]<<24,o[n+40>>2]=a[E+24|0]|a[E+25|0]<<8|a[E+26|0]<<16|a[E+27|0]<<24,o[n+44>>2]=a[E+28|0]|a[E+29|0]<<8|a[E+30|0]<<16|a[E+31|0]<<24,o[n+48>>2]=Q,o[n+52>>2]=i,o[n+56>>2]=a[0|B]|a[B+1|0]<<8|a[B+2|0]<<16|a[B+3|0]<<24,o[n+60>>2]=a[B+4|0]|a[B+5|0]<<8|a[B+6|0]<<16|a[B+7|0]<<24,H(n,I,A,g,C),$A(n,64)),D=n- -64|0,0},function(A,I,g,C,B,Q,i){var E;return A|=0,I|=0,B|=0,Q|=0,i|=0,D=E=D+-64|0,(g|=0)|(C|=0)&&(o[E+8>>2]=2036477234,o[E+12>>2]=1797285236,o[E>>2]=1634760805,o[E+4>>2]=857760878,o[E+16>>2]=a[0|i]|a[i+1|0]<<8|a[i+2|0]<<16|a[i+3|0]<<24,o[E+20>>2]=a[i+4|0]|a[i+5|0]<<8|a[i+6|0]<<16|a[i+7|0]<<24,o[E+24>>2]=a[i+8|0]|a[i+9|0]<<8|a[i+10|0]<<16|a[i+11|0]<<24,o[E+28>>2]=a[i+12|0]|a[i+13|0]<<8|a[i+14|0]<<16|a[i+15|0]<<24,o[E+32>>2]=a[i+16|0]|a[i+17|0]<<8|a[i+18|0]<<16|a[i+19|0]<<24,o[E+36>>2]=a[i+20|0]|a[i+21|0]<<8|a[i+22|0]<<16|a[i+23|0]<<24,o[E+40>>2]=a[i+24|0]|a[i+25|0]<<8|a[i+26|0]<<16|a[i+27|0]<<24,i=a[i+28|0]|a[i+29|0]<<8|a[i+30|0]<<16|a[i+31|0]<<24,o[E+48>>2]=Q,o[E+44>>2]=i,o[E+52>>2]=a[0|B]|a[B+1|0]<<8|a[B+2|0]<<16|a[B+3|0]<<24,o[E+56>>2]=a[B+4|0]|a[B+5|0]<<8|a[B+6|0]<<16|a[B+7|0]<<24,o[E+60>>2]=a[B+8|0]|a[B+9|0]<<8|a[B+10|0]<<16|a[B+11|0]<<24,H(E,I,A,g,C),$A(E,64)),D=E- -64|0,0},function(A,I,g,C,B){var Q,i,n;return A|=0,I|=0,g|=0,C|=0,B|=0,D=Q=(i=D)-128&-64,o[Q>>2]=67108863&(a[0|B]|a[B+1|0]<<8|a[B+2|0]<<16|a[B+3|0]<<24),o[Q+4>>2]=(a[B+3|0]|a[B+4|0]<<8|a[B+5|0]<<16|a[B+6|0]<<24)>>>2&67108611,o[Q+8>>2]=(a[B+6|0]|a[B+7|0]<<8|a[B+8|0]<<16|a[B+9|0]<<24)>>>4&67092735,o[Q+12>>2]=(a[B+9|0]|a[B+10|0]<<8|a[B+11|0]<<16|a[B+12|0]<<24)>>>6&66076671,n=a[B+12|0]|a[B+13|0]<<8|a[B+14|0]<<16|a[B+15|0]<<24,o[Q+20>>2]=0,o[Q+24>>2]=0,o[Q+28>>2]=0,o[Q+32>>2]=0,o[Q+36>>2]=0,o[Q+16>>2]=n>>>8&1048575,o[Q+40>>2]=a[B+16|0]|a[B+17|0]<<8|a[B+18|0]<<16|a[B+19|0]<<24,o[Q+44>>2]=a[B+20|0]|a[B+21|0]<<8|a[B+22|0]<<16|a[B+23|0]<<24,o[Q+48>>2]=a[B+24|0]|a[B+25|0]<<8|a[B+26|0]<<16|a[B+27|0]<<24,B=a[B+28|0]|a[B+29|0]<<8|a[B+30|0]<<16|a[B+31|0]<<24,E[Q+80|0]=0,o[Q+56>>2]=0,o[Q+60>>2]=0,o[Q+52>>2]=B,x(Q,I,g,C),O(Q,A),D=i,0},function(A,I,g,C,B){var Q,i,n;return A|=0,I|=0,g|=0,C|=0,B|=0,D=Q=(i=D)-192&-64,o[Q+64>>2]=67108863&(a[0|B]|a[B+1|0]<<8|a[B+2|0]<<16|a[B+3|0]<<24),o[Q+68>>2]=(a[B+3|0]|a[B+4|0]<<8|a[B+5|0]<<16|a[B+6|0]<<24)>>>2&67108611,o[Q+72>>2]=(a[B+6|0]|a[B+7|0]<<8|a[B+8|0]<<16|a[B+9|0]<<24)>>>4&67092735,o[Q+76>>2]=(a[B+9|0]|a[B+10|0]<<8|a[B+11|0]<<16|a[B+12|0]<<24)>>>6&66076671,n=a[B+12|0]|a[B+13|0]<<8|a[B+14|0]<<16|a[B+15|0]<<24,o[Q+84>>2]=0,o[Q+88>>2]=0,o[Q+92>>2]=0,o[Q+96>>2]=0,o[Q+100>>2]=0,o[Q+80>>2]=n>>>8&1048575,o[Q+104>>2]=a[B+16|0]|a[B+17|0]<<8|a[B+18|0]<<16|a[B+19|0]<<24,o[Q+108>>2]=a[B+20|0]|a[B+21|0]<<8|a[B+22|0]<<16|a[B+23|0]<<24,o[Q+112>>2]=a[B+24|0]|a[B+25|0]<<8|a[B+26|0]<<16|a[B+27|0]<<24,B=a[B+28|0]|a[B+29|0]<<8|a[B+30|0]<<16|a[B+31|0]<<24,E[Q+144|0]=0,o[Q+120>>2]=0,o[Q+124>>2]=0,o[Q+116>>2]=B,x(B=Q- -64|0,I,g,C),O(B,I=Q+48|0),A=Z(A,I),D=i,0|A},function(A,I){var g;return I|=0,o[(A|=0)>>2]=67108863&(a[0|I]|a[I+1|0]<<8|a[I+2|0]<<16|a[I+3|0]<<24),o[A+4>>2]=(a[I+3|0]|a[I+4|0]<<8|a[I+5|0]<<16|a[I+6|0]<<24)>>>2&67108611,o[A+8>>2]=(a[I+6|0]|a[I+7|0]<<8|a[I+8|0]<<16|a[I+9|0]<<24)>>>4&67092735,o[A+12>>2]=(a[I+9|0]|a[I+10|0]<<8|a[I+11|0]<<16|a[I+12|0]<<24)>>>6&66076671,g=a[I+12|0]|a[I+13|0]<<8|a[I+14|0]<<16|a[I+15|0]<<24,o[A+20>>2]=0,o[A+24>>2]=0,o[A+28>>2]=0,o[A+32>>2]=0,o[A+36>>2]=0,o[A+16>>2]=g>>>8&1048575,o[A+40>>2]=a[I+16|0]|a[I+17|0]<<8|a[I+18|0]<<16|a[I+19|0]<<24,o[A+44>>2]=a[I+20|0]|a[I+21|0]<<8|a[I+22|0]<<16|a[I+23|0]<<24,o[A+48>>2]=a[I+24|0]|a[I+25|0]<<8|a[I+26|0]<<16|a[I+27|0]<<24,I=a[I+28|0]|a[I+29|0]<<8|a[I+30|0]<<16|a[I+31|0]<<24,E[A+80|0]=0,o[A+56>>2]=0,o[A+60>>2]=0,o[A+52>>2]=I,0},function(A,I,g,C){return x(A|=0,I|=0,g|=0,C|=0),0},function(A,I){return O(A|=0,I|=0),0},function(A,I,g){A|=0,I|=0,g|=0;var C,B=0,Q=0,i=0,n=0,r=0,f=0,t=0,e=0,c=0,y=0,h=0,s=0,p=0,u=0,k=0,l=0,H=0,M=0,G=0,U=0,J=0,N=0,Y=0,b=0,_=0,K=0,v=0,m=0,d=0,L=0,R=0,x=0,j=0,q=0,z=0,V=0,O=0,T=0,Z=0,$=0,AA=0,IA=0,gA=0,CA=0,BA=0,QA=0,iA=0,EA=0,oA=0,aA=0,nA=0,rA=0,fA=0,tA=0,eA=0,cA=0,yA=0,wA=0,hA=0,sA=0,pA=0,uA=0,kA=0,FA=0,lA=0;for(D=C=D-368|0;h=(i=a[g+B|0])^a[0|(r=B+33680|0)]|h,c=i^a[r+192|0]|c,y=i^a[r+160|0]|y,e=i^a[r+128|0]|e,n=i^a[r+96|0]|n,f=i^a[r- -64|0]|f,Q=i^a[r+32|0]|Q,31!=(0|(B=B+1|0)););if(B=-1,!(256&((255&((i=127^(r=127&a[g+31|0]))|c))-1|(255&(i|y))-1|(255&(i|e))-1|(255&(87^r|n))-1|(255&(f|r))-1|(255&(Q|r))-1|(255&(r|h))-1))){for(B=I,I=a[I+28|0]|a[I+29|0]<<8|a[I+30|0]<<16|a[I+31|0]<<24,o[C+360>>2]=a[B+24|0]|a[B+25|0]<<8|a[B+26|0]<<16|a[B+27|0]<<24,o[C+364>>2]=I,I=a[B+20|0]|a[B+21|0]<<8|a[B+22|0]<<16|a[B+23|0]<<24,o[C+352>>2]=a[B+16|0]|a[B+17|0]<<8|a[B+18|0]<<16|a[B+19|0]<<24,o[C+356>>2]=I,Q=a[B+4|0]|a[B+5|0]<<8|a[B+6|0]<<16|a[B+7|0]<<24,I=a[0|B]|a[B+1|0]<<8|a[B+2|0]<<16|a[B+3|0]<<24,o[C+336>>2]=I,o[C+340>>2]=Q,Q=a[B+12|0]|a[B+13|0]<<8|a[B+14|0]<<16|a[B+15|0]<<24,o[C+344>>2]=a[B+8|0]|a[B+9|0]<<8|a[B+10|0]<<16|a[B+11|0]<<24,o[C+348>>2]=Q,E[C+336|0]=248&I,E[C+367|0]=63&a[C+367|0]|64,P(C+288|0,g),o[C+260>>2]=0,o[C+264>>2]=0,o[C+268>>2]=0,o[C+272>>2]=0,o[C+276>>2]=0,o[C+208>>2]=0,o[C+212>>2]=0,o[C+216>>2]=0,o[C+220>>2]=0,o[C+224>>2]=0,o[C+228>>2]=0,o[C+244>>2]=0,o[C+248>>2]=0,o[C+240>>2]=1,o[C+252>>2]=0,o[C+256>>2]=0,o[C+192>>2]=0,o[C+196>>2]=0,o[C+200>>2]=0,o[C+204>>2]=0,I=o[C+316>>2],o[C+168>>2]=o[C+312>>2],o[C+172>>2]=I,I=o[C+308>>2],o[C+160>>2]=o[C+304>>2],o[C+164>>2]=I,I=o[C+300>>2],o[C+152>>2]=o[C+296>>2],o[C+156>>2]=I,I=o[C+292>>2],o[C+144>>2]=o[C+288>>2],o[C+148>>2]=I,I=o[C+324>>2],o[C+176>>2]=o[C+320>>2],o[C+180>>2]=I,o[C+116>>2]=0,o[C+120>>2]=0,o[C+124>>2]=0,o[C+128>>2]=0,o[C+132>>2]=0,o[C+100>>2]=0,o[C+104>>2]=0,o[C+96>>2]=1,o[C+108>>2]=0,o[C+112>>2]=0,g=254;Z=o[C+276>>2],i=o[C+180>>2],$=o[C+96>>2],AA=o[C+192>>2],IA=o[C+144>>2],gA=o[C+240>>2],CA=o[C+100>>2],BA=o[C+196>>2],QA=o[C+148>>2],iA=o[C+244>>2],J=o[C+104>>2],EA=o[C+200>>2],N=o[C+152>>2],oA=o[C+248>>2],K=o[C+108>>2],aA=o[C+204>>2],Y=o[C+156>>2],nA=o[C+252>>2],b=o[C+112>>2],rA=o[C+208>>2],G=o[C+160>>2],fA=o[C+256>>2],h=o[C+116>>2],tA=o[C+212>>2],t=o[C+164>>2],eA=o[C+260>>2],c=o[C+120>>2],cA=o[C+216>>2],y=o[C+168>>2],yA=o[C+264>>2],e=o[C+124>>2],wA=o[C+220>>2],n=o[C+172>>2],hA=o[C+268>>2],f=o[C+128>>2],sA=o[C+224>>2],Q=o[C+176>>2],pA=o[C+272>>2],uA=g,U=(H=(I=0-((I=T)^(T=a[C+336+(g>>>3)|0]>>>(7&g)&1))|0)&((B=o[C+132>>2])^(q=o[C+228>>2])))^B,o[C+132>>2]=U,z=i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216>>2]=d+FA,o[C+212>>2]=L+lA,o[C+208>>2]=v+R,o[C+204>>2]=x+O,o[C+200>>2]=K+j,o[C+196>>2]=J+Y,o[C+192>>2]=G+N,F(z=C+96|0,_=C+48|0,G=C+240|0),F(U=C+192|0,U,C),S(_,C),S(C,G),t=o[C+192>>2],H=o[C+96>>2],p=o[C+196>>2],u=o[C+100>>2],M=o[C+200>>2],k=o[C+104>>2],l=o[C+204>>2],s=o[C+108>>2],r=o[C+208>>2],i=o[C+112>>2],h=o[C+212>>2],c=o[C+116>>2],y=o[C+216>>2],e=o[C+120>>2],n=o[C+220>>2],f=o[C+124>>2],Q=o[C+224>>2],B=o[C+128>>2],g=o[C+228>>2],I=o[C+132>>2],o[C+180>>2]=g+I,o[C+176>>2]=B+Q,o[C+172>>2]=n+f,o[C+168>>2]=e+y,o[C+164>>2]=c+h,o[C+160>>2]=i+r,o[C+156>>2]=s+l,o[C+152>>2]=k+M,o[C+148>>2]=p+u,o[C+144>>2]=t+H,o[C+228>>2]=I-g,o[C+224>>2]=B-Q,o[C+220>>2]=f-n,o[C+216>>2]=e-y,o[C+212>>2]=c-h,o[C+208>>2]=i-r,o[C+204>>2]=s-l,o[C+200>>2]=k-M,o[C+196>>2]=u-p,o[C+192>>2]=H-t,F(G,C,_),m=o[C+52>>2],s=o[C+4>>2],d=o[C+56>>2],r=o[C+8>>2],L=o[C+64>>2],i=o[C+16>>2],R=o[C+60>>2],e=o[C+12>>2],x=o[C+72>>2],n=o[C+24>>2],j=o[C+68>>2],f=o[C+20>>2],J=o[C+80>>2],B=o[C+32>>2],N=o[C+76>>2],g=o[C+28>>2],q=o[C+84>>2],I=o[C+36>>2],V=o[C+48>>2],Q=o[C>>2]-V|0,o[C>>2]=Q,I=I-q|0,o[C+36>>2]=I,b=g-N|0,o[C+28>>2]=b,G=B-J|0,o[C+32>>2]=G,h=f-j|0,o[C+20>>2]=h,c=n-x|0,o[C+24>>2]=c,y=e-R|0,o[C+12>>2]=y,e=i-L|0,o[C+16>>2]=e,n=r-d|0,o[C+8>>2]=n,B=s-m|0,o[C+4>>2]=B,S(U,U),I=DA(I,I>>31,121666,0),g=w,O=I,I=DA((33554431&(g=(t=I+16777216|0)>>>0<16777216?g+1|0:g))<<7|t>>>25,g>>25,19,0),f=w,g=I,I=DA(Q,Q>>31,121666,0),v=w+f|0,I=I>>>0>(g=g+I|0)>>>0?v+1|0:v,I=(f=g+33554432|0)>>>0<33554432?I+1|0:I,H=g-(-67108864&f)|0,o[C+96>>2]=H,Q=DA(B,B>>31,121666,0),g=w,g=(B=Q+16777216|0)>>>0<16777216?g+1|0:g,p=(I=(67108863&I)<<6|f>>>26)+(Q-(-33554432&B)|0)|0,o[C+100>>2]=p,v=g>>25,B=(33554431&g)<<7|B>>>25,g=DA(n,n>>31,121666,0)+B|0,I=v+w|0,I=g>>>0>>0?I+1|0:I,f=(u=g+33554432|0)>>>0<33554432?I+1|0:I,M=g-(-67108864&u)|0,o[C+104>>2]=M,B=DA(e,e>>31,121666,0),Q=w,g=DA(y,y>>31,121666,0),I=w,Y=B,K=g,B=(33554431&(I=(k=g+16777216|0)>>>0<16777216?I+1|0:I))<<7|k>>>25,I=(I>>25)+Q|0,I=(g=Y+B|0)>>>0>>0?I+1|0:I,Q=(l=g+33554432|0)>>>0<33554432?I+1|0:I,s=g-(-67108864&l)|0,o[C+112>>2]=s,B=DA(c,c>>31,121666,0),n=w,g=DA(h,h>>31,121666,0),I=w,Y=g,g=(33554431&(I=(r=g+16777216|0)>>>0<16777216?I+1|0:I))<<7|r>>>25,I=(I>>25)+n|0,I=g>>>0>(B=g+B|0)>>>0?I+1|0:I,g=(i=B+33554432|0)>>>0<33554432?I+1|0:I,h=B-(-67108864&i)|0,o[C+120>>2]=h,n=DA(G,G>>31,121666,0),e=w,B=DA(b,b>>31,121666,0),I=w,G=B,B=(33554431&(I=(c=B+16777216|0)>>>0<16777216?I+1|0:I))<<7|c>>>25,I=(I>>25)+e|0,I=B>>>0>(n=B+n|0)>>>0?I+1|0:I,B=(y=n+33554432|0)>>>0<33554432?I+1|0:I,e=n-(-67108864&y)|0,o[C+128>>2]=e,n=(f=K+((67108863&f)<<6|u>>>26)|0)-(-33554432&k)|0,o[C+108>>2]=n,f=(Q=Y+((67108863&Q)<<6|l>>>26)|0)-(-33554432&r)|0,o[C+116>>2]=f,Q=(I=G+((67108863&g)<<6|i>>>26)|0)-(-33554432&c)|0,o[C+124>>2]=Q,g=(B=O+((67108863&B)<<6|y>>>26)|0)-(-33554432&t)|0,o[C+132>>2]=g,S(I=C+144|0,I),o[C+84>>2]=g+q,o[C+80>>2]=e+J,o[C+76>>2]=Q+N,o[C+72>>2]=h+x,o[C+68>>2]=f+j,o[C+64>>2]=s+L,o[C+60>>2]=n+R,o[C+56>>2]=M+d,o[C+52>>2]=p+m,o[C+48>>2]=H+V,g=uA-1|0,F(z,C+288|0,U),F(U,C,_),uA;);h=o[C+144>>2],H=o[C+240>>2],c=o[C+148>>2],p=o[C+244>>2],y=o[C+152>>2],u=o[C+248>>2],e=o[C+156>>2],M=o[C+252>>2],n=o[C+160>>2],k=o[C+256>>2],f=o[C+164>>2],l=o[C+260>>2],Q=o[C+168>>2],s=o[C+264>>2],B=o[C+172>>2],r=o[C+268>>2],g=o[C+176>>2],i=o[C+272>>2],t=0-T|0,I=o[C+276>>2],o[C+276>>2]=t&(I^o[C+180>>2])^I,o[C+272>>2]=i^t&(g^i),o[C+268>>2]=r^t&(B^r),o[C+264>>2]=s^t&(Q^s),o[C+260>>2]=l^t&(f^l),o[C+256>>2]=k^t&(n^k),o[C+252>>2]=M^t&(e^M),o[C+248>>2]=u^t&(y^u),o[C+244>>2]=p^t&(c^p),o[C+240>>2]=H^t&(h^H),H=o[C+192>>2],h=o[C+96>>2],p=o[C+196>>2],c=o[C+100>>2],u=o[C+200>>2],y=o[C+104>>2],M=o[C+204>>2],e=o[C+108>>2],k=o[C+208>>2],n=o[C+112>>2],l=o[C+212>>2],f=o[C+116>>2],s=o[C+216>>2],Q=o[C+120>>2],r=o[C+220>>2],B=o[C+124>>2],i=o[C+224>>2],g=o[C+128>>2],I=o[C+228>>2],o[C+228>>2]=t&(I^o[C+132>>2])^I,o[C+224>>2]=i^t&(g^i),o[C+220>>2]=r^t&(B^r),o[C+216>>2]=s^t&(Q^s),o[C+212>>2]=l^t&(f^l),o[C+208>>2]=k^t&(n^k),o[C+204>>2]=M^t&(e^M),o[C+200>>2]=u^t&(y^u),o[C+196>>2]=p^t&(c^p),o[C+192>>2]=H^t&(h^H),X(g=C+192|0,g),F(I=C+240|0,I,g),W(A,I),$A(C+336|0,32),B=0}return D=C+368|0,0|B},function(A,I){var g,C,B,Q,i,n,r,f,t,e,c,y,w,h,s,p,u,k,l,S;return I|=0,D=g=D-304|0,E[0|(A|=0)]=a[0|I],E[A+1|0]=a[I+1|0],E[A+2|0]=a[I+2|0],E[A+3|0]=a[I+3|0],E[A+4|0]=a[I+4|0],E[A+5|0]=a[I+5|0],E[A+6|0]=a[I+6|0],E[A+7|0]=a[I+7|0],E[A+8|0]=a[I+8|0],E[A+9|0]=a[I+9|0],E[A+10|0]=a[I+10|0],E[A+11|0]=a[I+11|0],E[A+12|0]=a[I+12|0],E[A+13|0]=a[I+13|0],E[A+14|0]=a[I+14|0],E[A+15|0]=a[I+15|0],E[A+16|0]=a[I+16|0],E[A+17|0]=a[I+17|0],E[A+18|0]=a[I+18|0],E[A+19|0]=a[I+19|0],E[A+20|0]=a[I+20|0],E[A+21|0]=a[I+21|0],E[A+22|0]=a[I+22|0],E[A+23|0]=a[I+23|0],E[A+24|0]=a[I+24|0],E[A+25|0]=a[I+25|0],E[A+26|0]=a[I+26|0],E[A+27|0]=a[I+27|0],E[A+28|0]=a[I+28|0],E[A+29|0]=a[I+29|0],E[A+30|0]=a[I+30|0],I=a[I+31|0],E[0|A]=248&a[0|A],E[A+31|0]=63&I|64,v(g+48|0,A),I=o[g+132>>2],C=o[g+92>>2],B=o[g+136>>2],Q=o[g+96>>2],i=o[g+140>>2],n=o[g+100>>2],r=o[g+144>>2],f=o[g+104>>2],t=o[g+148>>2],e=o[g+108>>2],c=o[g+152>>2],y=o[g+112>>2],w=o[g+156>>2],h=o[g+116>>2],s=o[g+160>>2],p=o[g+120>>2],u=o[g+128>>2],k=o[g+88>>2],l=o[g+124>>2],S=o[g+164>>2],o[g+292>>2]=l+S,o[g+288>>2]=s+p,o[g+284>>2]=w+h,o[g+280>>2]=c+y,o[g+276>>2]=t+e,o[g+272>>2]=r+f,o[g+268>>2]=i+n,o[g+264>>2]=B+Q,o[g+260>>2]=I+C,o[g+256>>2]=u+k,o[g+244>>2]=S-l,o[g+240>>2]=s-p,o[g+236>>2]=w-h,o[g+232>>2]=c-y,o[g+228>>2]=t-e,o[g+224>>2]=r-f,o[g+220>>2]=i-n,o[g+216>>2]=B-Q,o[g+212>>2]=I-C,o[g+208>>2]=u-k,X(I=g+208|0,I),F(g,g+256|0,I),W(A,g),D=g+304|0,0},function(A,I,g,C,B){A|=0,C|=0,B|=0;var Q,i=0,n=0,r=0,f=0;if(D=Q=D-112|0,(I|=0)|(g|=0)){i=a[B+28|0]|a[B+29|0]<<8|a[B+30|0]<<16|a[B+31|0]<<24,o[Q+24>>2]=a[B+24|0]|a[B+25|0]<<8|a[B+26|0]<<16|a[B+27|0]<<24,o[Q+28>>2]=i,i=a[B+20|0]|a[B+21|0]<<8|a[B+22|0]<<16|a[B+23|0]<<24,o[Q+16>>2]=a[B+16|0]|a[B+17|0]<<8|a[B+18|0]<<16|a[B+19|0]<<24,o[Q+20>>2]=i,i=a[B+4|0]|a[B+5|0]<<8|a[B+6|0]<<16|a[B+7|0]<<24,o[Q>>2]=a[0|B]|a[B+1|0]<<8|a[B+2|0]<<16|a[B+3|0]<<24,o[Q+4>>2]=i,i=a[B+12|0]|a[B+13|0]<<8|a[B+14|0]<<16|a[B+15|0]<<24,o[Q+8>>2]=a[B+8|0]|a[B+9|0]<<8|a[B+10|0]<<16|a[B+11|0]<<24,o[Q+12>>2]=i,B=a[0|C]|a[C+1|0]<<8|a[C+2|0]<<16|a[C+3|0]<<24,C=a[C+4|0]|a[C+5|0]<<8|a[C+6|0]<<16|a[C+7|0]<<24,o[Q+104>>2]=0,o[Q+108>>2]=0,o[Q+96>>2]=B,o[Q+100>>2]=C;A:{if(!g&I>>>0>=64|g){for(;J(A,Q+96|0,Q),C=a[Q+104|0]+1|0,E[Q+104|0]=C,C=a[Q+105|0]+(C>>>8|0)|0,E[Q+105|0]=C,C=a[Q+106|0]+(C>>>8|0)|0,E[Q+106|0]=C,C=a[Q+107|0]+(C>>>8|0)|0,E[Q+107|0]=C,C=a[Q+108|0]+(C>>>8|0)|0,E[Q+108|0]=C,C=a[Q+109|0]+(C>>>8|0)|0,E[Q+109|0]=C,C=a[Q+110|0]+(C>>>8|0)|0,E[Q+110|0]=C,E[Q+111|0]=a[Q+111|0]+(C>>>8|0),A=A- -64|0,g=g-1|0,!(g=(I=I+-64|0)>>>0<4294967232?g+1|0:g)&I>>>0>63|g;);if(!(I|g))break A}if(C=0,J(Q+32|0,Q+96|0,Q),g=3&I,B=0,I-1>>>0>=3)for(i=-4&I,I=0;n=r=Q+32|0,E[A+B|0]=a[n+B|0],E[(f=1|B)+A|0]=a[n+f|0],E[(n=2|B)+A|0]=a[n+r|0],E[(n=3|B)+A|0]=a[n+(Q+32|0)|0],B=B+4|0,(0|i)!=(0|(I=I+4|0)););if(g)for(;E[A+B|0]=a[(Q+32|0)+B|0],B=B+1|0,(0|g)!=(0|(C=C+1|0)););}$A(Q+32|0,64),$A(Q,32)}return D=Q+112|0,0},function(A,I,g,C,B,Q,i,n){A|=0,I|=0,B|=0,Q|=0,i|=0,n|=0;var r,f=0;if(D=r=D-112|0,(g|=0)|(C|=0)){f=a[n+28|0]|a[n+29|0]<<8|a[n+30|0]<<16|a[n+31|0]<<24,o[r+24>>2]=a[n+24|0]|a[n+25|0]<<8|a[n+26|0]<<16|a[n+27|0]<<24,o[r+28>>2]=f,f=a[n+20|0]|a[n+21|0]<<8|a[n+22|0]<<16|a[n+23|0]<<24,o[r+16>>2]=a[n+16|0]|a[n+17|0]<<8|a[n+18|0]<<16|a[n+19|0]<<24,o[r+20>>2]=f,f=a[n+4|0]|a[n+5|0]<<8|a[n+6|0]<<16|a[n+7|0]<<24,o[r>>2]=a[0|n]|a[n+1|0]<<8|a[n+2|0]<<16|a[n+3|0]<<24,o[r+4>>2]=f,f=a[n+12|0]|a[n+13|0]<<8|a[n+14|0]<<16|a[n+15|0]<<24,o[r+8>>2]=a[n+8|0]|a[n+9|0]<<8|a[n+10|0]<<16|a[n+11|0]<<24,o[r+12>>2]=f,n=a[B+4|0]|a[B+5|0]<<8|a[B+6|0]<<16|a[B+7|0]<<24,o[r+96>>2]=a[0|B]|a[B+1|0]<<8|a[B+2|0]<<16|a[B+3|0]<<24,o[r+100>>2]=n,E[r+104|0]=Q,E[r+111|0]=i>>>24,E[r+110|0]=i>>>16,E[r+109|0]=i>>>8,E[r+108|0]=i,E[r+107|0]=(16777215&i)<<8|Q>>>24,E[r+106|0]=(65535&i)<<16|Q>>>16,E[r+105|0]=(255&i)<<24|Q>>>8;A:{if(!C&g>>>0>=64|C){for(;;){for(n=0,J(r+32|0,r+96|0,r);Q=r+32|0,E[A+n|0]=a[Q+n|0]^a[I+n|0],E[(B=1|n)+A|0]=a[B+Q|0]^a[I+B|0],64!=(0|(n=n+2|0)););if(B=a[r+104|0]+1|0,E[r+104|0]=B,B=a[r+105|0]+(B>>>8|0)|0,E[r+105|0]=B,B=a[r+106|0]+(B>>>8|0)|0,E[r+106|0]=B,B=a[r+107|0]+(B>>>8|0)|0,E[r+107|0]=B,B=a[r+108|0]+(B>>>8|0)|0,E[r+108|0]=B,B=a[r+109|0]+(B>>>8|0)|0,E[r+109|0]=B,B=a[r+110|0]+(B>>>8|0)|0,E[r+110|0]=B,E[r+111|0]=a[r+111|0]+(B>>>8|0),I=I- -64|0,A=A- -64|0,C=C-1|0,!(!(C=(g=g+-64|0)>>>0<4294967232?C+1|0:C)&g>>>0>63|C))break}if(!(g|C))break A}if(n=0,J(r+32|0,r+96|0,r),C=1&g,1!=(0|g))for(Q=-2&g,B=0;i=r+32|0,E[A+n|0]=a[i+n|0]^a[I+n|0],E[(g=1|n)+A|0]=a[g+i|0]^a[I+g|0],n=n+2|0,(0|Q)!=(0|(B=B+2|0)););C&&(E[A+n|0]=a[(r+32|0)+n|0]^a[I+n|0])}$A(r+32|0,64),$A(r,32)}return D=r+112|0,0}],aI.grow=function(A){var I=this.length;return this.length=this.length+A,I},aI.set=function(A,I){this[A]=I},aI.get=function(A){return this[A]},aI);function rI(){return i.byteLength/65536|0}return{f:function(){},g:function(A,I,g,C,B,Q,i,E,o,a,n,r){return 0|eA(A|=0,I|=0,g|=0,C|=0,(A=0)|(B|=0),Q|=0,i|=0,A|(E|=0),o|=0,n|=0,r|=0)},h:function(A,I,g,C,B,i,E,a,n,r,f){return A|=0,I|=0,n|=0,n=C|=0,!(C=B|=0)&(B=0|n)>>>0<4294967280?(eA(A,A+B|0,0,g|=0,B,C,i|=0,E|=0,a|=0,r|=0,f|=0),I&&(C=(A=B+16|0)>>>0<16?C+1|0:C,o[I>>2]=A,o[I+4>>2]=C)):(mA(),Q()),0},i:function(A,I,g,C,B,Q,i,E,o,a,n,r){return 0|fA(A|=0,I|=0,g|=0,C|=0,(A=0)|(B|=0),Q|=0,i|=0,A|(E|=0),o|=0,n|=0,r|=0)},j:function(A,I,g,C,B,i,E,a,n,r,f){return A|=0,I|=0,n|=0,n=C|=0,!(C=B|=0)&(B=0|n)>>>0<4294967280?(fA(A,A+B|0,0,g|=0,B,C,i|=0,E|=0,a|=0,r|=0,f|=0),I&&(C=(A=B+16|0)>>>0<16?C+1|0:C,o[I>>2]=A,o[I+4>>2]=C)):(mA(),Q()),0},k:function(A,I,g,C,B,Q,i,E,o,a,n){return 0|tA(A|=0,g|=0,(A=0)|(C|=0),B|=0,Q|=0,i|=0,A|(E|=0),o|=0,a|=0,n|=0)},l:function(A,I,g,C,B,Q,i,E,a,n,r){return I|=0,g|=0,C|=0,B|=0,E|=0,E|=0,g=-1,!(Q|=0)&(B|=0)>>>0>=16|Q&&(g=tA(A|=0,C,B-16|0,Q-(B>>>0<16)|0,(C+B|0)-16|0,i|=0,E,a|=0,n|=0,r|=0)),I&&(o[I>>2]=g?0:B-16|0,o[I+4>>2]=g?0:Q-(B>>>0<16)|0),0|g},m:function(A,I,g,C,B,Q,i,E,o,a,n){return 0|rA(A|=0,g|=0,(A=0)|(C|=0),B|=0,Q|=0,i|=0,A|(E|=0),o|=0,a|=0,n|=0)},n:function(A,I,g,C,B,Q,i,E,a,n,r){return I|=0,g|=0,C|=0,B|=0,E|=0,E|=0,g=-1,!(Q|=0)&(B|=0)>>>0>=16|Q&&(g=rA(A|=0,C,B-16|0,Q-(B>>>0<16)|0,(C+B|0)-16|0,i|=0,E,a|=0,n|=0,r|=0)),I&&(o[I>>2]=g?0:B-16|0,o[I+4>>2]=g?0:Q-(B>>>0<16)|0),0|g},o:II,p:function(){return 12},q:oI,r:AI,s:CI,t:ZA,u:II,v:EI,w:oI,x:AI,y:CI,z:ZA,A:function(A,I,g,C,B,Q,i,E,o,a,n,r){return 0|BA(A|=0,I|=0,g|=0,C|=0,(A=0)|(B|=0),Q|=0,i|=0,A|(E|=0),o|=0,n|=0,r|=0)},B:function(A,I,g,C,B,i,E,a,n,r,f){return A|=0,I|=0,n|=0,n=C|=0,!(C=B|=0)&(B=0|n)>>>0<4294967280?(BA(A,A+B|0,0,g|=0,B,C,i|=0,E|=0,a|=0,r|=0,f|=0),I&&(C=(A=B+16|0)>>>0<16?C+1|0:C,o[I>>2]=A,o[I+4>>2]=C)):(mA(),Q()),0},C:function(A,I,g,C,B,Q,i,E,o,a,n){return 0|CA(A|=0,g|=0,(A=0)|(C|=0),B|=0,Q|=0,i|=0,A|(E|=0),o|=0,a|=0,n|=0)},D:function(A,I,g,C,B,Q,i,E,a,n,r){return I|=0,g|=0,C|=0,B|=0,E|=0,E|=0,g=-1,!(Q|=0)&(B|=0)>>>0>=16|Q&&(g=CA(A|=0,C,B-16|0,Q-(B>>>0<16)|0,(C+B|0)-16|0,i|=0,E,a|=0,n|=0,r|=0)),I&&(o[I>>2]=g?0:B-16|0,o[I+4>>2]=g?0:Q-(B>>>0<16)|0),0|g},E:II,F:gI,G:oI,H:AI,I:CI,J:ZA,K:II,L:II,M:function(A,I,g,C,B){var Q;return A|=0,I|=0,g|=0,C|=0,D=Q=D-480|0,AA(Q,B|=0),WA(Q,I,g,C),UA(Q,Q+416|0),I=o[Q+444>>2],g=o[Q+440>>2],E[A+24|0]=g,E[A+25|0]=g>>>8,E[A+26|0]=g>>>16,E[A+27|0]=g>>>24,E[A+28|0]=I,E[A+29|0]=I>>>8,E[A+30|0]=I>>>16,E[A+31|0]=I>>>24,I=o[Q+436>>2],g=o[Q+432>>2],E[A+16|0]=g,E[A+17|0]=g>>>8,E[A+18|0]=g>>>16,E[A+19|0]=g>>>24,E[A+20|0]=I,E[A+21|0]=I>>>8,E[A+22|0]=I>>>16,E[A+23|0]=I>>>24,I=o[Q+428>>2],g=o[Q+424>>2],E[A+8|0]=g,E[A+9|0]=g>>>8,E[A+10|0]=g>>>16,E[A+11|0]=g>>>24,E[A+12|0]=I,E[A+13|0]=I>>>8,E[A+14|0]=I>>>16,E[A+15|0]=I>>>24,I=o[Q+420>>2],g=o[Q+416>>2],E[0|A]=g,E[A+1|0]=g>>>8,E[A+2|0]=g>>>16,E[A+3|0]=g>>>24,E[A+4|0]=I,E[A+5|0]=I>>>8,E[A+6|0]=I>>>16,E[A+7|0]=I>>>24,D=Q+480|0,0},N:function(A,I,g,C,B){var Q,i;return A|=0,I|=0,g|=0,C|=0,D=Q=D-512|0,AA(i=Q+32|0,B|=0),WA(i,I,g,C),UA(i,Q+448|0),I=o[Q+476>>2],o[Q+24>>2]=o[Q+472>>2],o[Q+28>>2]=I,I=o[Q+468>>2],o[Q+16>>2]=o[Q+464>>2],o[Q+20>>2]=I,I=o[Q+460>>2],o[Q+8>>2]=o[Q+456>>2],o[Q+12>>2]=I,I=o[Q+452>>2],o[Q>>2]=o[Q+448>>2],o[Q+4>>2]=I,I=cA(A,Q),g=oA(Q,A,32),D=Q+512|0,g|((0|A)==(0|Q)?-1:I)},O:ZA,P:II,Q:II,R:II,S:II,T:gI,U:AI,V:CI,W:function(A,I,g){A|=0,I|=0;var C,B=0;return D=C=D+-64|0,QA(C,g|=0,32,0),g=o[C+28>>2],B=o[C+24>>2],E[I+24|0]=B,E[I+25|0]=B>>>8,E[I+26|0]=B>>>16,E[I+27|0]=B>>>24,E[I+28|0]=g,E[I+29|0]=g>>>8,E[I+30|0]=g>>>16,E[I+31|0]=g>>>24,g=o[C+20>>2],B=o[C+16>>2],E[I+16|0]=B,E[I+17|0]=B>>>8,E[I+18|0]=B>>>16,E[I+19|0]=B>>>24,E[I+20|0]=g,E[I+21|0]=g>>>8,E[I+22|0]=g>>>16,E[I+23|0]=g>>>24,g=o[C+12>>2],B=o[C+8>>2],E[I+8|0]=B,E[I+9|0]=B>>>8,E[I+10|0]=B>>>16,E[I+11|0]=B>>>24,E[I+12|0]=g,E[I+13|0]=g>>>8,E[I+14|0]=g>>>16,E[I+15|0]=g>>>24,g=o[C+4>>2],B=o[C>>2],E[0|I]=B,E[I+1|0]=B>>>8,E[I+2|0]=B>>>16,E[I+3|0]=B>>>24,E[I+4|0]=g,E[I+5|0]=g>>>8,E[I+6|0]=g>>>16,E[I+7|0]=g>>>24,$A(C,64),A=VA(A,I),D=C- -64|0,0|A},X:dA,Y:SA,Z:JA,_:function(A,I,g,C,B,Q,i,E){var o,a;return A|=0,I|=0,g|=0,Q|=0,a=C|=0,C=B|=0,D=o=D-32|0,B=-1,SA(o,i|=0,E|=0)||(B=IA(A,I,g,a,C,Q,o),$A(o,32)),D=o+32|0,0|B},$:function(A,I,g,C,B,i){return A|=0,I|=0,B|=0,i|=0,!(C|=0)&(g|=0)>>>0>=4294967280|C&&(mA(),Q()),0|IA(A+16|0,A,I,g,C,B,i)},aa:function(A,I,g,C,B,Q,i){return 0|FA(A|=0,I|=0,g|=0,C|=0,B|=0,Q|=0,i|=0)},ba:NA,ca:function(A,I,g,C,B,Q,i,E){var o,a;return A|=0,I|=0,g|=0,Q|=0,a=C|=0,C=B|=0,D=o=D-32|0,B=-1,SA(o,i|=0,E|=0)||(B=gA(A,I,g,a,C,Q,o),$A(o,32)),D=o+32|0,0|B},da:lA,ea:function(A,I,g,C,B,Q,i){return 0|sA(A|=0,I|=0,g|=0,C|=0,B|=0,Q|=0,i|=0)},fa:function(A,I,g,C,B){A|=0,I|=0,B|=0;var Q,i,a,n=0,r=0;return i=g|=0,g=C|=0,a=C=D,D=Q=C-512&-64,C=-1,dA(Q- -64|0,Q+32|0)||(Y(C=Q+128|0,0,0,24),z(C,r=Q- -64|0,32,0),z(C,B,32,0),GA(C,n=Q+96|0,24),C=FA(A+32|0,I,i,g,n,C=B,B=Q+32|0),I=o[Q+92>>2],g=o[Q+88>>2],E[A+24|0]=g,E[A+25|0]=g>>>8,E[A+26|0]=g>>>16,E[A+27|0]=g>>>24,E[A+28|0]=I,E[A+29|0]=I>>>8,E[A+30|0]=I>>>16,E[A+31|0]=I>>>24,I=o[Q+84>>2],g=o[Q+80>>2],E[A+16|0]=g,E[A+17|0]=g>>>8,E[A+18|0]=g>>>16,E[A+19|0]=g>>>24,E[A+20|0]=I,E[A+21|0]=I>>>8,E[A+22|0]=I>>>16,E[A+23|0]=I>>>24,I=o[Q+76>>2],g=o[Q+72>>2],E[A+8|0]=g,E[A+9|0]=g>>>8,E[A+10|0]=g>>>16,E[A+11|0]=g>>>24,E[A+12|0]=I,E[A+13|0]=I>>>8,E[A+14|0]=I>>>16,E[A+15|0]=I>>>24,I=o[Q+68>>2],g=o[Q+64>>2],E[0|A]=g,E[A+1|0]=g>>>8,E[A+2|0]=g>>>16,E[A+3|0]=g>>>24,E[A+4|0]=I,E[A+5|0]=I>>>8,E[A+6|0]=I>>>16,E[A+7|0]=I>>>24,$A(B,32),$A(r,32),$A(n,24)),D=a,0|C},ga:function(A,I,g,C,B,Q){A|=0,I|=0,B|=0,Q|=0;var i,E,o=0,a=0;return i=o=D,D=o=o-448&-64,a=-1,E=C|=0,!C&(g|=0)>>>0>=48|C&&(Y(C=o- -64|0,0,0,24),z(C,I,32,0),z(C,B,32,0),GA(B=C,C=o+32|0,24),a=sA(A,I+32|0,g-32|0,E-(g>>>0<32)|0,C,I,Q)),D=i,0|a},ha:function(){return 48},ia:AI,ja:BI,ka:II,la:AI,ma:BI,na:II,oa:function(){return 384},pa:function(A,I,g,C,B,Q,i){return 0|R(A|=0,I|=0,g|=0,C|=0,B|=0,Q|=0,i|=0)},qa:Y,ra:function(A,I,g,C){return 0|z(A|=0,I|=0,g|=0,C|=0)},sa:GA,ta:ZA,ua:BI,va:function(A,I,g,C){return 0|QA(A|=0,I|=0,g|=0,C|=0)},wa:AI,xa:BI,ya:EI,za:II,Aa:function(A,I,g,C,B,i){A|=0,I|=0,g|=0,C|=0,i|=0;var E,n=0,r=0,f=0,t=0,e=0,c=0,y=0;return D=E=D-32|0,n=a[0|(B|=0)]|a[B+1|0]<<8|a[B+2|0]<<16|a[B+3|0]<<24,B=a[B+4|0]|a[B+5|0]<<8|a[B+6|0]<<16|a[B+7|0]<<24,o[E+24>>2]=0,o[E+28>>2]=0,o[E+16>>2]=n,o[E+20>>2]=B,o[E+8>>2]=0,o[E+12>>2]=0,o[(B=E)>>2]=g,o[B+4>>2]=C,I-65>>>0<=4294967246?(o[8916]=28,A=-1):I-65>>>0<4294967232?A=-1:(D=B=(f=D)-512&-64,!i|!A|((r=255&I)-65&255)>>>0<=191?(mA(),Q()):(C=E+16|0,E?(t=725511199^(a[E+8|0]|a[E+9|0]<<8|a[E+10|0]<<16|a[E+11|0]<<24),e=-1694144372^(a[E+12|0]|a[E+13|0]<<8|a[E+14|0]<<16|a[E+15|0]<<24),g=-1377402159^(a[0|E]|a[E+1|0]<<8|a[E+2|0]<<16|a[E+3|0]<<24),I=1359893119^(a[E+4|0]|a[E+5|0]<<8|a[E+6|0]<<16|a[E+7|0]<<24)):(t=725511199,e=-1694144372,g=-1377402159,I=1359893119),C?(c=327033209^(a[C+8|0]|a[C+9|0]<<8|a[C+10|0]<<16|a[C+11|0]<<24),y=1541459225^(a[C+12|0]|a[C+13|0]<<8|a[C+14|0]<<16|a[C+15|0]<<24),n=-79577749^(a[0|C]|a[C+1|0]<<8|a[C+2|0]<<16|a[C+3|0]<<24),C=528734635^(a[C+4|0]|a[C+5|0]<<8|a[C+6|0]<<16|a[C+7|0]<<24)):(c=327033209,y=1541459225,n=-79577749,C=528734635),MA(B- -64|0,0,293),o[B+56>>2]=c,o[B+60>>2]=y,o[B+48>>2]=n,o[B+52>>2]=C,o[B+40>>2]=t,o[B+44>>2]=e,o[B+32>>2]=g,o[B+36>>2]=I,o[B+24>>2]=1595750129,o[B+28>>2]=-1521486534,o[B+16>>2]=-23791573,o[B+20>>2]=1013904242,o[B+8>>2]=-2067093701,o[B+12>>2]=-1150833019,o[B>>2]=-222443256^(8192|r),o[B+4>>2]=1779033703,MA(32+(I=B+384|0)|0,0,96),HA(I,i,32),HA(B+96|0,I,128),o[B+352>>2]=128,$A(I,128),G(B,A,r),D=f),A=0),D=E+32|0,0|A},Ba:ZA,Ca:function(A,I,g){return A|=0,R(I|=0,32,g|=0,32,0,0,0),0|jA(A,I)},Da:function(A,I){return A|=0,hA(I|=0,32),0|jA(A,I)},Ea:function(A,I,g,C,B){I|=0,g|=0,C|=0,B|=0;var i,o,n=0,r=0;if(o=n=D,D=n=n-512&-64,i=(A|=0)||I){if(r=-1,!PA(n+96|0,C,B)){for(C=I||A,A=0,Y(I=n+128|0,0,0,64),z(I,r=n+96|0,32,0),$A(r,32),z(I,g,32,0),z(I,B,32,0),GA(I,n+32|0,64),$A(I,384);I=(B=n+32|0)+A|0,E[A+i|0]=a[0|I],E[A+C|0]=a[I+32|0],E[(g=1|A)+i|0]=a[g+B|0],E[g+C|0]=a[I+33|0],32!=(0|(A=A+2|0)););$A(n+32|0,64),r=0}return D=o,0|r}mA(),Q()},Fa:function(A,I,g,C,B){I|=0,g|=0,C|=0,B|=0;var i,o,n=0,r=0;if(o=n=D,D=n=n-512&-64,i=(A|=0)||I){if(r=-1,!PA(n+96|0,C,B)){for(C=I||A,A=0,Y(I=n+128|0,0,0,64),z(I,r=n+96|0,32,0),$A(r,32),z(I,B,32,0),z(I,g,32,0),GA(I,n+32|0,64),$A(I,384);I=(B=n+32|0)+A|0,E[A+C|0]=a[0|I],E[A+i|0]=a[I+32|0],E[(g=1|A)+C|0]=a[g+B|0],E[g+i|0]=a[I+33|0],32!=(0|(A=A+2|0)););$A(n+32|0,64),r=0}return D=o,0|r}mA(),Q()},Ga:II,Ha:II,Ia:II,Ja:II,Ka:jA,La:PA,Ma:II,Na:II,Oa:II,Pa:gI,Qa:AI,Ra:CI,Sa:ZA,Ta:JA,Ua:function(A,I,g,C,B,i){return A|=0,I|=0,B|=0,i|=0,!(C|=0)&(g|=0)>>>0>=4294967280|C&&(mA(),Q()),IA(A+16|0,A,I,g,C,B,i),0},Va:NA,Wa:lA,Xa:ZA,Ya:function(A,I,g){return A|=0,g|=0,hA(I|=0,24),d(A,I,g),E[A+32|0]=1,E[A+33|0]=0,E[A+34|0]=0,E[A+35|0]=0,g=a[I+16|0]|a[I+17|0]<<8|a[I+18|0]<<16|a[I+19|0]<<24,I=a[I+20|0]|a[I+21|0]<<8|a[I+22|0]<<16|a[I+23|0]<<24,E[A+44|0]=0,E[A+45|0]=0,E[A+46|0]=0,E[A+47|0]=0,E[A+48|0]=0,E[A+49|0]=0,E[A+50|0]=0,E[A+51|0]=0,E[A+36|0]=g,E[A+37|0]=g>>>8,E[A+38|0]=g>>>16,E[A+39|0]=g>>>24,E[A+40|0]=I,E[A+41|0]=I>>>8,E[A+42|0]=I>>>16,E[A+43|0]=I>>>24,0},Za:function(A,I,g){return d(A|=0,I|=0,g|=0),E[A+32|0]=1,E[A+33|0]=0,E[A+34|0]=0,E[A+35|0]=0,g=a[I+16|0]|a[I+17|0]<<8|a[I+18|0]<<16|a[I+19|0]<<24,I=a[I+20|0]|a[I+21|0]<<8|a[I+22|0]<<16|a[I+23|0]<<24,E[A+44|0]=0,E[A+45|0]=0,E[A+46|0]=0,E[A+47|0]=0,E[A+48|0]=0,E[A+49|0]=0,E[A+50|0]=0,E[A+51|0]=0,E[A+36|0]=g,E[A+37|0]=g>>>8,E[A+38|0]=g>>>16,E[A+39|0]=g>>>24,E[A+40|0]=I,E[A+41|0]=I>>>8,E[A+42|0]=I>>>16,E[A+43|0]=I>>>24,0},_a:function(A){var I,g=0,C=0;D=I=D-48|0,g=a[28+(A|=0)|0]|a[A+29|0]<<8|a[A+30|0]<<16|a[A+31|0]<<24,o[I+24>>2]=a[A+24|0]|a[A+25|0]<<8|a[A+26|0]<<16|a[A+27|0]<<24,o[I+28>>2]=g,g=a[A+20|0]|a[A+21|0]<<8|a[A+22|0]<<16|a[A+23|0]<<24,o[I+16>>2]=a[A+16|0]|a[A+17|0]<<8|a[A+18|0]<<16|a[A+19|0]<<24,o[I+20>>2]=g,g=a[A+4|0]|a[A+5|0]<<8|a[A+6|0]<<16|a[A+7|0]<<24,o[I>>2]=a[0|A]|a[A+1|0]<<8|a[A+2|0]<<16|a[A+3|0]<<24,o[I+4>>2]=g,g=a[A+12|0]|a[A+13|0]<<8|a[A+14|0]<<16|a[A+15|0]<<24,o[I+8>>2]=a[A+8|0]|a[A+9|0]<<8|a[A+10|0]<<16|a[A+11|0]<<24,o[I+12>>2]=g,g=a[A+40|0]|a[A+41|0]<<8|a[A+42|0]<<16|a[A+43|0]<<24,o[I+32>>2]=a[A+36|0]|a[A+37|0]<<8|a[A+38|0]<<16|a[A+39|0]<<24,o[I+36>>2]=g,xA(I,I,A+32|0,A),g=o[I+28>>2],C=o[I+24>>2],E[A+24|0]=C,E[A+25|0]=C>>>8,E[A+26|0]=C>>>16,E[A+27|0]=C>>>24,E[A+28|0]=g,E[A+29|0]=g>>>8,E[A+30|0]=g>>>16,E[A+31|0]=g>>>24,g=o[I+20>>2],C=o[I+16>>2],E[A+16|0]=C,E[A+17|0]=C>>>8,E[A+18|0]=C>>>16,E[A+19|0]=C>>>24,E[A+20|0]=g,E[A+21|0]=g>>>8,E[A+22|0]=g>>>16,E[A+23|0]=g>>>24,g=o[I+12>>2],C=o[I+8>>2],E[A+8|0]=C,E[A+9|0]=C>>>8,E[A+10|0]=C>>>16,E[A+11|0]=C>>>24,E[A+12|0]=g,E[A+13|0]=g>>>8,E[A+14|0]=g>>>16,E[A+15|0]=g>>>24,g=o[I+4>>2],C=o[I>>2],E[0|A]=C,E[A+1|0]=C>>>8,E[A+2|0]=C>>>16,E[A+3|0]=C>>>24,E[A+4|0]=g,E[A+5|0]=g>>>8,E[A+6|0]=g>>>16,E[A+7|0]=g>>>24,C=o[I+36>>2],g=o[I+32>>2],E[A+32|0]=1,E[A+33|0]=0,E[A+34|0]=0,E[A+35|0]=0,E[A+36|0]=g,E[A+37|0]=g>>>8,E[A+38|0]=g>>>16,E[A+39|0]=g>>>24,E[A+40|0]=C,E[A+41|0]=C>>>8,E[A+42|0]=C>>>16,E[A+43|0]=C>>>24,D=I+48|0},$a:function(A,I,g,C,B,i,n,r,f,t){A|=0,I|=0,C|=0,n|=0,f|=0,t|=0;var e,c=0,y=0,w=0;return c=B|=0,B=i|=0,c|=i=0,e=i|(r|=0),D=i=D-384|0,(g|=0)&&(o[g>>2]=0,o[g+4>>2]=0),!B&c>>>0<4294967279?(XA(y=i+16|0,64,w=A+32|0,A),OA(r=i+80|0,y),$A(y,64),zA(r,n,e,f),zA(r,33904,0-e&15,0),o[i+72>>2]=0,o[i+76>>2]=0,o[(n=i- -64|0)>>2]=0,o[n+4>>2]=0,o[i+56>>2]=0,o[i+60>>2]=0,o[i+48>>2]=0,o[i+52>>2]=0,o[i+40>>2]=0,o[i+44>>2]=0,o[i+32>>2]=0,o[i+36>>2]=0,o[i+16>>2]=0,o[i+20>>2]=0,o[i+24>>2]=0,o[i+28>>2]=0,E[i+16|0]=t,wA(y,y,64,0,w,1,A),zA(r,y,64,0),E[0|I]=a[i+16|0],wA(I=I+1|0,C,c,B,w,2,A),zA(r,I,c,B),zA(r,33904,15&c,0),o[i+8>>2]=e,o[i+12>>2]=f,zA(r,C=i+8|0,8,0),o[i+8>>2]=c- -64,o[i+12>>2]=B-((c>>>0<4294967232)-1|0),zA(r,C,8,0),TA(r,I=I+c|0),$A(r,256),E[A+36|0]=a[A+36|0]^a[0|I],E[A+37|0]=a[A+37|0]^a[I+1|0],E[A+38|0]=a[A+38|0]^a[I+2|0],E[A+39|0]=a[A+39|0]^a[I+3|0],E[A+40|0]=a[A+40|0]^a[I+4|0],E[A+41|0]=a[A+41|0]^a[I+5|0],E[A+42|0]=a[A+42|0]^a[I+6|0],E[A+43|0]=a[A+43|0]^a[I+7|0],yA(w),(2&t||iA(w,4))&&(I=a[A+28|0]|a[A+29|0]<<8|a[A+30|0]<<16|a[A+31|0]<<24,o[i+360>>2]=a[A+24|0]|a[A+25|0]<<8|a[A+26|0]<<16|a[A+27|0]<<24,o[i+364>>2]=I,I=a[A+20|0]|a[A+21|0]<<8|a[A+22|0]<<16|a[A+23|0]<<24,o[i+352>>2]=a[A+16|0]|a[A+17|0]<<8|a[A+18|0]<<16|a[A+19|0]<<24,o[i+356>>2]=I,I=a[A+4|0]|a[A+5|0]<<8|a[A+6|0]<<16|a[A+7|0]<<24,o[i+336>>2]=a[0|A]|a[A+1|0]<<8|a[A+2|0]<<16|a[A+3|0]<<24,o[i+340>>2]=I,I=a[A+12|0]|a[A+13|0]<<8|a[A+14|0]<<16|a[A+15|0]<<24,o[i+344>>2]=a[A+8|0]|a[A+9|0]<<8|a[A+10|0]<<16|a[A+11|0]<<24,o[i+348>>2]=I,I=a[A+40|0]|a[A+41|0]<<8|a[A+42|0]<<16|a[A+43|0]<<24,o[i+368>>2]=a[A+36|0]|a[A+37|0]<<8|a[A+38|0]<<16|a[A+39|0]<<24,o[i+372>>2]=I,xA(I=i+336|0,I,w,A),I=o[i+364>>2],C=o[i+360>>2],E[A+24|0]=C,E[A+25|0]=C>>>8,E[A+26|0]=C>>>16,E[A+27|0]=C>>>24,E[A+28|0]=I,E[A+29|0]=I>>>8,E[A+30|0]=I>>>16,E[A+31|0]=I>>>24,I=o[i+356>>2],C=o[i+352>>2],E[A+16|0]=C,E[A+17|0]=C>>>8,E[A+18|0]=C>>>16,E[A+19|0]=C>>>24,E[A+20|0]=I,E[A+21|0]=I>>>8,E[A+22|0]=I>>>16,E[A+23|0]=I>>>24,I=o[i+348>>2],C=o[i+344>>2],E[A+8|0]=C,E[A+9|0]=C>>>8,E[A+10|0]=C>>>16,E[A+11|0]=C>>>24,E[A+12|0]=I,E[A+13|0]=I>>>8,E[A+14|0]=I>>>16,E[A+15|0]=I>>>24,I=o[i+340>>2],C=o[i+336>>2],E[0|A]=C,E[A+1|0]=C>>>8,E[A+2|0]=C>>>16,E[A+3|0]=C>>>24,E[A+4|0]=I,E[A+5|0]=I>>>8,E[A+6|0]=I>>>16,E[A+7|0]=I>>>24,I=o[i+368>>2],C=o[i+372>>2],E[A+32|0]=1,E[A+33|0]=0,E[A+34|0]=0,E[A+35|0]=0,E[A+36|0]=I,E[A+37|0]=I>>>8,E[A+38|0]=I>>>16,E[A+39|0]=I>>>24,E[A+40|0]=C,E[A+41|0]=C>>>8,E[A+42|0]=C>>>16,E[A+43|0]=C>>>24),g&&(B=(A=c+17|0)>>>0<17?B+1|0:B,o[g>>2]=A,o[g+4>>2]=B),D=i+384|0):(mA(),Q()),0},ab:function(A,I,g,C,B,i,n,r,f,t){A|=0,I|=0,C|=0,B|=0,r|=0,t|=0;var e,c=0,y=0,w=0,h=0,s=0,p=0;c=i|=0,i=n|=0,y=0|c,e=f|=0,D=n=D-400|0,(g|=0)&&(o[g>>2]=0,o[g+4>>2]=0),C&&(E[0|C]=255),p=-1;A:{I:{if(!(!i&y>>>0<17)){if(s=c=i-(y>>>0<17)|0,!c&(f=y-17|0)>>>0>=4294967279|c)break I;XA(w=n+32|0,64,h=A+32|0,A),OA(c=n+96|0,w),$A(w,64),zA(c,r,e,t),zA(c,33904,0-e&15,0),o[n+88>>2]=0,o[n+92>>2]=0,o[n+80>>2]=0,o[n+84>>2]=0,o[n+72>>2]=0,o[n+76>>2]=0,o[(r=n- -64|0)>>2]=0,o[r+4>>2]=0,o[n+56>>2]=0,o[n+60>>2]=0,o[n+48>>2]=0,o[n+52>>2]=0,o[n+40>>2]=0,o[n+44>>2]=0,o[n+32>>2]=0,o[n+36>>2]=0,E[n+32|0]=a[0|B],wA(w,w,64,0,h,1,A),r=a[n+32|0],E[n+32|0]=a[0|B],zA(c,w,64,0),zA(c,B=B+1|0,f,s),zA(c,33904,y-1&15,0),o[n+24>>2]=e,o[n+28>>2]=t,zA(c,t=n+24|0,8,0),i=(y=y+47|0)>>>0<47?i+1|0:i,o[n+24>>2]=y,o[n+28>>2]=i,zA(c,t,8,0),TA(c,n),$A(c,256),oA(n,B+f|0,16)?$A(n,16):(wA(I,B,f,s,h,2,A),E[A+36|0]=a[A+36|0]^a[0|n],E[A+37|0]=a[A+37|0]^a[n+1|0],E[A+38|0]=a[A+38|0]^a[n+2|0],E[A+39|0]=a[A+39|0]^a[n+3|0],E[A+40|0]=a[A+40|0]^a[n+4|0],E[A+41|0]=a[A+41|0]^a[n+5|0],E[A+42|0]=a[A+42|0]^a[n+6|0],E[A+43|0]=a[A+43|0]^a[n+7|0],yA(h),(2&r||iA(h,4))&&(I=a[A+28|0]|a[A+29|0]<<8|a[A+30|0]<<16|a[A+31|0]<<24,o[n+376>>2]=a[A+24|0]|a[A+25|0]<<8|a[A+26|0]<<16|a[A+27|0]<<24,o[n+380>>2]=I,I=a[A+20|0]|a[A+21|0]<<8|a[A+22|0]<<16|a[A+23|0]<<24,o[n+368>>2]=a[A+16|0]|a[A+17|0]<<8|a[A+18|0]<<16|a[A+19|0]<<24,o[n+372>>2]=I,I=a[A+4|0]|a[A+5|0]<<8|a[A+6|0]<<16|a[A+7|0]<<24,o[n+352>>2]=a[0|A]|a[A+1|0]<<8|a[A+2|0]<<16|a[A+3|0]<<24,o[n+356>>2]=I,I=a[A+12|0]|a[A+13|0]<<8|a[A+14|0]<<16|a[A+15|0]<<24,o[n+360>>2]=a[A+8|0]|a[A+9|0]<<8|a[A+10|0]<<16|a[A+11|0]<<24,o[n+364>>2]=I,I=a[A+40|0]|a[A+41|0]<<8|a[A+42|0]<<16|a[A+43|0]<<24,o[n+384>>2]=a[A+36|0]|a[A+37|0]<<8|a[A+38|0]<<16|a[A+39|0]<<24,o[n+388>>2]=I,xA(I=n+352|0,I,h,A),I=o[n+380>>2],B=o[n+376>>2],E[A+24|0]=B,E[A+25|0]=B>>>8,E[A+26|0]=B>>>16,E[A+27|0]=B>>>24,E[A+28|0]=I,E[A+29|0]=I>>>8,E[A+30|0]=I>>>16,E[A+31|0]=I>>>24,I=o[n+372>>2],B=o[n+368>>2],E[A+16|0]=B,E[A+17|0]=B>>>8,E[A+18|0]=B>>>16,E[A+19|0]=B>>>24,E[A+20|0]=I,E[A+21|0]=I>>>8,E[A+22|0]=I>>>16,E[A+23|0]=I>>>24,I=o[n+364>>2],B=o[n+360>>2],E[A+8|0]=B,E[A+9|0]=B>>>8,E[A+10|0]=B>>>16,E[A+11|0]=B>>>24,E[A+12|0]=I,E[A+13|0]=I>>>8,E[A+14|0]=I>>>16,E[A+15|0]=I>>>24,I=o[n+356>>2],B=o[n+352>>2],E[0|A]=B,E[A+1|0]=B>>>8,E[A+2|0]=B>>>16,E[A+3|0]=B>>>24,E[A+4|0]=I,E[A+5|0]=I>>>8,E[A+6|0]=I>>>16,E[A+7|0]=I>>>24,I=o[n+384>>2],B=o[n+388>>2],E[A+32|0]=1,E[A+33|0]=0,E[A+34|0]=0,E[A+35|0]=0,E[A+36|0]=I,E[A+37|0]=I>>>8,E[A+38|0]=I>>>16,E[A+39|0]=I>>>24,E[A+40|0]=B,E[A+41|0]=B>>>8,E[A+42|0]=B>>>16,E[A+43|0]=B>>>24),g&&(o[g>>2]=f,o[g+4>>2]=s),p=0,C&&(E[0|C]=r))}D=n+400|0;break A}mA(),Q()}return 0|p},bb:function(){return 52},cb:function(){return 17},db:gI,eb:II,fb:function(){return-18},gb:oI,hb:QI,ib:function(){return 2},jb:iI,kb:EI,lb:AI,mb:function(A,I,g,C,B){A|=0,I|=0,g|=0,C|=0;var Q,i=0,o=0,n=0,r=0,f=0,t=0,e=0,c=0,y=0,D=0,h=0,s=0,p=0,u=0,k=0,F=0;if(p=1886610805^(B=a[0|(i=B|=0)]|a[i+1|0]<<8|a[i+2|0]<<16|a[i+3|0]<<24),u=1936682341^(o=a[i+4|0]|a[i+5|0]<<8|a[i+6|0]<<16|a[i+7|0]<<24),B^=1852142177,n=1819895653^o,k=1852075885^(o=a[i+8|0]|a[i+9|0]<<8|a[i+10|0]<<16|a[i+11|0]<<24),F=1685025377^(i=a[i+12|0]|a[i+13|0]<<8|a[i+14|0]<<16|a[i+15|0]<<24),r=2037671283^o,o=1952801890^i,D=g,(0|(c=(I+g|0)-(Q=7&g)|0))!=(0|I)){for(;g=(h=o^(s=a[I+4|0]|a[I+5|0]<<8|a[I+6|0]<<16|a[I+7|0]<<24))+n|0,r=B=(i=C=r^(y=a[0|I]|a[I+1|0]<<8|a[I+2|0]<<16|a[I+3|0]<<24))+B|0,e=g=B>>>0>>0?g+1|0:g,g=u+F|0,g=(n=p+k|0)>>>0>>0?g+1|0:g,i=nA(k,F,13)^n,o=g,g=e+(B=g^w)|0,g=i>>>0>(f=r+i|0)>>>0?g+1|0:g,i=nA(i,B,17)^f,t=g,p=nA(i,B=g^w,13),u=w,g=nA(C,h,16),C=e^w,h=g^r,o=nA(n,o,32),g=w+C|0,g=(o=(n=h+o|0)>>>0>>0?g+1|0:g)+B|0,e=g=(r=i+n|0)>>>0>>0?g+1|0:g,p=nA(i=r^p,B=g^u,17),u=w,g=nA(h,C,21),C=o^w,h=g^n,o=nA(f,t,32),g=w+C|0,g=(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>>>24,A^=g^w,E[I+4|0]=A,E[I+5|0]=A>>>8,E[I+6|0]=A>>>16,E[I+7|0]=A>>>24,0},nb:function(A){hA(A|=0,16)},ob:function(){return 208},pb:BI,qb:II,rb:II,sb:BI,tb:function(){return-65},ub:function(A,I,g){A|=0;var C,B,Q,i,o=0,n=0,r=0,f=0,t=0;return D=Q=D-160|0,QA(I|=0,g|=0,32,0),E[0|I]=248&a[0|I],E[I+31|0]=63&a[I+31|0]|64,v(Q,I),uA(A,Q),n=a[(B=g)+8|0]|a[B+9|0]<<8|a[B+10|0]<<16|a[B+11|0]<<24,o=a[B+12|0]|a[B+13|0]<<8|a[B+14|0]<<16|a[B+15|0]<<24,r=a[B+16|0]|a[B+17|0]<<8|a[B+18|0]<<16|a[B+19|0]<<24,f=a[B+20|0]|a[B+21|0]<<8|a[B+22|0]<<16|a[B+23|0]<<24,t=a[0|B]|a[B+1|0]<<8|a[B+2|0]<<16|a[B+3|0]<<24,g=a[B+4|0]|a[B+5|0]<<8|a[B+6|0]<<16|a[B+7|0]<<24,i=a[B+28|0]|a[B+29|0]<<8|a[B+30|0]<<16|a[B+31|0]<<24,C=I,I=a[B+24|0]|a[B+25|0]<<8|a[B+26|0]<<16|a[B+27|0]<<24,E[C+24|0]=I,E[C+25|0]=I>>>8,E[C+26|0]=I>>>16,E[C+27|0]=I>>>24,E[C+28|0]=i,E[C+29|0]=i>>>8,E[C+30|0]=i>>>16,E[C+31|0]=i>>>24,E[C+16|0]=r,E[C+17|0]=r>>>8,E[C+18|0]=r>>>16,E[C+19|0]=r>>>24,E[C+20|0]=f,E[C+21|0]=f>>>8,E[C+22|0]=f>>>16,E[C+23|0]=f>>>24,E[C+8|0]=n,E[C+9|0]=n>>>8,E[C+10|0]=n>>>16,E[C+11|0]=n>>>24,E[C+12|0]=o,E[C+13|0]=o>>>8,E[C+14|0]=o>>>16,E[C+15|0]=o>>>24,E[0|C]=t,E[C+1|0]=t>>>8,E[C+2|0]=t>>>16,E[C+3|0]=t>>>24,E[C+4|0]=g,E[C+5|0]=g>>>8,E[C+6|0]=g>>>16,E[C+7|0]=g>>>24,r=a[(o=A)+8|0]|a[o+9|0]<<8|a[o+10|0]<<16|a[o+11|0]<<24,f=a[o+12|0]|a[o+13|0]<<8|a[o+14|0]<<16|a[o+15|0]<<24,t=a[o+16|0]|a[o+17|0]<<8|a[o+18|0]<<16|a[o+19|0]<<24,g=a[o+20|0]|a[o+21|0]<<8|a[o+22|0]<<16|a[o+23|0]<<24,I=a[0|o]|a[o+1|0]<<8|a[o+2|0]<<16|a[o+3|0]<<24,A=a[o+4|0]|a[o+5|0]<<8|a[o+6|0]<<16|a[o+7|0]<<24,n=a[o+28|0]|a[o+29|0]<<8|a[o+30|0]<<16|a[o+31|0]<<24,o=a[o+24|0]|a[o+25|0]<<8|a[o+26|0]<<16|a[o+27|0]<<24,E[C+56|0]=o,E[C+57|0]=o>>>8,E[C+58|0]=o>>>16,E[C+59|0]=o>>>24,E[C+60|0]=n,E[C+61|0]=n>>>8,E[C+62|0]=n>>>16,E[C+63|0]=n>>>24,E[C+48|0]=t,E[C+49|0]=t>>>8,E[C+50|0]=t>>>16,E[C+51|0]=t>>>24,E[C+52|0]=g,E[C+53|0]=g>>>8,E[C+54|0]=g>>>16,E[C+55|0]=g>>>24,E[C+40|0]=r,E[C+41|0]=r>>>8,E[C+42|0]=r>>>16,E[C+43|0]=r>>>24,E[C+44|0]=f,E[C+45|0]=f>>>8,E[C+46|0]=f>>>16,E[C+47|0]=f>>>24,E[C+32|0]=I,E[C+33|0]=I>>>8,E[C+34|0]=I>>>16,E[C+35|0]=I>>>24,E[C+36|0]=A,E[C+37|0]=A>>>8,E[C+38|0]=A>>>16,E[C+39|0]=A>>>24,D=Q+160|0,0},vb:function(A,I){A|=0,I|=0;var g,C,B,Q,i,n=0,r=0,f=0;return D=r=D-192|0,hA(r,32),QA(I,r,32,0),E[0|I]=248&a[0|I],E[I+31|0]=63&a[I+31|0]|64,v(f=r+32|0,I),uA(A,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>>>24,E[I+48|0]=Q,E[I+49|0]=Q>>>8,E[I+50|0]=Q>>>16,E[I+51|0]=Q>>>24,E[I+52|0]=f,E[I+53|0]=f>>>8,E[I+54|0]=f>>>16,E[I+55|0]=f>>>24,E[I+40|0]=C,E[I+41|0]=C>>>8,E[I+42|0]=C>>>16,E[I+43|0]=C>>>24,E[I+44|0]=B,E[I+45|0]=B>>>8,E[I+46|0]=B>>>16,E[I+47|0]=B>>>24,E[I+32|0]=r,E[I+33|0]=r>>>8,E[I+34|0]=r>>>16,E[I+35|0]=r>>>24,E[I+36|0]=A,E[I+37|0]=A>>>8,E[I+38|0]=A>>>16,E[I+39|0]=A>>>24,$A(g,32),D=g+192|0,0},wb:function(A,I,g,C,B,Q){I|=0,B|=0,Q|=0;var i,E=0;return D=i=D-16|0,s(A|=0,i+8|0,kA(A- -64|0,g|=0,C|=0),C,B,Q,0),64!=o[i+8>>2]|o[i+12>>2]?(I&&(o[I>>2]=0,o[I+4>>2]=0),MA(A,0,C- -64|0),E=-1):I&&(o[I>>2]=C- -64,o[I+4>>2]=B-((C>>>0<4294967232)-1|0)),D=i+16|0,0|E},xb:function(A,I,g,C,B,Q){A|=0,I|=0,g|=0;var i=0;A:{I:{if(!(!(B|=0)&(C|=0)>>>0<64||(B=B-1|0,!(B=(C=C+-64|0)>>>0<4294967232?B+1|0:B)&C>>>0>4294967231|B))){if(!k(g,i=g- -64|0,C,B,Q|=0,0))break I;A&&MA(A,0,C)}if(g=-1,!I)break A;o[I>>2]=0,o[I+4>>2]=0;break A}I&&(o[I>>2]=C,o[I+4>>2]=B),g=0,A&&kA(A,i,C)}return 0|g},yb:function(A,I,g,C,B,Q){return s(A|=0,I|=0,g|=0,C|=0,B|=0,Q|=0,0),0},zb:function(A,I,g,C,B){return 0|k(A|=0,I|=0,g|=0,C|=0,B|=0,0)},Ab:function(A){return EA(A|=0),0},Bb:function(A,I,g,C){return 0|m(A|=0,I|=0,g|=0,C|=0)},Cb:function(A,I,g,C){var B;return I|=0,g|=0,C|=0,D=B=D+-64|0,M(A|=0,B),A=s(I,g,B,64,0,C,1),D=B- -64|0,0|A},Db:function(A,I,g){var C;return I|=0,g|=0,D=C=D+-64|0,M(A|=0,C),A=k(I,C,64,0,g,1),D=C- -64|0,0|A},Eb:function(A,I){A|=0;var g,C=0,B=0,Q=0,i=0,a=0,n=0,f=0,t=0,e=0,c=0,y=0,h=0,s=0,p=0,u=0,k=0,S=0,H=0,M=0,G=0,J=0,N=0,Y=0,K=0,P=0,v=0,m=0,d=0,L=0,R=0,x=0,j=0,q=0,z=0,O=0,T=0,Z=0,$=0,AA=0,IA=0,gA=0,CA=0,BA=0,QA=0,EA=0,oA=0,nA=0,rA=0,fA=0,tA=0,eA=0,cA=0,yA=0,wA=0,hA=0,sA=0,pA=0,uA=0,kA=0,FA=0,lA=0,SA=0,HA=0,GA=0,UA=0,JA=0,NA=0,YA=0,bA=0,_A=0,KA=0,PA=0,vA=0,mA=0,dA=0,LA=0,RA=0,xA=0,jA=0,XA=0;if(D=g=D-256|0,PA=-1,!aA(I|=0)&&!U(g+96|0,I)){for(D=C=D-2048|0,V(s=C+640|0,I=g+96|0),B=o[I+8>>2],i=o[I+12>>2],Q=o[I+16>>2],a=o[I+20>>2],e=o[I+24>>2],c=o[I+28>>2],n=o[I>>2],f=o[I+4>>2],p=o[I+36>>2],o[C+352>>2]=o[I+32>>2],o[C+356>>2]=p,o[C+344>>2]=e,o[C+348>>2]=c,o[C+336>>2]=Q,o[C+340>>2]=a,o[C+328>>2]=B,o[C+332>>2]=i,o[C+320>>2]=n,o[C+324>>2]=f,B=o[I+40>>2],i=o[I+44>>2],Q=o[I+48>>2],a=o[I+52>>2],e=o[I+56>>2],c=o[I+60>>2],f=o[(n=I- -64|0)>>2],n=o[n+4>>2],p=o[I+76>>2],o[C+392>>2]=o[I+72>>2],o[C+396>>2]=p,o[C+384>>2]=f,o[C+388>>2]=n,o[C+376>>2]=e,o[C+380>>2]=c,o[C+368>>2]=Q,o[C+372>>2]=a,o[C+360>>2]=B,o[C+364>>2]=i,B=o[I+80>>2],i=o[I+84>>2],Q=o[I+88>>2],a=o[I+92>>2],e=o[I+96>>2],c=o[I+100>>2],n=o[I+104>>2],f=o[I+108>>2],p=o[I+116>>2],o[C+432>>2]=o[I+112>>2],o[C+436>>2]=p,o[C+424>>2]=n,o[C+428>>2]=f,o[C+416>>2]=e,o[C+420>>2]=c,o[C+408>>2]=Q,o[C+412>>2]=a,o[C+400>>2]=B,o[C+404>>2]=i,l(I=C+480|0,B=C+320|0),F(n=C+160|0,I,i=C+600|0),F(C+200|0,Q=C+520|0,a=C+560|0),F(C+240|0,a,i),F(C+280|0,I,Q),_(I,n,s),F(B,I,i),F(s=C+360|0,Q,a),F(e=C+400|0,a,i),F(c=C+440|0,I,Q),V(f=C+800|0,B),_(I,n,f),F(B,I,i),F(s,Q,a),F(e,a,i),F(c,I,Q),V(f=C+960|0,B),_(I,n,f),F(B,I,i),F(s,Q,a),F(e,a,i),F(c,I,Q),V(f=C+1120|0,B),_(I,n,f),F(B,I,i),F(s,Q,a),F(e,a,i),F(c,I,Q),V(f=C+1280|0,B),_(I,n,f),F(B,I,i),F(s,Q,a),F(e,a,i),F(c,I,Q),V(f=C+1440|0,B),_(I,n,f),F(B,I,i),F(s,Q,a),F(e,a,i),F(c,I,Q),V(f=C+1600|0,B),_(I,n,f),F(B,I,i),F(s,Q,a),F(e,a,i),F(c,I,Q),V(C+1760|0,B),o[C+32>>2]=0,o[C+36>>2]=0,o[C+24>>2]=0,o[C+28>>2]=0,o[C+16>>2]=0,o[C+20>>2]=0,o[C+8>>2]=0,o[C+12>>2]=0,o[C+44>>2]=0,o[C+48>>2]=0,o[C+52>>2]=0,o[C+56>>2]=0,o[C+60>>2]=0,o[C+64>>2]=0,o[C+68>>2]=0,o[C+72>>2]=0,o[C+76>>2]=0,o[C+80>>2]=1,o[C>>2]=0,o[C+4>>2]=0,o[C+40>>2]=1,MA(C+84|0,0,76),f=C+120|0,p=C+80|0,M=C+40|0,I=252;B=o[C+36>>2],o[C+1960>>2]=o[C+32>>2],o[C+1964>>2]=B,B=o[C+28>>2],o[C+1952>>2]=o[C+24>>2],o[C+1956>>2]=B,B=o[C+20>>2],o[C+1944>>2]=o[C+16>>2],o[C+1948>>2]=B,B=o[C+12>>2],o[C+1936>>2]=o[C+8>>2],o[C+1940>>2]=B,B=o[C+4>>2],o[C+1928>>2]=o[C>>2],o[C+1932>>2]=B,B=o[C+76>>2],o[C+2e3>>2]=o[C+72>>2],o[C+2004>>2]=B,B=o[C+68>>2],o[C+1992>>2]=o[C+64>>2],o[C+1996>>2]=B,B=o[C+60>>2],o[C+1984>>2]=o[C+56>>2],o[C+1988>>2]=B,B=o[C+52>>2],o[C+1976>>2]=o[C+48>>2],o[C+1980>>2]=B,B=o[C+44>>2],o[C+1968>>2]=o[C+40>>2],o[C+1972>>2]=B,B=o[C+84>>2],o[C+2008>>2]=o[C+80>>2],o[C+2012>>2]=B,B=o[C+92>>2],o[C+2016>>2]=o[C+88>>2],o[C+2020>>2]=B,B=o[C+100>>2],o[C+2024>>2]=o[C+96>>2],o[C+2028>>2]=B,B=o[C+108>>2],o[C+2032>>2]=o[C+104>>2],o[C+2036>>2]=B,B=o[C+116>>2],o[C+2040>>2]=o[C+112>>2],o[C+2044>>2]=B,B=I,I=E[I+33424|0],l(C+480|0,C+1928|0),(0|I)>0?(F(k=C+320|0,n=C+480|0,i),F(s,Q,a),F(e,a,i),F(c,n,Q),_(n,k,(C+640|0)+r((254&I)>>>1|0,160)|0)):(0|I)>=0||(F(k=C+320|0,n=C+480|0,i),F(s,Q,a),F(e,a,i),F(c,n,Q),b(n,k,(C+640|0)+r((0-I&254)>>>1|0,160)|0)),F(C,I=C+480|0,i),F(M,Q,a),F(p,a,i),F(f,I,Q),I=B-1|0,B;);W(I=C+640|0,C),I=iA(I,32),D=C+2048|0,I&&(Q=o[g+136>>2],o[g>>2]=1-Q,PA=0,j=o[g+172>>2],o[g+36>>2]=0-j,f=o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,IA))+C|0,C=w+B|0,C=I>>>0>>0?C+1|0:C,B=(Q=DA($,QA,z,sA))+I|0,I=w+C|0,I=B>>>0>>0?I+1|0:I,C=DA(e,P,JA,eA),I=w+I|0,I=C>>>0>(B=C+B|0)>>>0?I+1|0:I,C=DA(O,pA,NA,HA),I=w+I|0,I=C>>>0>(B=C+B|0)>>>0?I+1|0:I,C=(Q=DA(c,v,yA,H))+B|0,B=w+I|0,B=C>>>0>>0?B+1|0:B,Q=(I=DA(y,S,T,uA))+C|0,C=w+B|0,C=I>>>0>Q>>>0?C+1|0:C,B=Q,Q=DA(I=mA,I>>31,n,m),I=w+C|0,C=B=B+Q|0,I=(I=B>>>0>>0?I+1|0:I)+(B=i>>26)|0,I=(C=C+(i=(67108863&i)<<6|p>>>26)|0)>>>0>>0?I+1|0:I,I=(B=C+16777216|0)>>>0<16777216?I+1|0:I,o[g+84>>2]=C-(-33554432&B),i=u-(-33554432&KA)|0,Q=h-(C=-67108864&UA)|0,a=SA-((C>>>0>h>>>0)+XA|0)|0,I=DA((33554431&(C=I))<<7|B>>>25,I=C>>25,19,0),B=w+a|0,I=I>>>0>(C=I+Q|0)>>>0?B+1|0:B,Q=I=(67108863&(I=(B=C+33554432|0)>>>0<33554432?I+1|0:I))<<6|B>>>26,I=I+i|0,o[g+52>>2]=I,o[g+48>>2]=C-(-67108864&B),W(A,g+48|0))}return D=g+256|0,0|PA},Fb:function(A,I){A|=0;var g,C=0;return D=g=D+-64|0,QA(g,I|=0,32,0),E[0|g]=248&a[0|g],E[g+31|0]=63&a[g+31|0]|64,I=o[g+20>>2],C=o[g+16>>2],E[A+16|0]=C,E[A+17|0]=C>>>8,E[A+18|0]=C>>>16,E[A+19|0]=C>>>24,E[A+20|0]=I,E[A+21|0]=I>>>8,E[A+22|0]=I>>>16,E[A+23|0]=I>>>24,I=o[g+12>>2],C=o[g+8>>2],E[A+8|0]=C,E[A+9|0]=C>>>8,E[A+10|0]=C>>>16,E[A+11|0]=C>>>24,E[A+12|0]=I,E[A+13|0]=I>>>8,E[A+14|0]=I>>>16,E[A+15|0]=I>>>24,I=o[g+4>>2],C=o[g>>2],E[0|A]=C,E[A+1|0]=C>>>8,E[A+2|0]=C>>>16,E[A+3|0]=C>>>24,E[A+4|0]=I,E[A+5|0]=I>>>8,E[A+6|0]=I>>>16,E[A+7|0]=I>>>24,I=o[g+28>>2],C=o[g+24>>2],E[A+24|0]=C,E[A+25|0]=C>>>8,E[A+26|0]=C>>>16,E[A+27|0]=C>>>24,E[A+28|0]=I,E[A+29|0]=I>>>8,E[A+30|0]=I>>>16,E[A+31|0]=I>>>24,$A(g,64),D=g- -64|0,0},Gb:function(){var A,I;return D=A=D-16|0,E[A+15|0]=0,I=0|t(34904,A+15|0,0),D=A+16|0,0|I},Hb:KA,Ib:function(A){var I,g=0,C=0;if(D=I=D-16|0,(A|=0)>>>0>=2){for(g=(0-A>>>0)%(A>>>0)|0;E[I+15|0]=0,g>>>0>(C=0|t(34904,I+15|0,0))>>>0;);g=(C>>>0)%(A>>>0)|0}return D=I+16|0,0|g},Jb:hA,Kb:function(A,I,g){XA(A|=0,I|=0,1024,g|=0)},Lb:II,Mb:function(){var A=0,I=0;return(A=o[9048])&&(A=o[A+20>>2])&&(I=0|nI[0|A]()),0|I},Nb:function(A,I,g){A|=0,I|=0;var C,B=0,i=0,o=0;if(D=C=D-16|0,g|=0)e(1240,1100,197,1036),Q();else{if(I)for(;E[C+15|0]=0,i=A+B|0,o=0|t(34904,C+15|0,0),E[0|i]=o,(0|I)!=(0|(B=B+1|0)););D=C+16|0}},Ob:function(A,I,g,C){A|=0,g|=0;var B=0,i=0,o=0;if(!((C|=0)>>>0>2147483646|C<<1>>>0>=(I|=0)>>>0)){if(I=0,C){for(;B=(I<<1)+A|0,i=15&(o=a[I+g|0]),E[B+1|0]=22272+((i<<8)+(i+65526&55552)|0)>>>8,i=B,B=o>>>4|0,E[0|i]=87+((B+65526>>>8&217)+B|0),(0|C)!=(0|(I=I+1|0)););I=C<<1}else I=0;return E[I+A|0]=0,0|A}mA(),Q()},Pb:function(A,I,g,C,B,Q,i){A|=0,I|=0,g|=0,B|=0,Q|=0,i|=0;var n=0,r=0,f=0,t=0,e=0,c=0,y=0,D=0,w=0,h=0;A:if(C|=0){I:{g:{C:{B:{if(!B){for(r=1,B=0;;){if(!(255&((y=(65526+(f=(223&(e=a[g+n|0]))-55&255)^f+65520)>>>8|0)|(D=65526+(e^=48)>>>8|0))))break C;if(I>>>0<=c>>>0)break B;if(f=f&y|e&D,255&t?(E[A+c|0]=B|f,c=c+1|0):B=f<<4,t^=-1,(0|(n=n+1|0))==(0|C))break}n=C;break C}for(;;){Q:{i:{E:{o:{a:{if(!(255&((e=(65526+(f=(223&(r=a[g+n|0]))-55&255)^f+65520)>>>8|0)|(D=65526+(y=48^r)>>>8|0)))){if(255&t)break g;if(!$(B,r))break A;if((n=t=n+1|0)>>>0>>0)break a;break A}if(I>>>0<=c>>>0)break B;if(r=f&e|y&D,!(255&t))break o;E[A+c|0]=r|h,c=c+1|0;break Q}for(;;){if(!(255&((e=(65526+(f=(223&(r=a[g+n|0]))-55&255)^f+65520)>>>8|0)|(D=65526+(y=48^r)>>>8|0)))){if(!$(B,r))break A;if((n=n+1|0)>>>0>>0)continue;break E}break}if(I>>>0<=c>>>0)break i;r=f&e|y&D}h=r<<4,t=0;break Q}n=C>>>0>t>>>0?C:t;break A}t=0;break B}if(t^=-1,r=1,!((n=n+1|0)>>>0>>0))break}break C}o[8916]=68,r=0}if(!(255&t))break I}o[8916]=28,w=-1,n=n-1|0,c=0;break A}r||(c=0,w=-1)}return i?o[i>>2]=g+n:(0|C)!=(0|n)&&(o[8916]=28,w=-1),Q&&(o[Q>>2]=c),0|w},Qb:function(A,I){A|=0;var g=0;return 1!=(-7&(I|=0))&&(mA(),Q()),1+((3&(g=(g=A)+r(A=(A>>>0)/3|0,-3)|0)?2&I?g+1|0:4:0)+(A<<2)|0)|0},Rb:function(A,I,g,C,B){A|=0,I|=0,g|=0,C|=0;var i=0,o=0,n=0,f=0,t=0,c=0,y=0,D=0,w=0,h=0;A:{I:{g:{if(1==(-7&(B|=0))&&(f=(i=(C>>>0)/3|0)<<2,(i=r(i,-3)+C|0)&&(f=2&B?(2|f)+(i>>>1|0)|0:f+4|0),!(I>>>0<=f>>>0))){if(!(4&B)){if(i=0,!C)break A;break g}if(i=0,!C)break A;for(;;){for(c=(D=a[g+y|0])|c<<8,t=i,i=1+((((n|=8)-6>>>0)/6|0)+i|0)|0;w=65510+(o=c>>>(n=(B=n)-6|0)&63)>>>8|0,h=o+65484>>>8|0,E[A+t|0]=(1+(16321^o)^-1)>>>8&45|o+252&o+65474>>>8&(-1^h)|(o+32705^-1)>>>8&95|w&o+65|h&o+71&(-1^w),(0|(t=t+1|0))!=(0|i););if((0|(y=y+1|0))==(0|C))break}if(!n)break A;t=(C=65510+(g=D<<12-B&63)>>>8|0)&g+65,c=g+252&g+65474>>>8&(-1^(B=g+65484>>>8|0)),n=B&g+71&(-1^C),C=g+32705|0,B=(1+(16321^g)^-1)>>>8&45,g=95;break I}mA(),Q()}for(;;){for(c=(D=a[g+y|0])|c<<8,t=i,i=1+((((n|=8)-6>>>0)/6|0)+i|0)|0;w=65510+(o=c>>>(n=(B=n)-6|0)&63)>>>8|0,h=o+65484>>>8|0,E[A+t|0]=(1+(16321^o)^-1)>>>8&43|o+252&o+65474>>>8&(-1^h)|(o+16321^-1)>>>8&47|w&o+65|h&o+71&(-1^w),(0|(t=t+1|0))!=(0|i););if((0|(y=y+1|0))==(0|C))break}if(!n)break A;t=(C=65510+(g=D<<12-B&63)>>>8|0)&g+65,c=g+252&g+65474>>>8&(-1^(B=g+65484>>>8|0)),n=B&g+71&(-1^C),C=g+16321|0,B=(1+(16321^g)^-1)>>>8&43,g=47}E[A+i|0]=g&(-1^C)>>>8|t|c|B|n,i=i+1|0}A:{I:{if(i>>>0<=f>>>0){if(i>>>0>>0)break I;f=i;break A}e(1048,1126,230,1319),Q()}MA(A+i|0,61,f-i|0)}return MA(A+f|0,0,(I>>>0>(g=f+1|0)>>>0?I:g)-f|0),0|A},Sb:function(A,I,g,C,B,i,n,r){A|=0,I|=0,g|=0,C|=0,B|=0,i|=0,n|=0;var f=0,t=0,e=0,c=0,y=0,D=0,w=0,h=0;A:{I:{g:{C:{B:{Q:{i:{E:{o:{a:{n:{if(1==(-7&(r|=0))){if(e=0,!C)break E;if(4&r)break n;for(;;){e=t;r:{f:{t:{e:{for(;;){if(f=(f=(c=E[g+e|0])-65|0)&((90-c^-1)&(-1^f))>>>8&255|c+4&((c+65488^-1)&(57-c^-1))>>>8&255|c+185&((c+65439^-1)&(122-c^-1))>>>8&255|(1+(16336^c)^-1)>>>8&63|(1+(16340^c)^-1)>>>8&62,255!=(0|(f|=(f-1&1+(65470^c))>>>8&255)))break e;if(f=0,!B)break o;if(!$(B,c))break;if((e=e+1|0)>>>0>=C>>>0)break t}t=e;break o}if(w=f+(w<<6)|0,y>>>0>1)break f;y=y+6|0;break r}t=(A=t+1|0)>>>0>>0?C:A;break o}if(y=y-2|0,I>>>0<=D>>>0)break a;E[A+D|0]=w>>>y,D=D+1|0}if(f=0,!((t=e+1|0)>>>0>>0))break}break o}mA(),Q()}n:for(;;){for(e=t;;){r:{if(f=(f=(c=E[g+e|0])-65|0)&((90-c^-1)&(-1^f))>>>8&255|c+4&((c+65488^-1)&(57-c^-1))>>>8&255|c+185&((c+65439^-1)&(122-c^-1))>>>8&255|(1+(16288^c)^-1)>>>8&63|(1+(16338^c)^-1)>>>8&62,255==(0|(f|=(f-1&1+(65470^c))>>>8&255))){if(f=0,!B)break o;if($(B,c))break r;t=e;break o}if(w=f+(w<<6)|0,y>>>0<2)y=y+6|0;else{if(y=y-2|0,I>>>0<=D>>>0)break a;E[A+D|0]=w>>>y,D=D+1|0}if(f=0,(t=e+1|0)>>>0>>0)continue n;break o}if(!((e=e+1|0)>>>0>>0))break}break}t=(A=t+1|0)>>>0>>0?C:A;break o}t=e,o[8916]=68,f=1}if(y>>>0>4)break i;e=t}if(A=e,I=-1,f){t=A;break A}if((-1<>>0<2){r=A;break B}if(t=A>>>0>C>>>0?A:C,e=y>>>1|0,!B)break Q;for(r=A;;){if((0|r)==(0|t)){f=68;break C}if(61!=(0|(A=E[g+r|0]))){if(!$(B,A)){f=28,t=r;break C}}else e=e-1|0;if(r=r+1|0,!e)break}break B}I=-1;break A}if(f=68,A>>>0>=C>>>0)break C;if(61!=a[A+g|0]){t=A,f=28;break C}if(r=A+e|0,1!=(0|e)){if((0|(y=A+1|0))==(0|t))break C;if(61!=a[g+y|0]){t=y,f=28;break C}if(2!=(0|e)){if((0|(A=A+2|0))==(0|t))break C;if(f=28,t=A,61!=a[A+g|0])break C}}}if(I=0,B)break g;break I}o[8916]=f;break A}if(!(C>>>0<=r>>>0)){for(;;){if(!$(B,E[g+r|0]))break I;if((0|(r=r+1|0))==(0|C))break}r=C}}t=r,h=D}return n?o[n>>2]=g+t:(0|C)!=(0|t)&&(o[8916]=28,I=-1),i&&(o[i>>2]=h),0|I},Tb:function(){var A=0;return o[9049]?A=1:(KA(),hA(36176,16),o[9049]=1,A=0),0|A},Ub:function(A,I,g,C,B){A|=0,I|=0,g|=0,B|=0;var i,n=0,r=0,f=0;D=i=D-16|0;A:{if(C|=0){if(f=-1,(n=(n=C-1|0)-(r=n&C?(g>>>0)%(C>>>0)|0:g&n)|0)>>>0>=(-1^g)>>>0)break A;if(!((g=g+n|0)>>>0>=B>>>0))for(A&&(o[A>>2]=g+1),A=I+g|0,f=0,E[i+15|0]=0,g=0;B=I=A-g|0,r=a[0|I]&a[i+15|0],I=(g^n)-1>>>24|0,E[0|B]=r|128&I,E[i+15|0]=I|a[i+15|0],(0|C)!=(0|(g=g+1|0)););}else f=-1;return D=i+16|0,0|f}mA(),Q()},Vb:function(A,I,g,C){A|=0,I|=0,g|=0,C|=0;var B,Q=0,i=0,E=0,n=0,r=0;if(o[12+(B=D-16|0)>>2]=0,C-1>>>0>>0){for(r=(i=g-1|0)+I|0,g=0,I=0;I&=255,n=(128^(E=a[r-Q|0]))-1&o[B+12>>2]-1&I-1,o[B+12>>2]=o[B+12>>2]|n<<23>>31&Q,I|=E,g|=n>>>8&1,(0|(Q=Q+1|0))!=(0|C););o[A>>2]=i-o[B+12>>2],A=(255&g)-1|0}else A=-1;return 0|A},Wb:function(){return 1312},Xb:function(){return 10},Yb:iI,Zb:QI,_b:function(A){var I,g=0,C=0,B=0,Q=0,i=0,E=0,r=0,t=0,e=0,c=0,y=0,w=0;D=I=D-16|0;A:{I:{g:{C:{B:{Q:{i:{E:{o:{if((A|=0)>>>0<=244){if(3&(g=(E=o[8917])>>>(C=(r=A>>>0<11?16:A+11&-8)>>>3|0)|0)){g=35708+(A=(C=C+(1&(-1^g))|0)<<3)|0,B=o[A+35716>>2],(0|g)!=(0|(A=o[B+8>>2]))?(o[A+12>>2]=g,o[g+8>>2]=A):(y=35668,w=YA(-2,C)&E,o[y>>2]=w),A=B+8|0,g=C<<3,o[B+4>>2]=3|g,o[4+(g=g+B|0)>>2]=1|o[g+4>>2];break A}if((c=o[8919])>>>0>=r>>>0)break o;if(g){g=35708+(A=(B=RA(0-(A=(0-(A=2<>2],(0|g)!=(0|(A=o[Q+8>>2]))?(o[A+12>>2]=g,o[g+8>>2]=A):(E=YA(-2,B)&E,o[8917]=E),o[Q+4>>2]=3|r,B=(A=B<<3)-r|0,o[4+(C=Q+r|0)>>2]=1|B,o[A+Q>>2]=B,c&&(g=35708+(-8&c)|0,i=o[8922],(A=1<<(c>>>3))&E?A=o[g+8>>2]:(o[8917]=A|E,A=g),o[g+8>>2]=i,o[A+12>>2]=i,o[i+12>>2]=g,o[i+8>>2]=A),A=Q+8|0,o[8922]=C,o[8919]=B;break A}if(!(e=o[8918]))break o;for(C=o[35972+(RA(0-e&e)<<2)>>2],i=(-8&o[C+4>>2])-r|0,g=C;(A=o[g+16>>2])||(A=o[g+20>>2]);)i=(B=(g=(-8&o[A+4>>2])-r|0)>>>0>>0)?g:i,C=B?A:C,g=A;if(t=o[C+24>>2],(0|(B=o[C+12>>2]))!=(0|C)){A=o[C+8>>2],o[A+12>>2]=B,o[B+8>>2]=A;break I}if(!(A=o[(g=C+20|0)>>2])){if(!(A=o[C+16>>2]))break E;g=C+16|0}for(;Q=g,B=A,(A=o[(g=A+20|0)>>2])||(g=B+16|0,A=o[B+16>>2]););o[Q>>2]=0;break I}if(r=-1,!(A>>>0>4294967231)&&(r=-8&(A=A+11|0),e=o[8918])){i=0-r|0,E=0,r>>>0<256||(E=31,r>>>0>16777215||(E=62+((r>>>38-(A=f(A>>>8|0))&1)-(A<<1)|0)|0));a:{n:{if(g=o[35972+(E<<2)>>2])for(A=0,C=r<<(31!=(0|E)?25-(E>>>1|0)|0:0);;){if(!((Q=(-8&o[g+4>>2])-r|0)>>>0>=i>>>0||(B=g,i=Q,Q))){i=0,A=g;break n}if(Q=o[g+20>>2],g=o[16+((C>>>29&4)+g|0)>>2],A=Q?(0|Q)==(0|g)?A:Q:A,C<<=1,!g)break}else A=0;if(!(A|B)){if(B=0,!(A=(0-(A=2<>2]}if(!A)break a}for(;i=(C=(g=(-8&o[A+4>>2])-r|0)>>>0>>0)?g:i,B=C?A:B,A=(g=o[A+16>>2])||o[A+20>>2];);}if(!(!B|o[8919]-r>>>0<=i>>>0)){if(E=o[B+24>>2],(0|B)!=(0|(C=o[B+12>>2]))){A=o[B+8>>2],o[A+12>>2]=C,o[C+8>>2]=A;break g}if(!(A=o[(g=B+20|0)>>2])){if(!(A=o[B+16>>2]))break i;g=B+16|0}for(;Q=g,C=A,(A=o[(g=A+20|0)>>2])||(g=C+16|0,A=o[C+16>>2]););o[Q>>2]=0;break g}}}if((A=o[8919])>>>0>=r>>>0){B=o[8922],(g=A-r|0)>>>0>=16?(o[4+(C=B+r|0)>>2]=1|g,o[A+B>>2]=g,o[B+4>>2]=3|r):(o[B+4>>2]=3|A,o[4+(A=A+B|0)>>2]=1|o[A+4>>2],C=0,g=0),o[8919]=g,o[8922]=C,A=B+8|0;break A}if((t=o[8920])>>>0>r>>>0){g=t-r|0,o[8920]=g,A=(C=o[8923])+r|0,o[8923]=A,o[A+4>>2]=1|g,o[C+4>>2]=3|r,A=C+8|0;break A}if(A=0,e=r+47|0,o[9035]?C=o[9037]:(o[9038]=-1,o[9039]=-1,o[9036]=4096,o[9037]=4096,o[9035]=I+12&-16^1431655768,o[9040]=0,o[9028]=0,C=4096),(g=(Q=e+C|0)&(i=0-C|0))>>>0<=r>>>0)break A;if((B=o[9027])&&B>>>0<(E=(C=o[9025])+g|0)>>>0|C>>>0>=E>>>0)break A;o:{if(!(4&a[36112])){a:{n:{r:{f:{if(B=o[8923])for(A=36116;;){if((C=o[A>>2])>>>0<=B>>>0&B>>>0>2]>>>0)break f;if(!(A=o[A+8>>2]))break}if(-1==(0|(C=pA(0))))break a;if(E=g,(A=(B=o[9036])-1|0)&C&&(E=(g-C|0)+(A+C&0-B)|0),E>>>0<=r>>>0)break a;if((B=o[9027])&&B>>>0<(i=(A=o[9025])+E|0)>>>0|A>>>0>=i>>>0)break a;if((0|C)!=(0|(A=pA(E))))break r;break o}if((0|(C=pA(E=i&Q-t)))==(o[A>>2]+o[A+4>>2]|0))break n;A=C}if(-1==(0|A))break a;if(r+48>>>0<=E>>>0){C=A;break o}if(-1==(0|pA(C=(C=o[9037])+(e-E|0)&0-C)))break a;E=C+E|0,C=A;break o}if(-1!=(0|C))break o}o[9028]=4|o[9028]}if(-1==(0|(C=pA(g)))|-1==(0|(A=pA(0)))|A>>>0<=C>>>0)break C;if((E=A-C|0)>>>0<=r+40>>>0)break C}A=o[9025]+E|0,o[9025]=A,A>>>0>n[9026]&&(o[9026]=A);o:{if(Q=o[8923]){for(A=36116;;){if(((B=o[A>>2])+(g=o[A+4>>2])|0)==(0|C))break o;if(!(A=o[A+8>>2]))break}break Q}for((A=o[8921])>>>0<=C>>>0&&A||(o[8921]=C),A=0,o[9030]=E,o[9029]=C,o[8925]=-1,o[8926]=o[9035],o[9032]=0;g=35708+(B=A<<3)|0,o[B+35716>>2]=g,o[B+35720>>2]=g,32!=(0|(A=A+1|0)););g=(B=E-40|0)-(A=C+8&7?-8-C&7:0)|0,o[8920]=g,A=A+C|0,o[8923]=A,o[A+4>>2]=1|g,o[4+(C+B|0)>>2]=40,o[8924]=o[9039];break B}if(8&a[A+12|0]|B>>>0>Q>>>0|C>>>0<=Q>>>0)break Q;o[A+4>>2]=g+E,C=(A=Q+8&7?-8-Q&7:0)+Q|0,o[8923]=C,A=(g=o[8920]+E|0)-A|0,o[8920]=A,o[C+4>>2]=1|A,o[4+(g+Q|0)>>2]=40,o[8924]=o[9039];break B}B=0;break I}C=0;break g}n[8921]>C>>>0&&(o[8921]=C),g=C+E|0,A=36116;Q:{i:{E:{o:{a:{n:{for(;;){if((0|g)!=o[A>>2]){if(A=o[A+8>>2])continue;break n}break}if(!(8&a[A+12|0]))break a}for(A=36116;;){if((g=o[A>>2])>>>0<=Q>>>0&&(i=g+o[A+4>>2]|0)>>>0>Q>>>0)break o;A=o[A+8>>2]}}if(o[A>>2]=C,o[A+4>>2]=o[A+4>>2]+E,o[4+(e=(C+8&7?-8-C&7:0)+C|0)>>2]=3|r,A=(E=g+(g+8&7?-8-g&7:0)|0)-(t=r+e|0)|0,(0|Q)==(0|E)){o[8923]=t,A=o[8920]+A|0,o[8920]=A,o[t+4>>2]=1|A;break i}if(o[8922]==(0|E)){o[8922]=t,A=o[8919]+A|0,o[8919]=A,o[t+4>>2]=1|A,o[A+t>>2]=A;break i}if(1==(3&(i=o[E+4>>2]))){Q=-8&i;a:if(i>>>0<=255){if(B=o[E+8>>2],g=i>>>3|0,(0|(C=o[E+12>>2]))==(0|B)){y=35668,w=o[8917]&YA(-2,g),o[y>>2]=w;break a}o[B+12>>2]=C,o[C+8>>2]=B}else{if(r=o[E+24>>2],(0|E)==(0|(C=o[E+12>>2])))if((g=o[(i=E+20|0)>>2])||(g=o[(i=E+16|0)>>2])){for(;B=i,(g=o[(i=(C=g)+20|0)>>2])||(i=C+16|0,g=o[C+16>>2]););o[B>>2]=0}else C=0;else g=o[E+8>>2],o[g+12>>2]=C,o[C+8>>2]=g;if(r){B=o[E+28>>2];n:{if(o[(g=35972+(B<<2)|0)>>2]==(0|E)){if(o[g>>2]=C,C)break n;y=35672,w=o[8918]&YA(-2,B),o[y>>2]=w;break a}if(o[r+(o[r+16>>2]==(0|E)?16:20)>>2]=C,!C)break a}o[C+24>>2]=r,(g=o[E+16>>2])&&(o[C+16>>2]=g,o[g+24>>2]=C),(g=o[E+20>>2])&&(o[C+20>>2]=g,o[g+24>>2]=C)}}i=o[4+(E=Q+E|0)>>2],A=A+Q|0}if(o[E+4>>2]=-2&i,o[t+4>>2]=1|A,o[A+t>>2]=A,A>>>0<=255){g=35708+(-8&A)|0,(C=o[8917])&(A=1<<(A>>>3))?A=o[g+8>>2]:(o[8917]=A|C,A=g),o[g+8>>2]=t,o[A+12>>2]=t,o[t+12>>2]=g,o[t+8>>2]=A;break i}if(i=31,A>>>0<=16777215&&(i=62+((A>>>38-(g=f(A>>>8|0))&1)-(g<<1)|0)|0),o[t+28>>2]=i,o[t+16>>2]=0,o[t+20>>2]=0,g=35972+(i<<2)|0,(B=o[8918])&(C=1<>>1|0)|0:0),C=o[g>>2];;){if(g=C,(-8&o[C+4>>2])==(0|A))break E;if(C=i>>>29|0,i<<=1,!(C=o[16+(B=(4&C)+g|0)>>2]))break}o[B+16>>2]=t}else o[8918]=C|B,o[g>>2]=t;o[t+24>>2]=g,o[t+12>>2]=t,o[t+8>>2]=t;break i}for(g=(B=E-40|0)-(A=C+8&7?-8-C&7:0)|0,o[8920]=g,A=A+C|0,o[8923]=A,o[A+4>>2]=1|g,o[4+(C+B|0)>>2]=40,o[8924]=o[9039],o[(B=(A=(i+(i-39&7?39-i&7:0)|0)-47|0)>>>0>>0?Q:A)+4>>2]=27,A=o[9032],o[B+16>>2]=o[9031],o[B+20>>2]=A,A=o[9030],o[B+8>>2]=o[9029],o[B+12>>2]=A,o[9031]=B+8,o[9030]=E,o[9029]=C,o[9032]=0,A=B+24|0;o[A+4>>2]=7,g=A+8|0,A=A+4|0,g>>>0>>0;);if((0|B)==(0|Q))break B;if(o[B+4>>2]=-2&o[B+4>>2],i=B-Q|0,o[Q+4>>2]=1|i,o[B>>2]=i,i>>>0<=255){g=35708+(-8&i)|0,(C=o[8917])&(A=1<<(i>>>3))?A=o[g+8>>2]:(o[8917]=A|C,A=g),o[g+8>>2]=Q,o[A+12>>2]=Q,o[Q+12>>2]=g,o[Q+8>>2]=A;break B}if(A=31,i>>>0<=16777215&&(A=62+((i>>>38-(A=f(i>>>8|0))&1)-(A<<1)|0)|0),o[Q+28>>2]=A,o[Q+16>>2]=0,o[Q+20>>2]=0,g=35972+(A<<2)|0,(B=o[8918])&(C=1<>>1|0)|0:0),B=o[g>>2];;){if((0|i)==(-8&o[(g=B)+4>>2]))break Q;if(C=A>>>29|0,A<<=1,!(B=o[16+(C=(4&C)+g|0)>>2]))break}o[C+16>>2]=Q}else o[8918]=C|B,o[g>>2]=Q;o[Q+24>>2]=g,o[Q+12>>2]=Q,o[Q+8>>2]=Q;break B}A=o[g+8>>2],o[A+12>>2]=t,o[g+8>>2]=t,o[t+24>>2]=0,o[t+12>>2]=g,o[t+8>>2]=A}A=e+8|0;break A}A=o[g+8>>2],o[A+12>>2]=Q,o[g+8>>2]=Q,o[Q+24>>2]=0,o[Q+12>>2]=g,o[Q+8>>2]=A}if(!((A=o[8920])>>>0<=r>>>0)){g=A-r|0,o[8920]=g,A=(C=o[8923])+r|0,o[8923]=A,o[A+4>>2]=1|g,o[C+4>>2]=3|r,A=C+8|0;break A}}o[8916]=48,A=0;break A}g:if(E){g=o[B+28>>2];C:{if(o[(A=35972+(g<<2)|0)>>2]==(0|B)){if(o[A>>2]=C,C)break C;e=YA(-2,g)&e,o[8918]=e;break g}if(o[E+(o[E+16>>2]==(0|B)?16:20)>>2]=C,!C)break g}o[C+24>>2]=E,(A=o[B+16>>2])&&(o[C+16>>2]=A,o[A+24>>2]=C),(A=o[B+20>>2])&&(o[C+20>>2]=A,o[A+24>>2]=C)}g:if(i>>>0<=15)A=i+r|0,o[B+4>>2]=3|A,o[4+(A=A+B|0)>>2]=1|o[A+4>>2];else if(o[B+4>>2]=3|r,o[4+(Q=B+r|0)>>2]=1|i,o[Q+i>>2]=i,i>>>0<=255)g=35708+(-8&i)|0,(C=o[8917])&(A=1<<(i>>>3))?A=o[g+8>>2]:(o[8917]=A|C,A=g),o[g+8>>2]=Q,o[A+12>>2]=Q,o[Q+12>>2]=g,o[Q+8>>2]=A;else{A=31,i>>>0<=16777215&&(A=62+((i>>>38-(A=f(i>>>8|0))&1)-(A<<1)|0)|0),o[Q+28>>2]=A,o[Q+16>>2]=0,o[Q+20>>2]=0,g=35972+(A<<2)|0;C:{if((C=1<>>1|0)|0:0),r=o[g>>2];;){if((-8&o[(g=r)+4>>2])==(0|i))break C;if(C=A>>>29|0,A<<=1,!(r=o[16+(C=(4&C)+g|0)>>2]))break}o[C+16>>2]=Q}else o[8918]=C|e,o[g>>2]=Q;o[Q+24>>2]=g,o[Q+12>>2]=Q,o[Q+8>>2]=Q;break g}A=o[g+8>>2],o[A+12>>2]=Q,o[g+8>>2]=Q,o[Q+24>>2]=0,o[Q+12>>2]=g,o[Q+8>>2]=A}A=B+8|0;break A}I:if(t){g=o[C+28>>2];g:{if(o[(A=35972+(g<<2)|0)>>2]==(0|C)){if(o[A>>2]=B,B)break g;y=35672,w=YA(-2,g)&e,o[y>>2]=w;break I}if(o[t+(o[t+16>>2]==(0|C)?16:20)>>2]=B,!B)break I}o[B+24>>2]=t,(A=o[C+16>>2])&&(o[B+16>>2]=A,o[A+24>>2]=B),(A=o[C+20>>2])&&(o[B+20>>2]=A,o[A+24>>2]=B)}i>>>0<=15?(A=i+r|0,o[C+4>>2]=3|A,o[4+(A=A+C|0)>>2]=1|o[A+4>>2]):(o[C+4>>2]=3|r,o[4+(B=C+r|0)>>2]=1|i,o[B+i>>2]=i,c&&(g=35708+(-8&c)|0,Q=o[8922],(A=1<<(c>>>3))&E?A=o[g+8>>2]:(o[8917]=A|E,A=g),o[g+8>>2]=Q,o[A+12>>2]=Q,o[Q+12>>2]=g,o[Q+8>>2]=A),o[8922]=B,o[8919]=i),A=C+8|0}return D=I+16|0,0|A},$b:function(A){var I=0,g=0,C=0,B=0,Q=0,i=0,E=0,a=0,r=0;A:if(A|=0){Q=(C=A-8|0)+(A=-8&(I=o[A-4>>2]))|0;I:if(!(1&I)){if(!(3&I))break A;if((C=C-(I=o[C>>2])|0)>>>0>2])))return o[8919]=A,o[Q+4>>2]=-2&I,o[C+4>>2]=1|A,void(o[A+C>>2]=A)}else{if(I>>>0<=255){if(B=o[C+8>>2],I=I>>>3|0,(0|(g=o[C+12>>2]))==(0|B)){a=35668,r=o[8917]&YA(-2,I),o[a>>2]=r;break I}o[B+12>>2]=g,o[g+8>>2]=B;break I}if(E=o[C+24>>2],(0|C)==(0|(I=o[C+12>>2])))if((g=o[(B=C+20|0)>>2])||(g=o[(B=C+16|0)>>2])){for(;i=B,(g=o[(B=(I=g)+20|0)>>2])||(B=I+16|0,g=o[I+16>>2]););o[i>>2]=0}else I=0;else g=o[C+8>>2],o[g+12>>2]=I,o[I+8>>2]=g;if(!E)break I;B=o[C+28>>2];g:{if(o[(g=35972+(B<<2)|0)>>2]==(0|C)){if(o[g>>2]=I,I)break g;a=35672,r=o[8918]&YA(-2,B),o[a>>2]=r;break I}if(o[E+(o[E+16>>2]==(0|C)?16:20)>>2]=I,!I)break I}if(o[I+24>>2]=E,(g=o[C+16>>2])&&(o[I+16>>2]=g,o[g+24>>2]=I),!(g=o[C+20>>2]))break I;o[I+20>>2]=g,o[g+24>>2]=I}}if(!(C>>>0>=Q>>>0)&&1&(I=o[Q+4>>2])){I:{if(!(2&I)){if(o[8923]==(0|Q)){if(o[8923]=C,A=o[8920]+A|0,o[8920]=A,o[C+4>>2]=1|A,o[8922]!=(0|C))break A;return o[8919]=0,void(o[8922]=0)}if(o[8922]==(0|Q))return o[8922]=C,A=o[8919]+A|0,o[8919]=A,o[C+4>>2]=1|A,void(o[A+C>>2]=A);A=(-8&I)+A|0;g:if(I>>>0<=255){if(B=o[Q+8>>2],I=I>>>3|0,(0|(g=o[Q+12>>2]))==(0|B)){a=35668,r=o[8917]&YA(-2,I),o[a>>2]=r;break g}o[B+12>>2]=g,o[g+8>>2]=B}else{if(E=o[Q+24>>2],(0|Q)==(0|(I=o[Q+12>>2])))if((g=o[(B=Q+20|0)>>2])||(g=o[(B=Q+16|0)>>2])){for(;i=B,(g=o[(B=(I=g)+20|0)>>2])||(B=I+16|0,g=o[I+16>>2]););o[i>>2]=0}else I=0;else g=o[Q+8>>2],o[g+12>>2]=I,o[I+8>>2]=g;if(E){B=o[Q+28>>2];C:{if(o[(g=35972+(B<<2)|0)>>2]==(0|Q)){if(o[g>>2]=I,I)break C;a=35672,r=o[8918]&YA(-2,B),o[a>>2]=r;break g}if(o[E+(o[E+16>>2]==(0|Q)?16:20)>>2]=I,!I)break g}o[I+24>>2]=E,(g=o[Q+16>>2])&&(o[I+16>>2]=g,o[g+24>>2]=I),(g=o[Q+20>>2])&&(o[I+20>>2]=g,o[g+24>>2]=I)}}if(o[C+4>>2]=1|A,o[A+C>>2]=A,o[8922]!=(0|C))break I;return void(o[8919]=A)}o[Q+4>>2]=-2&I,o[C+4>>2]=1|A,o[A+C>>2]=A}if(A>>>0<=255)return I=35708+(-8&A)|0,(g=o[8917])&(A=1<<(A>>>3))?A=o[I+8>>2]:(o[8917]=A|g,A=I),o[I+8>>2]=C,o[A+12>>2]=C,o[C+12>>2]=I,void(o[C+8>>2]=A);B=31,A>>>0<=16777215&&(B=62+((A>>>38-(I=f(A>>>8|0))&1)-(I<<1)|0)|0),o[C+28>>2]=B,o[C+16>>2]=0,o[C+20>>2]=0,i=35972+(B<<2)|0;I:{g:{if((g=o[8918])&(I=1<>>1|0)|0:0),I=o[i>>2];;){if(g=I,(-8&o[I+4>>2])==(0|A))break g;if(I=B>>>29|0,B<<=1,!(I=o[16+(i=g+(4&I)|0)>>2]))break}o[i+16>>2]=C,o[C+24>>2]=g}else o[8918]=I|g,o[i>>2]=C,o[C+24>>2]=i;o[C+12>>2]=C,o[C+8>>2]=C;break I}A=o[g+8>>2],o[A+12>>2]=C,o[g+8>>2]=C,o[C+24>>2]=0,o[C+12>>2]=g,o[C+8>>2]=A}A=o[8925]-1|0,o[8925]=A||-1}}},ac:nI}}(A)}(I)},instantiate:function(A,I){return{then:function(g){var C=new D.Module(A);g({instance:new D.Instance(C,I)})}}},RuntimeError:Error};e=[],"object"!=typeof D&&K("no native wasm support detected");var w,h,s,p,u,k,F,l=!1,S="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function H(A,I){return A?function(A,I,g){for(var C=I+g,B=I;A[B]&&!(B>=C);)++B;if(B-I>16&&A.buffer&&S)return S.decode(A.subarray(I,B));for(var Q="";I>10,56320|1023&a)}}else Q+=String.fromCharCode((31&i)<<6|E)}else Q+=String.fromCharCode(i)}return Q}(h,A,I):""}function M(){var A=y.buffer;i.HEAP8=w=new Int8Array(A),i.HEAP16=s=new Int16Array(A),i.HEAP32=p=new Int32Array(A),i.HEAPU8=h=new Uint8Array(A),i.HEAPU16=new Uint16Array(A),i.HEAPU32=u=new Uint32Array(A),i.HEAPF32=k=new Float32Array(A),i.HEAPF64=F=new Float64Array(A)}var G=i.INITIAL_MEMORY||16777216;G>=65536||K("INITIAL_MEMORY should be larger than STACK_SIZE, was "+G+"! (STACK_SIZE=65536)"),y=i.wasmMemory?i.wasmMemory:new D.Memory({initial:G/65536,maximum:32768}),M(),G=y.buffer.byteLength;var U=[],J=[],N=[],Y=0,b=null,_=null;function K(A){throw i.onAbort&&i.onAbort(A),c(A="Aborted("+A+")"),l=!0,A+=". Build with -sASSERTIONS for more info.",new D.RuntimeError(A)}var P,v,m,d,L="data:application/octet-stream;base64,";function R(A){return A.startsWith(L)}function x(A){return A.startsWith("file://")}function j(A){try{if(A==P&&e)return new Uint8Array(e);var I=T(A);if(I)return I;if(Q)return Q(A);throw"both async and sync fetching of the wasm failed"}catch(A){K(A)}}R(P="<<< WASM_BINARY_FILE >>>")||(v=P,P=i.locateFile?i.locateFile(v,r):r+v);var X={34904:()=>i.getRandomValue(),34940:()=>{if(void 0===i.getRandomValue)try{var A="object"==typeof window?window:self,I=void 0!==A.crypto?A.crypto:A.msCrypto,g=function(){var A=new Uint32Array(1);return I.getRandomValues(A),A[0]>>>0};g(),i.getRandomValue=g}catch(A){try{var C=__webpack_require__(/*! crypto */ "./node_modules/crypto-browserify/index.js"),B=function(){var A=C.randomBytes(4);return(A[0]<<24|A[1]<<16|A[2]<<8|A[3])>>>0};B(),i.getRandomValue=B}catch(A){throw"No secure random number generator found"}}}};function q(A){for(;A.length>0;)A.shift()(i)}var z=[];function V(A){var I=y.buffer;try{return y.grow(A-I.byteLength+65535>>>16),M(),1}catch(A){}}var O="function"==typeof atob?atob:function(A){var I,g,C,B,Q,i,E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="",a=0;A=A.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{I=E.indexOf(A.charAt(a++))<<2|(B=E.indexOf(A.charAt(a++)))>>4,g=(15&B)<<4|(Q=E.indexOf(A.charAt(a++)))>>2,C=(3&Q)<<6|(i=E.indexOf(A.charAt(a++))),o+=String.fromCharCode(I),64!==Q&&(o+=String.fromCharCode(g)),64!==i&&(o+=String.fromCharCode(C))}while(a>=2;g=h[A++];)I+=105!=g&I,z.push(105==g?p[I]:F[I++>>1]),++I;return z}(I,g);return X[A].apply(null,C)}(A,I,g)},e:function(A){var I,g=h.length,C=2147483648;if((A>>>=0)>C)return!1;for(var B=1;B<=4;B*=2){var Q=g*(1+.2/B);if(Q=Math.min(Q,A+100663296),V(Math.min(C,(I=Math.max(A,Q))+(65536-I%65536)%65536)))return!0}return!1},a:y};function $(){function A(){W||(W=!0,i.calledRun=!0,l||(q(J),i.onRuntimeInitialized&&i.onRuntimeInitialized(),function(){if(i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)A=i.postRun.shift(),N.unshift(A);var A;q(N)}()))}Y>0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)A=i.preRun.shift(),U.unshift(A);var A;q(U)}(),Y>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),A()}),1)):A()))}if(function(){var A={a:Z};function I(A,I){var g,C=A.exports;i.asm=C,i.asm.ac,g=i.asm.f,J.unshift(g),function(A){if(Y--,i.monitorRunDependencies&&i.monitorRunDependencies(Y),0==Y&&(null!==b&&(clearInterval(b),b=null),_)){var I=_;_=null,I()}}()}function g(A){I(A.instance)}function C(I){return function(){if(!e&&(o||a)){if("function"==typeof fetch&&!x(P))return fetch(P,{credentials:"same-origin"}).then((function(A){if(!A.ok)throw"failed to load wasm binary file at '"+P+"'";return A.arrayBuffer()})).catch((function(){return j(P)}));if(B)return new Promise((function(A,I){B(P,(function(I){A(new Uint8Array(I))}),I)}))}return Promise.resolve().then((function(){return j(P)}))}().then((function(I){return D.instantiate(I,A)})).then((function(A){return A})).then(I,(function(A){c("failed to asynchronously prepare wasm: "+A),K(A)}))}if(Y++,i.monitorRunDependencies&&i.monitorRunDependencies(Y),i.instantiateWasm)try{return i.instantiateWasm(A,I)}catch(A){return c("Module.instantiateWasm callback failed with error: "+A),!1}e||"function"!=typeof D.instantiateStreaming||R(P)||x(P)||n||"function"!=typeof fetch?C(g):fetch(P,{credentials:"same-origin"}).then((function(I){return D.instantiateStreaming(I,A).then(g,(function(A){return c("wasm streaming compile failed: "+A),c("falling back to ArrayBuffer instantiation"),C(g)}))}))}(),i._crypto_aead_chacha20poly1305_encrypt_detached=function(){return(i._crypto_aead_chacha20poly1305_encrypt_detached=i.asm.g).apply(null,arguments)},i._crypto_aead_chacha20poly1305_encrypt=function(){return(i._crypto_aead_chacha20poly1305_encrypt=i.asm.h).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_encrypt_detached=function(){return(i._crypto_aead_chacha20poly1305_ietf_encrypt_detached=i.asm.i).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_encrypt=function(){return(i._crypto_aead_chacha20poly1305_ietf_encrypt=i.asm.j).apply(null,arguments)},i._crypto_aead_chacha20poly1305_decrypt_detached=function(){return(i._crypto_aead_chacha20poly1305_decrypt_detached=i.asm.k).apply(null,arguments)},i._crypto_aead_chacha20poly1305_decrypt=function(){return(i._crypto_aead_chacha20poly1305_decrypt=i.asm.l).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_decrypt_detached=function(){return(i._crypto_aead_chacha20poly1305_ietf_decrypt_detached=i.asm.m).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_decrypt=function(){return(i._crypto_aead_chacha20poly1305_ietf_decrypt=i.asm.n).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_keybytes=function(){return(i._crypto_aead_chacha20poly1305_ietf_keybytes=i.asm.o).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_npubbytes=function(){return(i._crypto_aead_chacha20poly1305_ietf_npubbytes=i.asm.p).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_nsecbytes=function(){return(i._crypto_aead_chacha20poly1305_ietf_nsecbytes=i.asm.q).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_abytes=function(){return(i._crypto_aead_chacha20poly1305_ietf_abytes=i.asm.r).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_messagebytes_max=function(){return(i._crypto_aead_chacha20poly1305_ietf_messagebytes_max=i.asm.s).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_keygen=function(){return(i._crypto_aead_chacha20poly1305_ietf_keygen=i.asm.t).apply(null,arguments)},i._crypto_aead_chacha20poly1305_keybytes=function(){return(i._crypto_aead_chacha20poly1305_keybytes=i.asm.u).apply(null,arguments)},i._crypto_aead_chacha20poly1305_npubbytes=function(){return(i._crypto_aead_chacha20poly1305_npubbytes=i.asm.v).apply(null,arguments)},i._crypto_aead_chacha20poly1305_nsecbytes=function(){return(i._crypto_aead_chacha20poly1305_nsecbytes=i.asm.w).apply(null,arguments)},i._crypto_aead_chacha20poly1305_abytes=function(){return(i._crypto_aead_chacha20poly1305_abytes=i.asm.x).apply(null,arguments)},i._crypto_aead_chacha20poly1305_messagebytes_max=function(){return(i._crypto_aead_chacha20poly1305_messagebytes_max=i.asm.y).apply(null,arguments)},i._crypto_aead_chacha20poly1305_keygen=function(){return(i._crypto_aead_chacha20poly1305_keygen=i.asm.z).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_encrypt_detached=function(){return(i._crypto_aead_xchacha20poly1305_ietf_encrypt_detached=i.asm.A).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_encrypt=function(){return(i._crypto_aead_xchacha20poly1305_ietf_encrypt=i.asm.B).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_decrypt_detached=function(){return(i._crypto_aead_xchacha20poly1305_ietf_decrypt_detached=i.asm.C).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_decrypt=function(){return(i._crypto_aead_xchacha20poly1305_ietf_decrypt=i.asm.D).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_keybytes=function(){return(i._crypto_aead_xchacha20poly1305_ietf_keybytes=i.asm.E).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_npubbytes=function(){return(i._crypto_aead_xchacha20poly1305_ietf_npubbytes=i.asm.F).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_nsecbytes=function(){return(i._crypto_aead_xchacha20poly1305_ietf_nsecbytes=i.asm.G).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_abytes=function(){return(i._crypto_aead_xchacha20poly1305_ietf_abytes=i.asm.H).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_messagebytes_max=function(){return(i._crypto_aead_xchacha20poly1305_ietf_messagebytes_max=i.asm.I).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_keygen=function(){return(i._crypto_aead_xchacha20poly1305_ietf_keygen=i.asm.J).apply(null,arguments)},i._crypto_auth_bytes=function(){return(i._crypto_auth_bytes=i.asm.K).apply(null,arguments)},i._crypto_auth_keybytes=function(){return(i._crypto_auth_keybytes=i.asm.L).apply(null,arguments)},i._crypto_auth=function(){return(i._crypto_auth=i.asm.M).apply(null,arguments)},i._crypto_auth_verify=function(){return(i._crypto_auth_verify=i.asm.N).apply(null,arguments)},i._crypto_auth_keygen=function(){return(i._crypto_auth_keygen=i.asm.O).apply(null,arguments)},i._crypto_box_seedbytes=function(){return(i._crypto_box_seedbytes=i.asm.P).apply(null,arguments)},i._crypto_box_publickeybytes=function(){return(i._crypto_box_publickeybytes=i.asm.Q).apply(null,arguments)},i._crypto_box_secretkeybytes=function(){return(i._crypto_box_secretkeybytes=i.asm.R).apply(null,arguments)},i._crypto_box_beforenmbytes=function(){return(i._crypto_box_beforenmbytes=i.asm.S).apply(null,arguments)},i._crypto_box_noncebytes=function(){return(i._crypto_box_noncebytes=i.asm.T).apply(null,arguments)},i._crypto_box_macbytes=function(){return(i._crypto_box_macbytes=i.asm.U).apply(null,arguments)},i._crypto_box_messagebytes_max=function(){return(i._crypto_box_messagebytes_max=i.asm.V).apply(null,arguments)},i._crypto_box_seed_keypair=function(){return(i._crypto_box_seed_keypair=i.asm.W).apply(null,arguments)},i._crypto_box_keypair=function(){return(i._crypto_box_keypair=i.asm.X).apply(null,arguments)},i._crypto_box_beforenm=function(){return(i._crypto_box_beforenm=i.asm.Y).apply(null,arguments)},i._crypto_box_detached_afternm=function(){return(i._crypto_box_detached_afternm=i.asm.Z).apply(null,arguments)},i._crypto_box_detached=function(){return(i._crypto_box_detached=i.asm._).apply(null,arguments)},i._crypto_box_easy_afternm=function(){return(i._crypto_box_easy_afternm=i.asm.$).apply(null,arguments)},i._crypto_box_easy=function(){return(i._crypto_box_easy=i.asm.aa).apply(null,arguments)},i._crypto_box_open_detached_afternm=function(){return(i._crypto_box_open_detached_afternm=i.asm.ba).apply(null,arguments)},i._crypto_box_open_detached=function(){return(i._crypto_box_open_detached=i.asm.ca).apply(null,arguments)},i._crypto_box_open_easy_afternm=function(){return(i._crypto_box_open_easy_afternm=i.asm.da).apply(null,arguments)},i._crypto_box_open_easy=function(){return(i._crypto_box_open_easy=i.asm.ea).apply(null,arguments)},i._crypto_box_seal=function(){return(i._crypto_box_seal=i.asm.fa).apply(null,arguments)},i._crypto_box_seal_open=function(){return(i._crypto_box_seal_open=i.asm.ga).apply(null,arguments)},i._crypto_box_sealbytes=function(){return(i._crypto_box_sealbytes=i.asm.ha).apply(null,arguments)},i._crypto_generichash_bytes_min=function(){return(i._crypto_generichash_bytes_min=i.asm.ia).apply(null,arguments)},i._crypto_generichash_bytes_max=function(){return(i._crypto_generichash_bytes_max=i.asm.ja).apply(null,arguments)},i._crypto_generichash_bytes=function(){return(i._crypto_generichash_bytes=i.asm.ka).apply(null,arguments)},i._crypto_generichash_keybytes_min=function(){return(i._crypto_generichash_keybytes_min=i.asm.la).apply(null,arguments)},i._crypto_generichash_keybytes_max=function(){return(i._crypto_generichash_keybytes_max=i.asm.ma).apply(null,arguments)},i._crypto_generichash_keybytes=function(){return(i._crypto_generichash_keybytes=i.asm.na).apply(null,arguments)},i._crypto_generichash_statebytes=function(){return(i._crypto_generichash_statebytes=i.asm.oa).apply(null,arguments)},i._crypto_generichash=function(){return(i._crypto_generichash=i.asm.pa).apply(null,arguments)},i._crypto_generichash_init=function(){return(i._crypto_generichash_init=i.asm.qa).apply(null,arguments)},i._crypto_generichash_update=function(){return(i._crypto_generichash_update=i.asm.ra).apply(null,arguments)},i._crypto_generichash_final=function(){return(i._crypto_generichash_final=i.asm.sa).apply(null,arguments)},i._crypto_generichash_keygen=function(){return(i._crypto_generichash_keygen=i.asm.ta).apply(null,arguments)},i._crypto_hash_bytes=function(){return(i._crypto_hash_bytes=i.asm.ua).apply(null,arguments)},i._crypto_hash=function(){return(i._crypto_hash=i.asm.va).apply(null,arguments)},i._crypto_kdf_bytes_min=function(){return(i._crypto_kdf_bytes_min=i.asm.wa).apply(null,arguments)},i._crypto_kdf_bytes_max=function(){return(i._crypto_kdf_bytes_max=i.asm.xa).apply(null,arguments)},i._crypto_kdf_contextbytes=function(){return(i._crypto_kdf_contextbytes=i.asm.ya).apply(null,arguments)},i._crypto_kdf_keybytes=function(){return(i._crypto_kdf_keybytes=i.asm.za).apply(null,arguments)},i._crypto_kdf_derive_from_key=function(){return(i._crypto_kdf_derive_from_key=i.asm.Aa).apply(null,arguments)},i._crypto_kdf_keygen=function(){return(i._crypto_kdf_keygen=i.asm.Ba).apply(null,arguments)},i._crypto_kx_seed_keypair=function(){return(i._crypto_kx_seed_keypair=i.asm.Ca).apply(null,arguments)},i._crypto_kx_keypair=function(){return(i._crypto_kx_keypair=i.asm.Da).apply(null,arguments)},i._crypto_kx_client_session_keys=function(){return(i._crypto_kx_client_session_keys=i.asm.Ea).apply(null,arguments)},i._crypto_kx_server_session_keys=function(){return(i._crypto_kx_server_session_keys=i.asm.Fa).apply(null,arguments)},i._crypto_kx_publickeybytes=function(){return(i._crypto_kx_publickeybytes=i.asm.Ga).apply(null,arguments)},i._crypto_kx_secretkeybytes=function(){return(i._crypto_kx_secretkeybytes=i.asm.Ha).apply(null,arguments)},i._crypto_kx_seedbytes=function(){return(i._crypto_kx_seedbytes=i.asm.Ia).apply(null,arguments)},i._crypto_kx_sessionkeybytes=function(){return(i._crypto_kx_sessionkeybytes=i.asm.Ja).apply(null,arguments)},i._crypto_scalarmult_base=function(){return(i._crypto_scalarmult_base=i.asm.Ka).apply(null,arguments)},i._crypto_scalarmult=function(){return(i._crypto_scalarmult=i.asm.La).apply(null,arguments)},i._crypto_scalarmult_bytes=function(){return(i._crypto_scalarmult_bytes=i.asm.Ma).apply(null,arguments)},i._crypto_scalarmult_scalarbytes=function(){return(i._crypto_scalarmult_scalarbytes=i.asm.Na).apply(null,arguments)},i._crypto_secretbox_keybytes=function(){return(i._crypto_secretbox_keybytes=i.asm.Oa).apply(null,arguments)},i._crypto_secretbox_noncebytes=function(){return(i._crypto_secretbox_noncebytes=i.asm.Pa).apply(null,arguments)},i._crypto_secretbox_macbytes=function(){return(i._crypto_secretbox_macbytes=i.asm.Qa).apply(null,arguments)},i._crypto_secretbox_messagebytes_max=function(){return(i._crypto_secretbox_messagebytes_max=i.asm.Ra).apply(null,arguments)},i._crypto_secretbox_keygen=function(){return(i._crypto_secretbox_keygen=i.asm.Sa).apply(null,arguments)},i._crypto_secretbox_detached=function(){return(i._crypto_secretbox_detached=i.asm.Ta).apply(null,arguments)},i._crypto_secretbox_easy=function(){return(i._crypto_secretbox_easy=i.asm.Ua).apply(null,arguments)},i._crypto_secretbox_open_detached=function(){return(i._crypto_secretbox_open_detached=i.asm.Va).apply(null,arguments)},i._crypto_secretbox_open_easy=function(){return(i._crypto_secretbox_open_easy=i.asm.Wa).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_keygen=function(){return(i._crypto_secretstream_xchacha20poly1305_keygen=i.asm.Xa).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_init_push=function(){return(i._crypto_secretstream_xchacha20poly1305_init_push=i.asm.Ya).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_init_pull=function(){return(i._crypto_secretstream_xchacha20poly1305_init_pull=i.asm.Za).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_rekey=function(){return(i._crypto_secretstream_xchacha20poly1305_rekey=i.asm._a).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_push=function(){return(i._crypto_secretstream_xchacha20poly1305_push=i.asm.$a).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_pull=function(){return(i._crypto_secretstream_xchacha20poly1305_pull=i.asm.ab).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_statebytes=function(){return(i._crypto_secretstream_xchacha20poly1305_statebytes=i.asm.bb).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_abytes=function(){return(i._crypto_secretstream_xchacha20poly1305_abytes=i.asm.cb).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_headerbytes=function(){return(i._crypto_secretstream_xchacha20poly1305_headerbytes=i.asm.db).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_keybytes=function(){return(i._crypto_secretstream_xchacha20poly1305_keybytes=i.asm.eb).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_messagebytes_max=function(){return(i._crypto_secretstream_xchacha20poly1305_messagebytes_max=i.asm.fb).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_tag_message=function(){return(i._crypto_secretstream_xchacha20poly1305_tag_message=i.asm.gb).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_tag_push=function(){return(i._crypto_secretstream_xchacha20poly1305_tag_push=i.asm.hb).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_tag_rekey=function(){return(i._crypto_secretstream_xchacha20poly1305_tag_rekey=i.asm.ib).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_tag_final=function(){return(i._crypto_secretstream_xchacha20poly1305_tag_final=i.asm.jb).apply(null,arguments)},i._crypto_shorthash_bytes=function(){return(i._crypto_shorthash_bytes=i.asm.kb).apply(null,arguments)},i._crypto_shorthash_keybytes=function(){return(i._crypto_shorthash_keybytes=i.asm.lb).apply(null,arguments)},i._crypto_shorthash=function(){return(i._crypto_shorthash=i.asm.mb).apply(null,arguments)},i._crypto_shorthash_keygen=function(){return(i._crypto_shorthash_keygen=i.asm.nb).apply(null,arguments)},i._crypto_sign_statebytes=function(){return(i._crypto_sign_statebytes=i.asm.ob).apply(null,arguments)},i._crypto_sign_bytes=function(){return(i._crypto_sign_bytes=i.asm.pb).apply(null,arguments)},i._crypto_sign_seedbytes=function(){return(i._crypto_sign_seedbytes=i.asm.qb).apply(null,arguments)},i._crypto_sign_publickeybytes=function(){return(i._crypto_sign_publickeybytes=i.asm.rb).apply(null,arguments)},i._crypto_sign_secretkeybytes=function(){return(i._crypto_sign_secretkeybytes=i.asm.sb).apply(null,arguments)},i._crypto_sign_messagebytes_max=function(){return(i._crypto_sign_messagebytes_max=i.asm.tb).apply(null,arguments)},i._crypto_sign_seed_keypair=function(){return(i._crypto_sign_seed_keypair=i.asm.ub).apply(null,arguments)},i._crypto_sign_keypair=function(){return(i._crypto_sign_keypair=i.asm.vb).apply(null,arguments)},i._crypto_sign=function(){return(i._crypto_sign=i.asm.wb).apply(null,arguments)},i._crypto_sign_open=function(){return(i._crypto_sign_open=i.asm.xb).apply(null,arguments)},i._crypto_sign_detached=function(){return(i._crypto_sign_detached=i.asm.yb).apply(null,arguments)},i._crypto_sign_verify_detached=function(){return(i._crypto_sign_verify_detached=i.asm.zb).apply(null,arguments)},i._crypto_sign_init=function(){return(i._crypto_sign_init=i.asm.Ab).apply(null,arguments)},i._crypto_sign_update=function(){return(i._crypto_sign_update=i.asm.Bb).apply(null,arguments)},i._crypto_sign_final_create=function(){return(i._crypto_sign_final_create=i.asm.Cb).apply(null,arguments)},i._crypto_sign_final_verify=function(){return(i._crypto_sign_final_verify=i.asm.Db).apply(null,arguments)},i._crypto_sign_ed25519_pk_to_curve25519=function(){return(i._crypto_sign_ed25519_pk_to_curve25519=i.asm.Eb).apply(null,arguments)},i._crypto_sign_ed25519_sk_to_curve25519=function(){return(i._crypto_sign_ed25519_sk_to_curve25519=i.asm.Fb).apply(null,arguments)},i._randombytes_random=function(){return(i._randombytes_random=i.asm.Gb).apply(null,arguments)},i._randombytes_stir=function(){return(i._randombytes_stir=i.asm.Hb).apply(null,arguments)},i._randombytes_uniform=function(){return(i._randombytes_uniform=i.asm.Ib).apply(null,arguments)},i._randombytes_buf=function(){return(i._randombytes_buf=i.asm.Jb).apply(null,arguments)},i._randombytes_buf_deterministic=function(){return(i._randombytes_buf_deterministic=i.asm.Kb).apply(null,arguments)},i._randombytes_seedbytes=function(){return(i._randombytes_seedbytes=i.asm.Lb).apply(null,arguments)},i._randombytes_close=function(){return(i._randombytes_close=i.asm.Mb).apply(null,arguments)},i._randombytes=function(){return(i._randombytes=i.asm.Nb).apply(null,arguments)},i._sodium_bin2hex=function(){return(i._sodium_bin2hex=i.asm.Ob).apply(null,arguments)},i._sodium_hex2bin=function(){return(i._sodium_hex2bin=i.asm.Pb).apply(null,arguments)},i._sodium_base64_encoded_len=function(){return(i._sodium_base64_encoded_len=i.asm.Qb).apply(null,arguments)},i._sodium_bin2base64=function(){return(i._sodium_bin2base64=i.asm.Rb).apply(null,arguments)},i._sodium_base642bin=function(){return(i._sodium_base642bin=i.asm.Sb).apply(null,arguments)},i._sodium_init=function(){return(i._sodium_init=i.asm.Tb).apply(null,arguments)},i._sodium_pad=function(){return(i._sodium_pad=i.asm.Ub).apply(null,arguments)},i._sodium_unpad=function(){return(i._sodium_unpad=i.asm.Vb).apply(null,arguments)},i._sodium_version_string=function(){return(i._sodium_version_string=i.asm.Wb).apply(null,arguments)},i._sodium_library_version_major=function(){return(i._sodium_library_version_major=i.asm.Xb).apply(null,arguments)},i._sodium_library_version_minor=function(){return(i._sodium_library_version_minor=i.asm.Yb).apply(null,arguments)},i._sodium_library_minimal=function(){return(i._sodium_library_minimal=i.asm.Zb).apply(null,arguments)},i._malloc=function(){return(i._malloc=i.asm._b).apply(null,arguments)},i._free=function(){return(i._free=i.asm.$b).apply(null,arguments)},i.UTF8ToString=H,i.setValue=function(A,I,g="i8"){switch(g.endsWith("*")&&(g="*"),g){case"i1":case"i8":w[A>>0]=I;break;case"i16":s[A>>1]=I;break;case"i32":p[A>>2]=I;break;case"i64":d=[I>>>0,(m=I,+Math.abs(m)>=1?m>0?(0|Math.min(+Math.floor(m/4294967296),4294967295))>>>0:~~+Math.ceil((m-+(~~m>>>0))/4294967296)>>>0:0)],p[A>>2]=d[0],p[A+4>>2]=d[1];break;case"float":k[A>>2]=I;break;case"double":F[A>>3]=I;break;case"*":u[A>>2]=I;break;default:K("invalid type for setValue: "+g)}},i.getValue=function(A,I="i8"){switch(I.endsWith("*")&&(I="*"),I){case"i1":case"i8":return w[A>>0];case"i16":return s[A>>1];case"i32":case"i64":return p[A>>2];case"float":return k[A>>2];case"double":return F[A>>3];case"*":return u[A>>2];default:K("invalid type for getValue: "+I)}return null},_=function A(){W||$(),W||(_=A)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();$()}))};var g,B,Q,i=void 0!==i?i:{},E=Object.assign({},i),o="object"==typeof window,a="function"==typeof importScripts,n= true&&"object"==typeof ({"env":{"NODE_ENV":"production"}}).versions&&"string"==typeof ({"env":{"NODE_ENV":"production"}}).versions.node,r="";if(n){var f=__webpack_require__(/*! fs */ "?f0f8"),t=__webpack_require__(/*! path */ "?ebe9");r=a?t.dirname(r)+"/":__dirname+"/",g=(A,I)=>{var g=V(A);return g?I?g:g.toString():(A=L(A)?new URL(A):t.normalize(A),f.readFileSync(A,I?void 0:"utf8"))},Q=A=>{var I=g(A,!0);return I.buffer||(I=new Uint8Array(I)),I},B=(A,I,g)=>{var C=V(A);C&&I(C),A=L(A)?new URL(A):t.normalize(A),f.readFile(A,(function(A,C){A?g(A):I(C.buffer)}))},({"env":{"NODE_ENV":"production"}}).argv.length>1&&({"env":{"NODE_ENV":"production"}}).argv[1].replace(/\\/g,"/"),({"env":{"NODE_ENV":"production"}}).argv.slice(2), true&&(module.exports=i),i.inspect=function(){return"[Emscripten Module object]"}}else(o||a)&&(a?r=self.location.href:"undefined"!=typeof document&&document.currentScript&&(r=document.currentScript.src),r=0!==r.indexOf("blob:")?r.substr(0,r.replace(/[?#].*/,"").lastIndexOf("/")+1):"",g=A=>{try{var I=new XMLHttpRequest;return I.open("GET",A,!1),I.send(null),I.responseText}catch(I){var g=V(A);if(g)return function(A){for(var I=[],g=0;g255&&(C&=255),I.push(String.fromCharCode(C))}return I.join("")}(g);throw I}},a&&(Q=A=>{try{var I=new XMLHttpRequest;return I.open("GET",A,!1),I.responseType="arraybuffer",I.send(null),new Uint8Array(I.response)}catch(I){var g=V(A);if(g)return g;throw I}}),B=(A,I,g)=>{var C=new XMLHttpRequest;C.open("GET",A,!0),C.responseType="arraybuffer",C.onload=()=>{if(200==C.status||0==C.status&&C.response)I(C.response);else{var B=V(A);B?I(B.buffer):g()}},C.onerror=g,C.send(null)});i.print;var e,c,y=i.printErr||void 0;Object.assign(i,E),E=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram,i.quit&&i.quit,i.wasmBinary&&(e=i.wasmBinary),i.noExitRuntime,"object"!=typeof WebAssembly&&b("no native wasm support detected");var D,w,h,s,p,u,k,F=!1,l="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function S(A,I){return A?function(A,I,g){for(var C=I+g,B=I;A[B]&&!(B>=C);)++B;if(B-I>16&&A.buffer&&l)return l.decode(A.subarray(I,B));for(var Q="";I>10,56320|1023&a)}}else Q+=String.fromCharCode((31&i)<<6|E)}else Q+=String.fromCharCode(i)}return Q}(w,A,I):""}function H(){var A=c.buffer;i.HEAP8=D=new Int8Array(A),i.HEAP16=h=new Int16Array(A),i.HEAP32=s=new Int32Array(A),i.HEAPU8=w=new Uint8Array(A),i.HEAPU16=new Uint16Array(A),i.HEAPU32=p=new Uint32Array(A),i.HEAPF32=u=new Float32Array(A),i.HEAPF64=k=new Float64Array(A)}var M=[],G=[],U=[],J=0,N=null,Y=null;function b(A){throw i.onAbort&&i.onAbort(A),y(A="Aborted("+A+")"),F=!0,A+=". Build with -sASSERTIONS for more info.",new WebAssembly.RuntimeError(A)}var _,K,P,v,m="data:application/octet-stream;base64,";function d(A){return A.startsWith(m)}function L(A){return A.startsWith("file://")}function R(A){try{if(A==_&&e)return new Uint8Array(e);var I=V(A);if(I)return I;if(Q)return Q(A);throw"both async and sync fetching of the wasm failed"}catch(A){b(A)}}d(_="data:application/octet-stream;base64,AGFzbQEAAAABiwIfYAN/f34Bf2ACf38Bf2AAAX9gA39/fwF/YAJ/fwBgA39/fwBgBX9/f39/AX9gC39/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gAiABLQAAOgAAIAIgAS0AAToAASACIAEtAAI6AAIgAiABLQADOgADIAFBBGohASACQQRqIgIgBE0NAAsLIAIgA0kEQANAIAIgAS0AADoAACABQQFqIQEgAkEBaiICIANHDQALCyAAC6EGAgd+BH8jAEHABWsiDCQAAkAgAlANACAAIAApA0giAyACQgOGfCIENwNIIABBQGsiCiAKKQMAIAMgBFatfCACQj2IfDcDACACQoABIANCA4hC/wCDIgR9IghaBEBCACEDIARC/wCFQgNaBEAgCEL8AYMhByAAQdAAaiEKA0AgCiADIAR8p2ogASADp2otAAA6AAAgCiADQgGEIgkgBHynaiABIAmnai0AADoAACAKIANCAoQiCSAEfKdqIAEgCadqLQAAOgAAIAogA0IDhCIJIAR8p2ogASAJp2otAAA6AAAgA0IEfCEDIAVCBHwiBSAHUg0ACwsgCEIDgyIFQgBSBEADQCAAIAMgBHynaiABIAOnai0AADoAUCADQgF8IQMgBkIBfCIGIAVSDQALCyAAIABB0ABqIAwgDEGABWoiChAlIAEgCKdqIQEgAiAIfSICQv8AVgRAA0AgACABIAwgChAlIAFBgAFqIQEgAkKAAX0iAkL/AFYNAAsLAkAgAlANACACQgODIQRCACEGQgAhAyACQgRaBEAgAkJ8gyEFIABB0ABqIQpCACECA0AgCiADpyILaiABIAtqLQAAOgAAIAogC0EBciINaiABIA1qLQAAOgAAIAogC0ECciINaiABIA1qLQAAOgAAIAogC0EDciILaiABIAtqLQAAOgAAIANCBHwhAyACQgR8IgIgBVINAAsLIARQDQADQCAAIAOnIgpqIAEgCmotAAA6AFAgA0IBfCEDIAZCAXwiBiAEUg0ACwsgDEHABRAHDAELQgAhAyACQgRaBEAgAkJ8gyEIIABB0ABqIQoDQCAKIAMgBHynaiABIAOnai0AADoAACAKIANCAYQiByAEfKdqIAEgB6dqLQAAOgAAIAogA0IChCIHIAR8p2ogASAHp2otAAA6AAAgCiADQgOEIgcgBHynaiABIAenai0AADoAACADQgR8IQMgBUIEfCIFIAhSDQALCyACQgODIgJQDQADQCAAIAMgBHynaiABIAOnai0AADoAUCADQgF8IQMgBkIBfCIGIAJSDQALCyAMQcAFaiQAQQALsQQCE38EfiABKAIoIQIgASgCBCEDIAEoAiwhBCABKAIIIQUgASgCMCEGIAEoAgwhByABKAI0IQggASgCECEJIAEoAjghCiABKAIUIQsgASgCPCEMIAEoAhghDSABQUBrIg4oAgAhDyABKAIcIRAgASgCRCERIAEoAiAhEiABKAJIIRMgASgCACEUIAAgASgCJCABKAJMajYCJCAAIBIgE2o2AiAgACAQIBFqNgIcIAAgDSAPajYCGCAAIAsgDGo2AhQgACAJIApqNgIQIAAgByAIajYCDCAAIAUgBmo2AgggACADIARqNgIEIAAgAiAUajYCACABKAIoIQIgASgCBCEDIAEoAiwhBCABKAIIIQUgASgCMCEGIAEoAgwhByABKAI0IQggASgCECEJIAEoAjghCiABKAIUIQsgASgCPCEMIAEoAhghDSAOKAIAIQ4gASgCHCEPIAEoAkQhECABKAIgIREgASgCSCESIAEoAgAhEyAAIAEoAkwgASgCJGs2AkwgACASIBFrNgJIIAAgECAPazYCRCAAQUBrIA4gDWs2AgAgACAMIAtrNgI8IAAgCiAJazYCOCAAIAggB2s2AjQgACAGIAVrNgIwIAAgBCADazYCLCAAIAIgE2s2AiggASkCUCEVIAEpAlghFiABKQJgIRcgASkCaCEYIAAgASkCcDcCcCAAIBg3AmggACAXNwJgIAAgFjcCWCAAIBU3AlAgAEH4AGogAUH4AGpBoAsQBgvwCQEefyABKAIoIQMgASgCBCEEIAEoAiwhBSABKAIIIQYgASgCMCEHIAEoAgwhCCABKAI0IQkgASgCECEKIAEoAjghCyABKAIUIQwgASgCPCENIAEoAhghDiABQUBrIg8oAgAhECABKAIcIREgASgCRCESIAEoAiAhEyABKAJIIRQgASgCACEVIAAgASgCJCABKAJMajYCJCAAIBMgFGo2AiAgACARIBJqNgIcIAAgDiAQajYCGCAAIAwgDWo2AhQgACAKIAtqNgIQIAAgCCAJajYCDCAAIAYgB2o2AgggACAEIAVqNgIEIAAgAyAVajYC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CAAICQgJWo2AjQgACAiICNqNgIwIAAgICAhajYCLCAAQShqIgEgHyAwajYCACAeIAEQBSAAKAJQIR8gACgCBCEgIAAoAlQhISAAKAIIISIgACgCWCEjIAAoAgwhJCAAKAJcISUgACgCECEmIAAoAmAhJyAAKAIUISggACgCZCEpIAAoAhghKiAAKAJoISsgACgCHCEsIAAoAmwhLSAAKAIgIS4gACgCcCEvIAAoAgAhMCAAIAAoAnQiMSAAKAIkIjNrIjQ2AnQgACAvIC5rIjU2AnAgACAtICxrIjY2AmwgACArICprIjc2AmggACApIChrIjg2AmQgACAnICZrIjk2AmAgACAlICRrIjo2AlwgACAjICJrIjs2AlggACAhICBrIjw2AlQgACAfIDBrIj02AlAgACAxIDNqIjE2AkwgACAuIC9qIi42AkggACAsIC1qIiw2AkQgMiAqICtqIio2AgAgACAoIClqIig2AjwgACAmICdqIiY2AjggACAkICVqIiQ2AjQgACAiICNqIiI2AjAgACAgICFqIiA2AiwgASAfIDBqIgE2AgAgHigCACEfIB4oAgQhISAeKAIIISMgHigCDCElIB4oAhAhJyAeKAIUISkgHigCGCErIB4oAhwhLSAeKAIgIS8gACAeKAIkIDFrNgIkIAAgLyAuazYCICAAIC0gLGs2AhwgACArICprNgIYIAAgKSAoazYCFCAAICcgJms2AhAgACAlICRrNgIMIAAgIyAiazYCCCAAICEgIGs2AgQgACAfIAFrNgIAIAAoAnghASAAKAJ8IR8gACgCgAEhICAAKAKEASEhIAAoAogBISIgACgCjAEhIyAAKAKQASEkIAAoApQBISUgACgCmAEhJiAAIAAoApwBIDRrNgKcASAAICYgNWs2ApgBIAAgJSA2azYClAEgACAkIDdrNgKQASAAICMgOGs2AowBIAAgIiA5azYCiAEgACAhIDprNgKEASAAICAgO2s2AoABIAAgHyA8azYCfCAAIAEgPWs2AnggHkEwaiQAC0QBAn8jAEEQayICJAAgAQRAA0AgAkEAOgAPIAAgA2pB2JACIAJBD2pBABAAOgAAIANBAWoiAyABRw0ACwsgAkEQaiQACyQAIAFCgIC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EgARAFIAEgARAFIAMgASADEAYgASADEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABIAMQBiACIAEQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSACIAIQBSABIAIgARAGIAEgARAFIAEgARAFIAEgARAFIAEgARAFIAEgARAFIAEgARAFIAEgARAFIAEgARAFIAEgARAFIAEgARAFIAMgASADEAYgASADEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABEAUgASABIAMQBiACIAEQBUEBIQEDQCACIAIQBSABQQFqIgFB5ABHDQALIAJBMGoiASACIAEQBiABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSABIAEQBSAB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A/QbAEaiQAQQAL2wEBA38jAEEQayIDIAA2AgwgAyABNgIIQQAhACADQQA6AAcCQCACRQ0AIAJBAXEhASACQQFHBEAgAkF+cSEEQQAhAgNAIAMgAy0AByADKAIMIABqLQAAIAMoAgggAGotAABzcjoAByADIAMtAAcgAEEBciIFIAMoAgxqLQAAIAMoAgggBWotAABzcjoAByAAQQJqIQAgAkECaiICIARHDQALCyABRQ0AIAMgAy0AByADKAIMIABqLQAAIAMoAgggAGotAABzcjoABwsgAy0AB0EBa0EIdkEBcUEBawsEAEEIC4MDAgN/An4jAEFAaiIDJAACQCACQcEAa0H/AXFBvwFLBEBBfyEEIAApAFBQBEAgACgA4AIiBUGBAU8EQCAAQUBrIgUgBSkAACIGQoABfDcAACAAIAApAEggBkL/flatfDcASCAAIABB4ABqIgQQKCAAIAAoAOACQYABayIFNgDgAiAFQYEBTw0DIAQgAEHgAWogBRALGiAAKADgAiEFCyAAQUBrIgQgBCkAACIGIAWtfCIHNwAAIAAgACkASCAGIAdWrXw3AEggAC0A5AIEQCAAQn83AFgLIABCfzcAUCAAQeAAaiIEIAVqQQBBgAIgBWsQCBogACAEECggAyAAKQAANwMAIAMgACkACDcDCCADIAApABA3AxAgAyAAKQAYNwMYIAMgACkAIDcDICADIAApACg3AyggAyAAKQAwNwMwIAMgACkAODcDOCABIAMgAhALGiAAQcAAEAcgBEGAAhAHQQAhBAsgA0FAayQAIAQPCxAJAAtBgApB9ghBsgJBvggQAQAL6RICFX4DfyAAIAAoACwiFkEFdkH///8Aca0gACgAPEEDdq0iAkKDoVZ+IAAzACogADEALEIQhkKAgPwAg4R8IghCgIBAfSIJQhWHfCIBQoOhVn4gADUAMUIHiEL///8AgyIDQtOMQ34gACgAFyIXQRh2rSAAMQAbQgiGhCAAMQAcQhCGhEICiEL///8Ag3wgACgANCIYQQR2Qf///wBxrSIEQuf2J358IBZBGHatIAAxADBCCIaEIAAxADFCEIaEQgKIQv///wCDIgVC0asIfnwgADUAOUIGiEL///8AgyIG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IAVC////AIN8IAFCFYd8IgNCBog8AAYgACADQgKGIAFCgIDgAINCE4iEPAAFIAAgAkLTjEN+IAZC////AIN8IANCFYd8IgFCCYg8AAkgACABQgGIPAAIIAAgAUIHhiADQoCA/wCDQg6IhDwAByAAIAJC0asIfiAKQv///wCDfCABQhWHfCIDQgyIPAAMIAAgA0IEiDwACyAAIANCBIYgAUKAgPgAg0IRiIQ8AAogACACQoOhVn4gCUL///8Ag3wgA0IVh3wiAUIHiDwADiAAIAFCAYYgA0KAgMAAg0IUiIQ8AA0gACAHQv///wCDIAFCFYd8IgJCCog8ABEgACACQgKIPAAQIAAgAkIGhiABQoCA/gCDQg+IhDwADyAAIAtC////AIMgAkIVh3wiAUINiDwAFCAAIAFCBYg8ABMgACAQQv///wCDIAFCFYd8IgM8ABUgACABQgOGIAJCgIDwAINCEoiEPAASIAAgA0IIiDwAFiAAIAxC////AIMgA0IVh3wiAkILiDwAGSAAIAJCA4g8ABggACADQhCIQh+DIAJCBYaEPAAXIAAgDUL///8AgyACQhWHfCIBQgaIPAAbIAAgAUIChiACQoCA4ACDQhOIhDwAGiAAIAhC////AIMgAUIVh3wiAkIRiDwAHyAAIAJCCYg8AB4gACACQgGIPAAdIAAgAkIHhiABQoCA/wCDQg6IhDwAHAv4AQEKfwNAIAQgACADai0AACIBIANBkBNqIgItAABzciEEIAogASACLQDAAXNyIQogCSABIAItAKABc3IhCSAIIAEgAi0AgAFzciEIIAcgASACLQBgc3IhByAGIAEgAkFAay0AAHNyIQYgBSABIAItACBzciEFIANBAWoiA0EfRw0ACyAKIAAtAB9B/wBxIgBB/wBzIgFyQf8BcUEBayABIAlyQf8BcUEBayABIAhyQf8BcUEBayAHIABB+gBzckH/AXFBAWsgBiAAQQVzckH/AXFBAWsgACAFckH/AXFBAWsgACAEckH/AXFBAWtycnJycnJBCHZBAXEL4AkBHn8gASgCKCEDIAEoAgQhBCABKAIsIQUgASgCCCEGIAEoAjAhByABKAIMIQggASgCNCEJIAEoAhAhCiAB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gIMIAAgCCAHazYCCCAAIAYgBWs2AgQgACACIAFrNgIAIAAgHkEBdCIBIAAoApwBIgJrNgKcASAAIB1BAXQiAyAAKAKYASIEazYCmAEgACAcQQF0IgUgACgClAEiBms2ApQBIAAgG0EBdCIHIAAoApABIghrNgKQASAAIBpBAXQiCSAAKAKMASIKazYCjAEgACAZQQF0IgsgACgCiAEiDGs2AogBIAAgGEEBdCINIAAoAoQBIg5rNgKEASAAIBdBAXQiDyAAKAKAASIQazYCgAEgACAWQQF0IhEgACgCfCISazYCfCAAIBVBAXQiEyAAKAJ4IhRrNgJ4IAAgAyAEajYCcCAAIAUgBmo2AmwgACAHIAhqNgJoIAAgCSAKajYCZCAAIAsgDGo2AmAgACANIA5qNgJcIAAgDyAQajYCWCAAIBEgEmo2AlQgACATIBRqNgJQIAAgASACajYCdAumBAIOfgp/IAAoAiQhEiAAKAIgIRMgACgCHCEUIAAoAhghFSAAKAIUIREgAkIQWgRAIAAtAFBFQRh0IRYgACgCECIXrSEPIAAoAgwiGK0hDSAAKAIIIhmtIQsgACgCBCIarSEJIBpBBWytIRAgGUEFbK0hDiAYQQVsrSEMIBdBBWytIQogADUCACEIA0AgASgAA0ECdkH///8fcSAVaq0iAyANfiABKAAAQf///x9xIBFqrSIEIA9+fCABKAAGQQR2Qf///x9xIBRqrSIFIAt+fCABKAAJQQZ2IBNqrSIGIAl+fCASIBZqIAEoAAxBCHZqrSIHIAh+fCADIAt+IAQgDX58IAUgCX58IAYgCH58IAcgCn58IAMgCX4gBCALfnwgBSAIfnwgBiAKfnwgByAMfnwgAyAIfiAEIAl+fCAFIAp+fCAGIAx+fCAHIA5+fCADIAp+IAQgCH58IAUgDH58IAYgDn58IAcgEH58IgNCGohC/////w+DfCIEQhqIQv////8Pg3wiBUIaiEL/////D4N8IgZCGohC/////w+DfCIHQhqIp0EFbCADp0H///8fcWoiEUEadiAEp0H///8fcWohFSAFp0H///8fcSEUIAanQf///x9xIRMgB6dB////H3EhEiARQf///x9xIREgA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SACIAIgBhAGIAMgAygChAEiAiAUazYCVCADIAMoAoABIgQgE2s2AlAgAyADKAJ8IgUgEms2AkwgAyADKAJ4IgYgEWs2AkggAyADKAJ0IgcgEGs2AkQgAyADKAJwIgggD2s2AkAgAyADKAJsIhUgDms2AjwgAyADKAJoIhYgDWs2AjggAyADKAJkIhcgDGs2AjQgAyADKAJgIhggC2s2AjAgAyADQTBqEBICQCADQSAQH0UEQCADIAIgFGo2AiQgAyAEIBNqNgIgIAMgBSASajYCHCADIAYgEWo2AhggAyAHIBBqNgIUIAMgCCAPajYCECADIA4gFWo2AgwgAyANIBZqNgIIIAMgDCAXajYCBCADIAsgGGo2AgAgA0GgAmoiAiADEBIgAkEgEB9FDQEgACAAQfAKEAYLIANBoAJqIAAQEiADLQCgAkEBcSABLQAfQQd2RgRAIABBACAAKAIAazYCACAAQQAgACgCJGs2AiQgAEEAIAAoAiBrNgIgIABBACAAKAIcazYCHCAAQQAgACgCGGs2AhggAEEAIAAoAhRrNgIUIABBACAAKAIQazYCECAAQQAgACgCDGs2AgwgAEEAIAAoAghrNgIIIABBACAAKAIEazYCBAsgAEH4AGogACAJEAZBACEKCyADQcACaiQAIAoL9AQBGX4gATEAHyECIAExAB4hBiABMQAdIQ4gATEABiEHIAExAAUhCCABMQAEIQMgATEACSEPIAExAAghECABMQAHIREgATEADCEJIAExAAshCiABMQAKIQsgATEADyEMIAExAA4hEiABMQANIRMgATEAHCEEIAExABshFCABMQAaIRUgATEAGSEFIAExABghFiABMQAXIRcgATUAACEYIAAgATEAFUIPhiABMQAUQgeGhCABMQAWQheGhCABNQAQIhlCgICACHwiGkIZiHwiDSANQoCAgBB8Ig1CgICA4A+DfT4CGCAAIBZCDYYgF0IFhoQgBUIVhoQiBSANQhqIfCAFQoCAgAh8IgVCgICA8AODfT4CHCAAIBRCDIYgFUIEhoQgBEIUhoQgBUIZiHwiBCAEQoCAgBB8IgRCgICA4A+DfT4CICAAIBkgGkKAgIDwD4N9IBJCCoYgE0IChoQ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AABAHIAJBQGskAAsLACAAIAEgAhAMGguEAwEGfyMAQcABayIEJAAgABAZIARBQGtBNkGAARAIGgNAIARBQGsiBSACaiIDIAMtAAAgASACai0AAHM6AAAgBSACQQFyIgNqIgYgBi0AACABIANqLQAAczoAACAFIAJBAnIiA2oiBiAGLQAAIAEgA2otAABzOgAAIAUgAkEDciIDaiIFIAUtAAAgASADai0AAHM6AAAgAkEEaiECIAdBBGoiB0EgRw0ACyAAIARBQGsiAkKAARAMGiAAQdABaiIFEBkgAkHcAEGAARAIGkEAIQJBACEHA0AgBEFAayIAIAJqIgMgAy0AACABIAJqLQAAczoAACAAIAJBAXIiA2oiBiAGLQAAIAEgA2otAABzOgAAIAAgAkECciIDaiIGIAYtAAAgASADai0AAHM6AAAgACACQQNyIgNqIgAgAC0AACABIANqLQAAczoAACACQQRqIQIgB0EEaiIHQSBHDQALIAUgBEFAayIAQoABEAwaIABBgAEQByAEQcAAEAcgBEHAAWokAAvVAgECfyMAQZADayIIJAAgCEEANgIEIAhBEGoiCSAGIAcQJyAIIAYpABA3AgggCEHQAGoiB0LAACAIQQRqIAkQFyAIQZABaiIGIAdBvJACKAIAEQEAGiAHQcAAEAcgBiAEIAVBwJACKAIAEQAAGiAGQYCQAkIAIAV9Qg+DQcCQAigCABEAABogBiABIAJBwJACKAIAEQAAGiAGQYCQAkIAIAJ9Qg+DQcCQAigCABEAABogCCAFNwNIIAYgCEHIAGoiBEIIQcCQAigCABEAABogCCACNwNIIAYgBEIIQcCQAigCABEAABogBiAIQTBqIgRBxJACKAIAEQEAGiAGQYACEAcgBCADEC0hBiAEQRAQBwJAIABFDQAgBgRAIABBACACpxAIGkF/IQYMAQsgACABIAIgCEEEaiAIQRBqEE1BACEGCyAIQRBqQSAQByAIQZADaiQAIAYLpwIBA38jAEGAA2siCSQAIAlBADYCBCAJQRBqIgogByAIECcgCSAHKQAQNwIIIAlBQGsiCELAACAJQQRqIgsgChAXIAlBgAFqIgcgCEG8kAIoAgARAQAaIAhBw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q18NwNIIAEgBRAoIAUgCkGAARALGiABIAEoAuACQYABayIENgLgAiACIAdqIQIgAyALfSIDQgBSDQALCyABIAAgBhA1GiAJJABBAAwBCxAJAAshBgsgBgu2AQIBfwN+IwBBoAFrIgMkACABIAJCIBAYGiABIAEtAABB+AFxOgAAIAEgAS0AH0E/cUHAAHI6AB8gAyABECogACADECsgAikACCEEIAIpABAhBSACKQAAIQYgASACKQAYNwAYIAEgBTcAECABIAQ3AAggASAGNwAAIAApAAghBCAAKQAQIQUgACkAACEGIAEgACkAGDcAOCABIAU3ADAgASAENwAoIAEgBjcAICADQaABaiQAQQALBQBBv38LBQBB0AELbQEBfyMAQUBqIgIkACACIAFCIBAYGiACIAItAABB+AFxOgAAIAIgAi0AH0E/cUHAAHI6AB8gACACKQMQNwAQIAAgAikDCDcACCAAIAIpAwA3AAAgACACKQMYNwAYIAJBwAAQByACQUBrJABBAAvXFAIPfyd+IwBBgAJrIgMkAEF/IRACQCABEDcNACADQeAAaiABEEkNACMAQYAQayICJAAgAkGABWoiCiADQeAAaiIBEA0gASkCCCERIAEpAhAhEiABKQIYIRMgASkCACEUIAIgASkCIDcD4AIgAiATNwPYAiACIBI3A9ACIAIgETcDyAIgAiAUNwPAAiABKQIoIREgASkCMCESIAEpAjghEyABQUBrKQIAIRQgAiABKQJINwOIAyACIBQ3A4ADIAIgEzcD+AIgAiASNwPwAiACIBE3A+gCIAEpAlAhESABKQJYIRIgASkCYCETIAEpAmghFCACIAEpAnA3A7ADIAIgFDcDqAMgAiATNwOgAyACIBI3A5gDIAIgETcDkAMgAkHgA2oiASACQcACaiIHEBUgAkGgAWoiCCABIAJB2ARqIgUQBiACQcgBaiACQYgEaiIGIAJBsARqIgQQBiACQfABaiAEIAUQBiACQZgCaiABIAYQBiABIAggChAOIAcgASAFEAYgAkHoAmoiCiAGIAQQBiACQZADaiILIAQgBRAGIAJBuANqIgwgASAGEAYgAkGgBmoiCSAHEA0gASAIIAkQDiAHIAEgBRAGIAogBiAEEA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IBAfIQEgAkGAEGokACABRQ0AIANBASADKAKIASIEazYCAEEAIRAgA0EAIAMoAqwBIgFrNgIkIANBACADKAKoASIKazYCICADQQAgAygCpAEiB2s2AhwgA0EAIAMoAqABIgtrNgIYIANBACADKAKcASICazYCFCADQQAgAygCmAEiDGs2AhAgA0EAIAMoApQBIgVrNgIMIANBACADKAKQASIIazYCCCADQQAgAygCjAEiBms2AgQgAyADECwgAyADKAIEIgmsIhkgAkEBdKwiIn4gAzQCACIRIAusIhJ+fCADKAIIIgusIhsgDKwiE358IAMoAgwiDKwiHiAFQQF0rCIjfnwgAygCECIOrCIfIAisIhR+fCADKAIUIgisIiQgBkEBdKwiJX58IAMoAhgiD6wiLiAEQQFqrCIXfnwgAygCHCIEQRNsrCIaIAFBAXSsIiZ+fCADKAIgIg1BE2ysIhUgCqwiGH58IAMoAiQiCkETbKwiFiAHQQF0rCInfnwgEyAZfiARIAKsIih+fCAbIAWsIil+fCAUIB5+fCAfIAasIip+fCAXICR+fCAPQRNsrCIcIAGsIit+fCAYIBp+fCAVIAesIix+fCASIBZ+fCAZICN+IBEgE358IBQgG358IB4gJX58IBcgH358IAhBE2ysIi0gJn58IBggHH58IBogJ358IBIgFX58IBYgIn58IjBCgICAEHwiMUIah3wiMkKAgIAIfCIzQhmHfCIgICBCgICAEHwiIUKAgIDgD4N9PgJIIAMgGSAlfiARIBR+fCAXIBt+fCAMQRNsrCIdICZ+fCAOQRNsrCIgIBh+fCAnIC1+fCASIBx+fCAaICJ+fCATIBV+fCAWICN+fCAXIBl+IBEgKn58IAtBE2ysIi8gK358IBggHX58ICAgLH58IBIgLX58IBwgKH58IBMgGn58IBUgKX58IBQgFn58IAlBE2ysICZ+IBEgF358IBggL358IB0gJ358IBIgIH58ICIgLX58IBMgHH58IBogI358IBQgFX58IBYgJX58Ii9CgICAEHwiNEIah3wiNUKAgIAIfCI2QhmHfCIdIB1CgICAEHwiN0KAgIDgD4N9PgI4IAMgEiAZfiARICx+fCAbICh+fCATIB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vIAJBCHZqOgBvIABBQGshACABQkB8IgFCP1YNAAsgAVANAQtBACECIARBIGogBEHgAGogBBApIAGnIgVBA3EhB0EAIQMgBUEBa0EDTwRAIAVBfHEhCEEAIQUDQCAAIANqIARBIGoiCSADai0AADoAACAAIANBAXIiBmogBiAJai0AADoAACAAIANBAnIiBmogBEEgaiAGai0AADoAACAAIANBA3IiBmogBEEgaiAGai0AADoAACADQQRqIQMgBUEEaiIFIAhHDQALCyAHRQ0AA0AgACADaiAEQSBqIANqLQAAOgAAIANBAWohAyACQQFqIgIgB0cNAAsLIARBIGpBwAAQByAEQSAQBwsgBEHwAGokAEEAC4YGARR/IwBBsAJrIgIkACAAIAEtAAA6AAAgACABLQABOgABIAAgAS0AAjoAAiAAIAEtAAM6AAMgACABLQAEOgAEIAAgAS0ABToABSAAIAEtAAY6AAYgACABLQAHOgAHIAAgAS0ACDoACCAAIAEtAAk6AAkgACABLQAKOgAKIAAgAS0ACzoACyAAIAEtAAw6AAwgACABLQANOgANIAAgAS0ADjoADiAAIAEtAA86AA8gACABLQAQOgAQIAAgAS0AEToAESAAIAEtABI6ABIgACABLQATOgATIAAgAS0AFDoAFCAAIAEtABU6ABUgACABLQAWOgAWIAAgAS0AFzoAFyAAIAEtABg6ABggACABLQAZOgAZIAAgAS0AGjoAGiAAIAEtABs6ABsgACABLQAcOgAcIAAgAS0AHToAHSAAIAEtAB46AB4gAS0AHyEBIAAgAC0AAEH4AXE6AAAgACABQT9xQcAAcjoAHyACQTBqIAAQKiACKAKEASEBIAIoAlwhAyACKAKIASEEIAIoAmAhBSACKAKMASEGIAIoAmQhByACKAKQASEIIAIoAmghCSACKAKUASEKIAIoAmwhCyACKAKYASEMIAIoAnAhDSACKAKcASEOIAIoAnQhDyACKAKgASEQIAIoAnghESACKAKAASESIAIoAlghEyACIAIoAnwiFCACKAKkASIVajYCpAIgAiAQIBFqNgKgAiACIA4gD2o2ApwCIAIgDCANajYCmAIgAiAKIAtqNgKUAiACIAggCWo2ApACIAIgBiAHajYCjAIgAiAEIAVqNgKIAiACIAEgA2o2AoQCIAIgEiATajYCgAIgAiAVIBRrNgL0ASACIBAgEWs2AvABIAIgDiAPazYC7AEgAiAMIA1rNgLoASACIAogC2s2AuQBIAIgCCAJazYC4AEgAiAGIAdrNgLcASACIAQgBWs2AtgBIAIgASADazYC1AEgAiASIBNrNgLQASACQdABaiIBIAEQLCACIAJBgAJqIAEQBiAAIAIQEiACQbACaiQAQQAL+RwCPX8MfiMAQfACayIDJAADQCACIAZqLQAAIgQgBkGQhwJqIgktAABzIAdyIQcgBCAJLQDAAXMgBXIhBSAEIAktAKABcyAMciEMIAQgCS0AgAFzIAhyIQggBCAJLQBgcyANciENIAQgCUFAay0AAHMgC3IhCyAEIAktACBzIApyIQogBkEBaiIGQR9HDQALQX8hCSACLQAfQf8AcSIEIApyQf8BcUEBayAEIAdyQf8BcUEBa3IgBCALckH/AXFBAWtyIARB1wBzIA1yQf8BcUEBa3IgBEH/AHMiBCAIckH/AXFBAWtyIAQgDHJB/wFxQQFrciAEIAVyQf8BcUEBa3JBgAJxRQRAIAMgASkAGDcD6AIgAyABKQAQNwPgAiADIAEpAAAiQjcD0AIgAyABKQAINwPYAiADIEKnQfgBcToA0AIgAyADLQDvAkE/cUHAAHI6AO8CIANBoAJqIAIQSiADQgA3AoQCIANCADcCjAIgA0EANgKUAiADQgA3A9ABIANCADcD2AEgA0IANwPgASADQgA3AvQBIANBATYC8AEgA0IANwL8ASADQgA3A8ABIANCADcDyAEgAyADKQO4AjcDqAEgAyADKQOwAjcDoAEgAyADKQOoAjcDmAEgAyADKQOgAjcDkAEgAyADKQPAAjcDsAEgA0IANwJ0IANCADcCfCADQQA2AoQBIANCADcCZCADQQE2AmAgA0IANwJsQf4BIQJBACEEA0AgAygClAIhCSADKAK0ASEGIAMoAmAhByADKALAASEKIAMoApABIQsgAygC8AEhDSADKAJkIQggAygCxAEhDCADKAKUASEFIAMoAvQBIRAgAygCaCEOIAMoAsgBIREgAygCmAE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AMgECA+cyIQIAwgPXMiDGs2AgQgAyACIA1zIgIgCiA/cyIKazYCACADIAkgK2o2ApQCIAMgFyAoajYCkAIgAyAlICdqNgKMAiADICIgJGo2AogCIAMgHyAhajYChAIgAyAcIB5qNgKAAiADIBEgE2o2AvgBIAMgDCAQajYC9AEgAyACIApqNgLwASADIBQgFmo2AvwBIAMgKiAvajYC5AEgAyAGIClqNgLgASADIBsgJmo2AtwBIAMgGSAjajYC2AEgAyAaICBqNgLUASADIBggHWo2AtABIAMgDyAVajYCzAEgAyAOIBJqNgLIASADIAUgCGo2AsQBIAMgByALajYCwAEgA0HgAGoiGyADQTBqIhogA0HwAWoiGRAGIANBwAFqIhcgFyADEAYgGiADEAUgAyAZEAUgAygCwAEhAiADKAJgIQkgAygCxAEhBiADKAJkIQcgAygCyAEhCiADKAJoIQsgAygCzAEhDSADKAJsIQggAygC0AEhDCADKAJwIQUgAygC1AEhECADKAJ0IQ4gAygC2AEhESADKAJ4IRIgAygC3AEhEyADKAJ8IQ8gAygC4AEhFCADKAKAASEVIAMgAygC5AEiFiADKAKEASIYajYCtAEgAyAUIBVqNgKwASADIA8gE2o2AqwBIAMgESASajYCqAEgAyAOIBBqNgKkASADIAUgDGo2AqABIAMgCCANajYCnAEgAyAKIAtqNgKYASADIAYgB2o2ApQBIAMgAiAJajYCkAEgAyAYIBZrNgLkASADIBUgFGs2AuABIAMgDyATazYC3AEgAyASIBFrNgLYASADIA4gEGs2AtQBIAMgBSAMazYC0AEgAyAIIA1rNgLMASADIAsgCms2AsgBIAMgByAGazYCxAEgAyAJIAJrNgLAASAZIAMgGhAGIAMoAjQhAiADKAIEIQUgAygCOCEJIAMoAgghECADKAJAIQYgAygCECEOIAMoAjwhByADKAIMIREgAygCSCEKIAMoAhghEiADKAJEIQsgAygCFCETIAMoAlAhDSADKAIgIQ8gAygCTCEIIAMoAhwhFCADKAJUIQwgAygCJCEVIAMgAygCACADKAIwIhZrIhg2AgAgAyAVIAxrIhU2AiQgAyAUIA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WPwrInsEXD9Iny75jw1d+sBdPGMzmxOAKIbVP8BccXanA9TdhPujwLdg0QZw8qIFP6LDnMxk7H/XeSrAN67P///////////////////////////////////////3/t////////////////////////////////////////f+7///////////////////////////////////////9/7dP1XBpjEljWnPei3vneFABBjxUL/PABEIU7jAG98ST/+CXDAWDcNwC3TD7/w0I9ADJMpAHhpEz/TD2j/3U+HwBRkUD/dkEOAKJz1v8Gii4AfOb0/wqKjwA0GsIAuPRMAIGPKQG+9BP/e6p6/2KBRAB51ZMAVmUe/6FnmwCMWUP/7+W+AUMLtQDG8In+7kW8/+pxPP8l/zn/RbK2/oDQswB2Gn3+AwfW//EyTf9Vy8X/04f6/xkwZP+71bT+EVhpAFPRngEFc2IABK48/qs3bv/ZtRH/FLyqAJKcZv5X1q7/cnqbAeksqgB/CO8B1uzqAK8F2wAxaj3/BkLQ/wJqbv9R6hP/12vA/0OX7gATKmz/5VVxATJEh/8RagkAMmcB/1ABqAEjmB7/EKi5AThZ6P9l0vwAKfpHAMyqT/8OLu//UE3vAL3WS/8RjfkAJlBM/75VdQBW5KoAnNjQAcPPpP+WQkz/r+EQ/41QYgFM2/IAxqJyAC7amACbK/H+m6Bo/7IJ/P5kbtQADgWnAOnvo/8cl50BZZIK//6eRv5H+eQAWB4yAEQ6oP+/GGgBgUKB/8AyVf8Is4r/JvrJAHNQoACD5nEAfViTAFpExwD9TJ4AHP92AHH6/gBCSy4A5torAOV4ugGURCsAiHzuAbtrxf9UNfb/M3T+/zO7pQACEa8AQlSgAfc6HgAjQTX+Rey/AC2G9QGje90AIG4U/zQXpQC61kcA6bBgAPLvNgE5WYoAUwBU/4igZABcjnj+aHy+ALWxPv/6KVUAmIIqAWD89gCXlz/+74U+ACA4nAAtp73/joWzAYNW0wC7s5b++qoO/0RxFf/eujv/QgfxAUUGSABWnGz+N6dZAG002/4NsBf/xCxq/++VR/+kjH3/n60BADMp5wCRPiEAim9dAblTRQCQcy4AYZcQ/xjkGgAx2eIAcUvq/sGZDP+2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nL7f+RfsL/3Sr9/xljlwBh/d8BSnMx/wavSP87sMsAfLf5AeTkYwCBDM/+qMDD/8ywEP6Y6qsATSVV/yF4h/+OwuMBH9Y6ANW7ff/oLjz/vnQq/peyE/8zPu3+zOzBAMLoPACsIp3/vRC4/mcDX/+N6ST+KRkL/xXDpgB29S0AQ9WV/58MEv+7pOMBoBkFAAxOwwErxeEAMI4p/sSbPP/fxxIBkYicAPx1qf6R4u4A7xdrAG21vP/mcDH+Sart/+e34/9Q3BQAwmt/AX/NZQAuNMUB0qsk/1gDWv84l40AYLv//ypOyAD+RkYB9H2oAMxEigF810YAZkLI/hE05AB13I/+y/h7ADgSrv+6l6T/M+jQAaDkK//5HRkBRL4/AA0AAAAA/wAAAAD1AAAAAAAA+wAAAAAAAP0AAAAA8wAAAAAHAAAAAAADAAAAAPMAAAAABQAAAAAAAAAACwAAAAAACwAAAADzAAAAAAAA/QAAAAAA/wAAAAADAAAAAPUAAAAAAAAADwAAAAAA/wAAAAD/AAAAAAcAAAAABQBBjIcCCwEBAEGwhwILAQEAQdCHAgugAeDrenw7QbiuFlbj+vGfxGraCY3rnDKx/YZiBRZfSbgAX5yVvKNQjCSx0LFVnIPvWwREXMRYHI6G2CJO3dCfEVfs////////////////////////////////////////f+3///////////////////////////////////////9/7v///////////////////////////////////////38AQZCJAgvBBQjJvPNn5glqO6fKhIWuZ7sr+JT+cvNuPPE2HV869U+l0YLmrX9SDlEfbD4rjGgFm2u9Qfur2YMfeSF+ExnN4FsirijXmC+KQs1l7yORRDdxLztN7M/7wLW824mBpdu16Ti1SPNbwlY5GdAFtvER8VmbTxmvpII/khiBbdrVXhyrQgIDo5iqB9i+b3BFAVuDEoyy5E6+hTEk4rT/1cN9DFVviXvydF2+crGWFjv+sd6ANRLHJacG3JuUJmnPdPGbwdJK8Z7BaZvk4yVPOIZHvu+11YyLxp3BD2WcrHfMoQwkdQIrWW8s6S2D5KZuqoR0StT7Qb3cqbBctVMRg9qI+Xar32buUlE+mBAytC1txjGoPyH7mMgnA7DkDu++x39Zv8KPqD3zC+DGJacKk0eRp9VvggPgUWPKBnBuDgpnKSkU/C/SRoUKtycmySZcOCEbLu0qxFr8bSxN37OVnRMNOFPeY6+LVHMKZaiydzy7Cmp25q7tRy7JwoE7NYIUhSxykmQD8Uyh6L+iATBCvEtmGqiRl/jQcItLwjC+VAajUWzHGFLv1hnoktEQqWVVJAaZ1iogcVeFNQ70uNG7MnCgahDI0NK4FsGkGVOrQVEIbDcemeuO30x3SCeoSJvhtbywNGNaycWzDBw5y4pB40qq2E5z42N3T8qcW6O4stbzby5o/LLvXe6Cj3RgLxdDb2OleHKr8KEUeMiE7DlkGggCx4woHmMj+v++kOm9gt7rbFCkFXnGsvej+b4rU3Lj8nhxxpxhJurOPifKB8LAIce4htEe6+DN1n3a6njRbu5/T331um8Xcqpn8AammMiixX1jCq4N+b4EmD8RG0ccEzULcRuEfQQj9XfbKJMkx0B7q8oyvL7JFQq+njxMDRCcxGcdQ7ZCPsu+1MVMKn5l/Jwpf1ns+tY6q2/LXxdYR0qMGURsgABB0I8CCyFTaWdFZDI1NTE5IG5vIEVkMjU1MTkgY29sbGlzaW9ucwEAQaCQAgs1cI0BAAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0=")||(K=_,_=i.locateFile?i.locateFile(K,r):r+K);var x={34904:()=>i.getRandomValue(),34940:()=>{if(void 0===i.getRandomValue)try{var A="object"==typeof window?window:self,I=void 0!==A.crypto?A.crypto:A.msCrypto,g=function(){var A=new Uint32Array(1);return I.getRandomValues(A),A[0]>>>0};g(),i.getRandomValue=g}catch(A){try{var C=__webpack_require__(/*! crypto */ "./node_modules/crypto-browserify/index.js"),B=function(){var A=C.randomBytes(4);return(A[0]<<24|A[1]<<16|A[2]<<8|A[3])>>>0};B(),i.getRandomValue=B}catch(A){throw"No secure random number generator found"}}}};function j(A){for(;A.length>0;)A.shift()(i)}var X=[];function q(A){var I=c.buffer;try{return c.grow(A-I.byteLength+65535>>>16),H(),1}catch(A){}}var z="function"==typeof atob?atob:function(A){var I,g,C,B,Q,i,E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="",a=0;A=A.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{I=E.indexOf(A.charAt(a++))<<2|(B=E.indexOf(A.charAt(a++)))>>4,g=(15&B)<<4|(Q=E.indexOf(A.charAt(a++)))>>2,C=(3&Q)<<6|(i=E.indexOf(A.charAt(a++))),o+=String.fromCharCode(I),64!==Q&&(o+=String.fromCharCode(g)),64!==i&&(o+=String.fromCharCode(C))}while(a>=2;g=w[A++];)I+=105!=g&I,X.push(105==g?s[I]:k[I++>>1]),++I;return X}(I,g);return x[A].apply(null,C)}(A,I,g)},d:function(A,I,g){w.copyWithin(A,I,I+g)},e:function(A){var I,g=w.length,C=2147483648;if((A>>>=0)>C)return!1;for(var B=1;B<=4;B*=2){var Q=g*(1+.2/B);if(Q=Math.min(Q,A+100663296),q(Math.min(C,(I=Math.max(A,Q))+(65536-I%65536)%65536)))return!0}return!1}};function W(){function A(){O||(O=!0,i.calledRun=!0,F||(j(G),i.onRuntimeInitialized&&i.onRuntimeInitialized(),function(){if(i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)A=i.postRun.shift(),U.unshift(A);var A;j(U)}()))}J>0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)A=i.preRun.shift(),M.unshift(A);var A;j(M)}(),J>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),A()}),1)):A()))}if(function(){var A={a:T};function I(A,I){var g=A.exports;i.asm=g,c=i.asm.f,H(),i.asm.ac,function(A){if(J--,i.monitorRunDependencies&&i.monitorRunDependencies(J),0==J&&(null!==N&&(clearInterval(N),N=null),Y)){var I=Y;Y=null,I()}}()}function g(A){I(A.instance)}function C(I){return function(){if(!e&&(o||a)){if("function"==typeof fetch&&!L(_))return fetch(_,{credentials:"same-origin"}).then((function(A){if(!A.ok)throw"failed to load wasm binary file at '"+_+"'";return A.arrayBuffer()})).catch((function(){return R(_)}));if(B)return new Promise((function(A,I){B(_,(function(I){A(new Uint8Array(I))}),I)}))}return Promise.resolve().then((function(){return R(_)}))}().then((function(I){return WebAssembly.instantiate(I,A)})).then((function(A){return A})).then(I,(function(A){y("failed to asynchronously prepare wasm: "+A),b(A)}))}if(J++,i.monitorRunDependencies&&i.monitorRunDependencies(J),i.instantiateWasm)try{return i.instantiateWasm(A,I)}catch(A){return y("Module.instantiateWasm callback failed with error: "+A),!1}e||"function"!=typeof WebAssembly.instantiateStreaming||d(_)||L(_)||n||"function"!=typeof fetch?C(g):fetch(_,{credentials:"same-origin"}).then((function(I){return WebAssembly.instantiateStreaming(I,A).then(g,(function(A){return y("wasm streaming compile failed: "+A),y("falling back to ArrayBuffer instantiation"),C(g)}))}))}(),i._crypto_aead_chacha20poly1305_encrypt_detached=function(){return(i._crypto_aead_chacha20poly1305_encrypt_detached=i.asm.g).apply(null,arguments)},i._crypto_aead_chacha20poly1305_encrypt=function(){return(i._crypto_aead_chacha20poly1305_encrypt=i.asm.h).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_encrypt_detached=function(){return(i._crypto_aead_chacha20poly1305_ietf_encrypt_detached=i.asm.i).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_encrypt=function(){return(i._crypto_aead_chacha20poly1305_ietf_encrypt=i.asm.j).apply(null,arguments)},i._crypto_aead_chacha20poly1305_decrypt_detached=function(){return(i._crypto_aead_chacha20poly1305_decrypt_detached=i.asm.k).apply(null,arguments)},i._crypto_aead_chacha20poly1305_decrypt=function(){return(i._crypto_aead_chacha20poly1305_decrypt=i.asm.l).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_decrypt_detached=function(){return(i._crypto_aead_chacha20poly1305_ietf_decrypt_detached=i.asm.m).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_decrypt=function(){return(i._crypto_aead_chacha20poly1305_ietf_decrypt=i.asm.n).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_keybytes=function(){return(i._crypto_aead_chacha20poly1305_ietf_keybytes=i.asm.o).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_npubbytes=function(){return(i._crypto_aead_chacha20poly1305_ietf_npubbytes=i.asm.p).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_nsecbytes=function(){return(i._crypto_aead_chacha20poly1305_ietf_nsecbytes=i.asm.q).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_abytes=function(){return(i._crypto_aead_chacha20poly1305_ietf_abytes=i.asm.r).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_messagebytes_max=function(){return(i._crypto_aead_chacha20poly1305_ietf_messagebytes_max=i.asm.s).apply(null,arguments)},i._crypto_aead_chacha20poly1305_ietf_keygen=function(){return(i._crypto_aead_chacha20poly1305_ietf_keygen=i.asm.t).apply(null,arguments)},i._crypto_aead_chacha20poly1305_keybytes=function(){return(i._crypto_aead_chacha20poly1305_keybytes=i.asm.u).apply(null,arguments)},i._crypto_aead_chacha20poly1305_npubbytes=function(){return(i._crypto_aead_chacha20poly1305_npubbytes=i.asm.v).apply(null,arguments)},i._crypto_aead_chacha20poly1305_nsecbytes=function(){return(i._crypto_aead_chacha20poly1305_nsecbytes=i.asm.w).apply(null,arguments)},i._crypto_aead_chacha20poly1305_abytes=function(){return(i._crypto_aead_chacha20poly1305_abytes=i.asm.x).apply(null,arguments)},i._crypto_aead_chacha20poly1305_messagebytes_max=function(){return(i._crypto_aead_chacha20poly1305_messagebytes_max=i.asm.y).apply(null,arguments)},i._crypto_aead_chacha20poly1305_keygen=function(){return(i._crypto_aead_chacha20poly1305_keygen=i.asm.z).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_encrypt_detached=function(){return(i._crypto_aead_xchacha20poly1305_ietf_encrypt_detached=i.asm.A).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_encrypt=function(){return(i._crypto_aead_xchacha20poly1305_ietf_encrypt=i.asm.B).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_decrypt_detached=function(){return(i._crypto_aead_xchacha20poly1305_ietf_decrypt_detached=i.asm.C).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_decrypt=function(){return(i._crypto_aead_xchacha20poly1305_ietf_decrypt=i.asm.D).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_keybytes=function(){return(i._crypto_aead_xchacha20poly1305_ietf_keybytes=i.asm.E).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_npubbytes=function(){return(i._crypto_aead_xchacha20poly1305_ietf_npubbytes=i.asm.F).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_nsecbytes=function(){return(i._crypto_aead_xchacha20poly1305_ietf_nsecbytes=i.asm.G).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_abytes=function(){return(i._crypto_aead_xchacha20poly1305_ietf_abytes=i.asm.H).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_messagebytes_max=function(){return(i._crypto_aead_xchacha20poly1305_ietf_messagebytes_max=i.asm.I).apply(null,arguments)},i._crypto_aead_xchacha20poly1305_ietf_keygen=function(){return(i._crypto_aead_xchacha20poly1305_ietf_keygen=i.asm.J).apply(null,arguments)},i._crypto_auth_bytes=function(){return(i._crypto_auth_bytes=i.asm.K).apply(null,arguments)},i._crypto_auth_keybytes=function(){return(i._crypto_auth_keybytes=i.asm.L).apply(null,arguments)},i._crypto_auth=function(){return(i._crypto_auth=i.asm.M).apply(null,arguments)},i._crypto_auth_verify=function(){return(i._crypto_auth_verify=i.asm.N).apply(null,arguments)},i._crypto_auth_keygen=function(){return(i._crypto_auth_keygen=i.asm.O).apply(null,arguments)},i._crypto_box_seedbytes=function(){return(i._crypto_box_seedbytes=i.asm.P).apply(null,arguments)},i._crypto_box_publickeybytes=function(){return(i._crypto_box_publickeybytes=i.asm.Q).apply(null,arguments)},i._crypto_box_secretkeybytes=function(){return(i._crypto_box_secretkeybytes=i.asm.R).apply(null,arguments)},i._crypto_box_beforenmbytes=function(){return(i._crypto_box_beforenmbytes=i.asm.S).apply(null,arguments)},i._crypto_box_noncebytes=function(){return(i._crypto_box_noncebytes=i.asm.T).apply(null,arguments)},i._crypto_box_macbytes=function(){return(i._crypto_box_macbytes=i.asm.U).apply(null,arguments)},i._crypto_box_messagebytes_max=function(){return(i._crypto_box_messagebytes_max=i.asm.V).apply(null,arguments)},i._crypto_box_seed_keypair=function(){return(i._crypto_box_seed_keypair=i.asm.W).apply(null,arguments)},i._crypto_box_keypair=function(){return(i._crypto_box_keypair=i.asm.X).apply(null,arguments)},i._crypto_box_beforenm=function(){return(i._crypto_box_beforenm=i.asm.Y).apply(null,arguments)},i._crypto_box_detached_afternm=function(){return(i._crypto_box_detached_afternm=i.asm.Z).apply(null,arguments)},i._crypto_box_detached=function(){return(i._crypto_box_detached=i.asm._).apply(null,arguments)},i._crypto_box_easy_afternm=function(){return(i._crypto_box_easy_afternm=i.asm.$).apply(null,arguments)},i._crypto_box_easy=function(){return(i._crypto_box_easy=i.asm.aa).apply(null,arguments)},i._crypto_box_open_detached_afternm=function(){return(i._crypto_box_open_detached_afternm=i.asm.ba).apply(null,arguments)},i._crypto_box_open_detached=function(){return(i._crypto_box_open_detached=i.asm.ca).apply(null,arguments)},i._crypto_box_open_easy_afternm=function(){return(i._crypto_box_open_easy_afternm=i.asm.da).apply(null,arguments)},i._crypto_box_open_easy=function(){return(i._crypto_box_open_easy=i.asm.ea).apply(null,arguments)},i._crypto_box_seal=function(){return(i._crypto_box_seal=i.asm.fa).apply(null,arguments)},i._crypto_box_seal_open=function(){return(i._crypto_box_seal_open=i.asm.ga).apply(null,arguments)},i._crypto_box_sealbytes=function(){return(i._crypto_box_sealbytes=i.asm.ha).apply(null,arguments)},i._crypto_generichash_bytes_min=function(){return(i._crypto_generichash_bytes_min=i.asm.ia).apply(null,arguments)},i._crypto_generichash_bytes_max=function(){return(i._crypto_generichash_bytes_max=i.asm.ja).apply(null,arguments)},i._crypto_generichash_bytes=function(){return(i._crypto_generichash_bytes=i.asm.ka).apply(null,arguments)},i._crypto_generichash_keybytes_min=function(){return(i._crypto_generichash_keybytes_min=i.asm.la).apply(null,arguments)},i._crypto_generichash_keybytes_max=function(){return(i._crypto_generichash_keybytes_max=i.asm.ma).apply(null,arguments)},i._crypto_generichash_keybytes=function(){return(i._crypto_generichash_keybytes=i.asm.na).apply(null,arguments)},i._crypto_generichash_statebytes=function(){return(i._crypto_generichash_statebytes=i.asm.oa).apply(null,arguments)},i._crypto_generichash=function(){return(i._crypto_generichash=i.asm.pa).apply(null,arguments)},i._crypto_generichash_init=function(){return(i._crypto_generichash_init=i.asm.qa).apply(null,arguments)},i._crypto_generichash_update=function(){return(i._crypto_generichash_update=i.asm.ra).apply(null,arguments)},i._crypto_generichash_final=function(){return(i._crypto_generichash_final=i.asm.sa).apply(null,arguments)},i._crypto_generichash_keygen=function(){return(i._crypto_generichash_keygen=i.asm.ta).apply(null,arguments)},i._crypto_hash_bytes=function(){return(i._crypto_hash_bytes=i.asm.ua).apply(null,arguments)},i._crypto_hash=function(){return(i._crypto_hash=i.asm.va).apply(null,arguments)},i._crypto_kdf_bytes_min=function(){return(i._crypto_kdf_bytes_min=i.asm.wa).apply(null,arguments)},i._crypto_kdf_bytes_max=function(){return(i._crypto_kdf_bytes_max=i.asm.xa).apply(null,arguments)},i._crypto_kdf_contextbytes=function(){return(i._crypto_kdf_contextbytes=i.asm.ya).apply(null,arguments)},i._crypto_kdf_keybytes=function(){return(i._crypto_kdf_keybytes=i.asm.za).apply(null,arguments)},i._crypto_kdf_derive_from_key=function(){return(i._crypto_kdf_derive_from_key=i.asm.Aa).apply(null,arguments)},i._crypto_kdf_keygen=function(){return(i._crypto_kdf_keygen=i.asm.Ba).apply(null,arguments)},i._crypto_kx_seed_keypair=function(){return(i._crypto_kx_seed_keypair=i.asm.Ca).apply(null,arguments)},i._crypto_kx_keypair=function(){return(i._crypto_kx_keypair=i.asm.Da).apply(null,arguments)},i._crypto_kx_client_session_keys=function(){return(i._crypto_kx_client_session_keys=i.asm.Ea).apply(null,arguments)},i._crypto_kx_server_session_keys=function(){return(i._crypto_kx_server_session_keys=i.asm.Fa).apply(null,arguments)},i._crypto_kx_publickeybytes=function(){return(i._crypto_kx_publickeybytes=i.asm.Ga).apply(null,arguments)},i._crypto_kx_secretkeybytes=function(){return(i._crypto_kx_secretkeybytes=i.asm.Ha).apply(null,arguments)},i._crypto_kx_seedbytes=function(){return(i._crypto_kx_seedbytes=i.asm.Ia).apply(null,arguments)},i._crypto_kx_sessionkeybytes=function(){return(i._crypto_kx_sessionkeybytes=i.asm.Ja).apply(null,arguments)},i._crypto_scalarmult_base=function(){return(i._crypto_scalarmult_base=i.asm.Ka).apply(null,arguments)},i._crypto_scalarmult=function(){return(i._crypto_scalarmult=i.asm.La).apply(null,arguments)},i._crypto_scalarmult_bytes=function(){return(i._crypto_scalarmult_bytes=i.asm.Ma).apply(null,arguments)},i._crypto_scalarmult_scalarbytes=function(){return(i._crypto_scalarmult_scalarbytes=i.asm.Na).apply(null,arguments)},i._crypto_secretbox_keybytes=function(){return(i._crypto_secretbox_keybytes=i.asm.Oa).apply(null,arguments)},i._crypto_secretbox_noncebytes=function(){return(i._crypto_secretbox_noncebytes=i.asm.Pa).apply(null,arguments)},i._crypto_secretbox_macbytes=function(){return(i._crypto_secretbox_macbytes=i.asm.Qa).apply(null,arguments)},i._crypto_secretbox_messagebytes_max=function(){return(i._crypto_secretbox_messagebytes_max=i.asm.Ra).apply(null,arguments)},i._crypto_secretbox_keygen=function(){return(i._crypto_secretbox_keygen=i.asm.Sa).apply(null,arguments)},i._crypto_secretbox_detached=function(){return(i._crypto_secretbox_detached=i.asm.Ta).apply(null,arguments)},i._crypto_secretbox_easy=function(){return(i._crypto_secretbox_easy=i.asm.Ua).apply(null,arguments)},i._crypto_secretbox_open_detached=function(){return(i._crypto_secretbox_open_detached=i.asm.Va).apply(null,arguments)},i._crypto_secretbox_open_easy=function(){return(i._crypto_secretbox_open_easy=i.asm.Wa).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_keygen=function(){return(i._crypto_secretstream_xchacha20poly1305_keygen=i.asm.Xa).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_init_push=function(){return(i._crypto_secretstream_xchacha20poly1305_init_push=i.asm.Ya).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_init_pull=function(){return(i._crypto_secretstream_xchacha20poly1305_init_pull=i.asm.Za).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_rekey=function(){return(i._crypto_secretstream_xchacha20poly1305_rekey=i.asm._a).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_push=function(){return(i._crypto_secretstream_xchacha20poly1305_push=i.asm.$a).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_pull=function(){return(i._crypto_secretstream_xchacha20poly1305_pull=i.asm.ab).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_statebytes=function(){return(i._crypto_secretstream_xchacha20poly1305_statebytes=i.asm.bb).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_abytes=function(){return(i._crypto_secretstream_xchacha20poly1305_abytes=i.asm.cb).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_headerbytes=function(){return(i._crypto_secretstream_xchacha20poly1305_headerbytes=i.asm.db).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_keybytes=function(){return(i._crypto_secretstream_xchacha20poly1305_keybytes=i.asm.eb).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_messagebytes_max=function(){return(i._crypto_secretstream_xchacha20poly1305_messagebytes_max=i.asm.fb).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_tag_message=function(){return(i._crypto_secretstream_xchacha20poly1305_tag_message=i.asm.gb).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_tag_push=function(){return(i._crypto_secretstream_xchacha20poly1305_tag_push=i.asm.hb).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_tag_rekey=function(){return(i._crypto_secretstream_xchacha20poly1305_tag_rekey=i.asm.ib).apply(null,arguments)},i._crypto_secretstream_xchacha20poly1305_tag_final=function(){return(i._crypto_secretstream_xchacha20poly1305_tag_final=i.asm.jb).apply(null,arguments)},i._crypto_shorthash_bytes=function(){return(i._crypto_shorthash_bytes=i.asm.kb).apply(null,arguments)},i._crypto_shorthash_keybytes=function(){return(i._crypto_shorthash_keybytes=i.asm.lb).apply(null,arguments)},i._crypto_shorthash=function(){return(i._crypto_shorthash=i.asm.mb).apply(null,arguments)},i._crypto_shorthash_keygen=function(){return(i._crypto_shorthash_keygen=i.asm.nb).apply(null,arguments)},i._crypto_sign_statebytes=function(){return(i._crypto_sign_statebytes=i.asm.ob).apply(null,arguments)},i._crypto_sign_bytes=function(){return(i._crypto_sign_bytes=i.asm.pb).apply(null,arguments)},i._crypto_sign_seedbytes=function(){return(i._crypto_sign_seedbytes=i.asm.qb).apply(null,arguments)},i._crypto_sign_publickeybytes=function(){return(i._crypto_sign_publickeybytes=i.asm.rb).apply(null,arguments)},i._crypto_sign_secretkeybytes=function(){return(i._crypto_sign_secretkeybytes=i.asm.sb).apply(null,arguments)},i._crypto_sign_messagebytes_max=function(){return(i._crypto_sign_messagebytes_max=i.asm.tb).apply(null,arguments)},i._crypto_sign_seed_keypair=function(){return(i._crypto_sign_seed_keypair=i.asm.ub).apply(null,arguments)},i._crypto_sign_keypair=function(){return(i._crypto_sign_keypair=i.asm.vb).apply(null,arguments)},i._crypto_sign=function(){return(i._crypto_sign=i.asm.wb).apply(null,arguments)},i._crypto_sign_open=function(){return(i._crypto_sign_open=i.asm.xb).apply(null,arguments)},i._crypto_sign_detached=function(){return(i._crypto_sign_detached=i.asm.yb).apply(null,arguments)},i._crypto_sign_verify_detached=function(){return(i._crypto_sign_verify_detached=i.asm.zb).apply(null,arguments)},i._crypto_sign_init=function(){return(i._crypto_sign_init=i.asm.Ab).apply(null,arguments)},i._crypto_sign_update=function(){return(i._crypto_sign_update=i.asm.Bb).apply(null,arguments)},i._crypto_sign_final_create=function(){return(i._crypto_sign_final_create=i.asm.Cb).apply(null,arguments)},i._crypto_sign_final_verify=function(){return(i._crypto_sign_final_verify=i.asm.Db).apply(null,arguments)},i._crypto_sign_ed25519_pk_to_curve25519=function(){return(i._crypto_sign_ed25519_pk_to_curve25519=i.asm.Eb).apply(null,arguments)},i._crypto_sign_ed25519_sk_to_curve25519=function(){return(i._crypto_sign_ed25519_sk_to_curve25519=i.asm.Fb).apply(null,arguments)},i._randombytes_random=function(){return(i._randombytes_random=i.asm.Gb).apply(null,arguments)},i._randombytes_stir=function(){return(i._randombytes_stir=i.asm.Hb).apply(null,arguments)},i._randombytes_uniform=function(){return(i._randombytes_uniform=i.asm.Ib).apply(null,arguments)},i._randombytes_buf=function(){return(i._randombytes_buf=i.asm.Jb).apply(null,arguments)},i._randombytes_buf_deterministic=function(){return(i._randombytes_buf_deterministic=i.asm.Kb).apply(null,arguments)},i._randombytes_seedbytes=function(){return(i._randombytes_seedbytes=i.asm.Lb).apply(null,arguments)},i._randombytes_close=function(){return(i._randombytes_close=i.asm.Mb).apply(null,arguments)},i._randombytes=function(){return(i._randombytes=i.asm.Nb).apply(null,arguments)},i._sodium_bin2hex=function(){return(i._sodium_bin2hex=i.asm.Ob).apply(null,arguments)},i._sodium_hex2bin=function(){return(i._sodium_hex2bin=i.asm.Pb).apply(null,arguments)},i._sodium_base64_encoded_len=function(){return(i._sodium_base64_encoded_len=i.asm.Qb).apply(null,arguments)},i._sodium_bin2base64=function(){return(i._sodium_bin2base64=i.asm.Rb).apply(null,arguments)},i._sodium_base642bin=function(){return(i._sodium_base642bin=i.asm.Sb).apply(null,arguments)},i._sodium_init=function(){return(i._sodium_init=i.asm.Tb).apply(null,arguments)},i._sodium_pad=function(){return(i._sodium_pad=i.asm.Ub).apply(null,arguments)},i._sodium_unpad=function(){return(i._sodium_unpad=i.asm.Vb).apply(null,arguments)},i._sodium_version_string=function(){return(i._sodium_version_string=i.asm.Wb).apply(null,arguments)},i._sodium_library_version_major=function(){return(i._sodium_library_version_major=i.asm.Xb).apply(null,arguments)},i._sodium_library_version_minor=function(){return(i._sodium_library_version_minor=i.asm.Yb).apply(null,arguments)},i._sodium_library_minimal=function(){return(i._sodium_library_minimal=i.asm.Zb).apply(null,arguments)},i._malloc=function(){return(i._malloc=i.asm._b).apply(null,arguments)},i._free=function(){return(i._free=i.asm.$b).apply(null,arguments)},i.UTF8ToString=S,i.setValue=function(A,I,g="i8"){switch(g.endsWith("*")&&(g="*"),g){case"i1":case"i8":D[A>>0]=I;break;case"i16":h[A>>1]=I;break;case"i32":s[A>>2]=I;break;case"i64":v=[I>>>0,(P=I,+Math.abs(P)>=1?P>0?(0|Math.min(+Math.floor(P/4294967296),4294967295))>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],s[A>>2]=v[0],s[A+4>>2]=v[1];break;case"float":u[A>>2]=I;break;case"double":k[A>>3]=I;break;case"*":p[A>>2]=I;break;default:b("invalid type for setValue: "+g)}},i.getValue=function(A,I="i8"){switch(I.endsWith("*")&&(I="*"),I){case"i1":case"i8":return D[A>>0];case"i16":return h[A>>1];case"i32":case"i64":return s[A>>2];case"float":return u[A>>2];case"double":return k[A>>3];case"*":return p[A>>2];default:b("invalid type for getValue: "+I)}return null},Y=function A(){O||W(),O||(Y=A)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();W()})).catch((function(){return C.useBackupModule()})),I} true?!(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (I), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):0}(this); + + +/***/ }), + +/***/ "./node_modules/lodash/lodash.js": +/*!***************************************!*\ + !*** ./node_modules/lodash/lodash.js ***! + \***************************************/ +/***/ (function(module, exports, __webpack_require__) { + +/* module decorator */ module = __webpack_require__.nmd(module); +var __WEBPACK_AMD_DEFINE_RESULT__;/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ +;(function() { + + /** Used as a safe reference for `undefined` in pre-ES5 environments. */ + var undefined; + + /** Used as the semantic version number. */ + var VERSION = '4.17.21'; + + /** Used as the size to enable large array optimizations. */ + var LARGE_ARRAY_SIZE = 200; + + /** Error message constants. */ + var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', + FUNC_ERROR_TEXT = 'Expected a function', + INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; + + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED = '__lodash_hash_undefined__'; + + /** Used as the maximum memoize cache size. */ + var MAX_MEMOIZE_SIZE = 500; + + /** Used as the internal argument placeholder. */ + var PLACEHOLDER = '__lodash_placeholder__'; + + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG = 1, + CLONE_FLAT_FLAG = 2, + CLONE_SYMBOLS_FLAG = 4; + + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + + /** Used to compose bitmasks for function metadata. */ + var WRAP_BIND_FLAG = 1, + WRAP_BIND_KEY_FLAG = 2, + WRAP_CURRY_BOUND_FLAG = 4, + WRAP_CURRY_FLAG = 8, + WRAP_CURRY_RIGHT_FLAG = 16, + WRAP_PARTIAL_FLAG = 32, + WRAP_PARTIAL_RIGHT_FLAG = 64, + WRAP_ARY_FLAG = 128, + WRAP_REARG_FLAG = 256, + WRAP_FLIP_FLAG = 512; + + /** Used as default options for `_.truncate`. */ + var DEFAULT_TRUNC_LENGTH = 30, + DEFAULT_TRUNC_OMISSION = '...'; + + /** Used to detect hot functions by number of calls within a span of milliseconds. */ + var HOT_COUNT = 800, + HOT_SPAN = 16; + + /** Used to indicate the type of lazy iteratees. */ + var LAZY_FILTER_FLAG = 1, + LAZY_MAP_FLAG = 2, + LAZY_WHILE_FLAG = 3; + + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + + /** Used as references for the maximum length and index of an array. */ + var MAX_ARRAY_LENGTH = 4294967295, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, + HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; + + /** Used to associate wrap methods with their bit flags. */ + var wrapFlags = [ + ['ary', WRAP_ARY_FLAG], + ['bind', WRAP_BIND_FLAG], + ['bindKey', WRAP_BIND_KEY_FLAG], + ['curry', WRAP_CURRY_FLAG], + ['curryRight', WRAP_CURRY_RIGHT_FLAG], + ['flip', WRAP_FLIP_FLAG], + ['partial', WRAP_PARTIAL_FLAG], + ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], + ['rearg', WRAP_REARG_FLAG] + ]; + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + asyncTag = '[object AsyncFunction]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + domExcTag = '[object DOMException]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + nullTag = '[object Null]', + objectTag = '[object Object]', + promiseTag = '[object Promise]', + proxyTag = '[object Proxy]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]', + undefinedTag = '[object Undefined]', + weakMapTag = '[object WeakMap]', + weakSetTag = '[object WeakSet]'; + + var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + + /** Used to match empty string literals in compiled template source. */ + var reEmptyStringLeading = /\b__p \+= '';/g, + reEmptyStringMiddle = /\b(__p \+=) '' \+/g, + reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; + + /** Used to match HTML entities and HTML characters. */ + var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, + reUnescapedHtml = /[&<>"']/g, + reHasEscapedHtml = RegExp(reEscapedHtml.source), + reHasUnescapedHtml = RegExp(reUnescapedHtml.source); + + /** Used to match template delimiters. */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; + + /** Used to match property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + + /** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, + reHasRegExpChar = RegExp(reRegExpChar.source); + + /** Used to match leading whitespace. */ + var reTrimStart = /^\s+/; + + /** Used to match a single whitespace character. */ + var reWhitespace = /\s/; + + /** Used to match wrap detail comments. */ + var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, + reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; + + /** Used to match words composed of alphanumeric characters. */ + var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; + + /** + * Used to validate the `validate` option in `_.template` variable. + * + * Forbids characters which could potentially change the meaning of the function argument definition: + * - "()," (modification of function parameters) + * - "=" (default value) + * - "[]{}" (destructuring of function parameters) + * - "/" (beginning of a comment) + * - whitespace + */ + var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** + * Used to match + * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). + */ + var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; + + /** Used to match `RegExp` flags from their coerced string values. */ + var reFlags = /\w*$/; + + /** Used to detect bad signed hexadecimal string values. */ + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + + /** Used to detect binary string values. */ + var reIsBinary = /^0b[01]+$/i; + + /** Used to detect host constructors (Safari). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used to detect octal string values. */ + var reIsOctal = /^0o[0-7]+$/i; + + /** Used to detect unsigned integer values. */ + var reIsUint = /^(?:0|[1-9]\d*)$/; + + /** Used to match Latin Unicode letters (excluding mathematical operators). */ + var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; + + /** Used to ensure capturing order of template delimiters. */ + var reNoMatch = /($^)/; + + /** Used to match unescaped characters in compiled string literals. */ + var reUnescapedString = /['\n\r\u2028\u2029\\]/g; + + /** Used to compose unicode character classes. */ + var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f', + reComboHalfMarksRange = '\\ufe20-\\ufe2f', + rsComboSymbolsRange = '\\u20d0-\\u20ff', + rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, + rsDingbatRange = '\\u2700-\\u27bf', + rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', + rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', + rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', + rsPunctuationRange = '\\u2000-\\u206f', + rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', + rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', + rsVarRange = '\\ufe0e\\ufe0f', + rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; + + /** Used to compose unicode capture groups. */ + var rsApos = "['\u2019]", + rsAstral = '[' + rsAstralRange + ']', + rsBreak = '[' + rsBreakRange + ']', + rsCombo = '[' + rsComboRange + ']', + rsDigits = '\\d+', + rsDingbat = '[' + rsDingbatRange + ']', + rsLower = '[' + rsLowerRange + ']', + rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsUpper = '[' + rsUpperRange + ']', + rsZWJ = '\\u200d'; + + /** Used to compose unicode regexes. */ + var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', + rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', + rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', + rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', + reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', + rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, + rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + + /** Used to match apostrophes. */ + var reApos = RegExp(rsApos, 'g'); + + /** + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). + */ + var reComboMark = RegExp(rsCombo, 'g'); + + /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ + var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + + /** Used to match complex or compound words. */ + var reUnicodeWord = RegExp([ + rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', + rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', + rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, + rsUpper + '+' + rsOptContrUpper, + rsOrdUpper, + rsOrdLower, + rsDigits, + rsEmoji + ].join('|'), 'g'); + + /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ + var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); + + /** Used to detect strings that need a more robust regexp to match words. */ + var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + + /** Used to assign default `context` object properties. */ + var contextProps = [ + 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', + 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', + 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', + 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', + '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' + ]; + + /** Used to make template sourceURLs easier to identify. */ + var templateCounter = -1; + + /** Used to identify `toStringTag` values of typed arrays. */ + var typedArrayTags = {}; + typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; + typedArrayTags[argsTag] = typedArrayTags[arrayTag] = + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; + + /** Used to identify `toStringTag` values supported by `_.clone`. */ + var cloneableTags = {}; + cloneableTags[argsTag] = cloneableTags[arrayTag] = + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[errorTag] = cloneableTags[funcTag] = + cloneableTags[weakMapTag] = false; + + /** Used to map Latin Unicode letters to basic Latin letters. */ + var deburredLetters = { + // Latin-1 Supplement block. + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss', + // Latin Extended-A block. + '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', + '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', + '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', + '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', + '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', + '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', + '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', + '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', + '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', + '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', + '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', + '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', + '\u0134': 'J', '\u0135': 'j', + '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', + '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', + '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', + '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', + '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', + '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', + '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', + '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', + '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', + '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', + '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', + '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', + '\u0163': 't', '\u0165': 't', '\u0167': 't', + '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', + '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', + '\u0174': 'W', '\u0175': 'w', + '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', + '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', + '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', + '\u0132': 'IJ', '\u0133': 'ij', + '\u0152': 'Oe', '\u0153': 'oe', + '\u0149': "'n", '\u017f': 's' + }; + + /** Used to map characters to HTML entities. */ + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + /** Used to map HTML entities to characters. */ + var htmlUnescapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'" + }; + + /** Used to escape characters for inclusion in compiled string literals. */ + var stringEscapes = { + '\\': '\\', + "'": "'", + '\n': 'n', + '\r': 'r', + '\u2028': 'u2028', + '\u2029': 'u2029' + }; + + /** Built-in method references without a dependency on `root`. */ + var freeParseFloat = parseFloat, + freeParseInt = parseInt; + + /** Detect free variable `global` from Node.js. */ + var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g; + + /** Detect free variable `self`. */ + var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + + /** Used as a reference to the global object. */ + var root = freeGlobal || freeSelf || Function('return this')(); + + /** Detect free variable `exports`. */ + var freeExports = true && exports && !exports.nodeType && exports; + + /** Detect free variable `module`. */ + var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; + + /** Detect the popular CommonJS extension `module.exports`. */ + var moduleExports = freeModule && freeModule.exports === freeExports; + + /** Detect free variable `process` from Node.js. */ + var freeProcess = moduleExports && freeGlobal.process; + + /** Used to access faster Node.js helpers. */ + var nodeUtil = (function() { + try { + // Use `util.types` for Node.js 10+. + var types = freeModule && freeModule.require && freeModule.require('util').types; + + if (types) { + return types; + } + + // Legacy `process.binding('util')` for Node.js < 10. + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} + }()); + + /* Node.js helper references. */ + var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, + nodeIsDate = nodeUtil && nodeUtil.isDate, + nodeIsMap = nodeUtil && nodeUtil.isMap, + nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, + nodeIsSet = nodeUtil && nodeUtil.isSet, + nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + + /*--------------------------------------------------------------------------*/ + + /** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ + function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); + } + + /** + * A specialized version of `baseAggregator` for arrays. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ + function arrayAggregator(array, setter, iteratee, accumulator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + var value = array[index]; + setter(accumulator, value, iteratee(value), array); + } + return accumulator; + } + + /** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ + function arrayEach(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; + } + + /** + * A specialized version of `_.forEachRight` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ + function arrayEachRight(array, iteratee) { + var length = array == null ? 0 : array.length; + + while (length--) { + if (iteratee(array[length], length, array) === false) { + break; + } + } + return array; + } + + /** + * A specialized version of `_.every` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + */ + function arrayEvery(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (!predicate(array[index], index, array)) { + return false; + } + } + return true; + } + + /** + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function arrayFilter(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + return result; + } + + /** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + function arrayIncludes(array, value) { + var length = array == null ? 0 : array.length; + return !!length && baseIndexOf(array, value, 0) > -1; + } + + /** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + function arrayIncludesWith(array, value, comparator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } + } + return false; + } + + /** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + + /** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ + function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; + } + + /** + * A specialized version of `_.reduce` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduce(array, iteratee, accumulator, initAccum) { + var index = -1, + length = array == null ? 0 : array.length; + + if (initAccum && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; + } + + /** + * A specialized version of `_.reduceRight` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the last element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduceRight(array, iteratee, accumulator, initAccum) { + var length = array == null ? 0 : array.length; + if (initAccum && length) { + accumulator = array[--length]; + } + while (length--) { + accumulator = iteratee(accumulator, array[length], length, array); + } + return accumulator; + } + + /** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ + function arraySome(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; + } + + /** + * Gets the size of an ASCII `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ + var asciiSize = baseProperty('length'); + + /** + * Converts an ASCII `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function asciiToArray(string) { + return string.split(''); + } + + /** + * Splits an ASCII `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ + function asciiWords(string) { + return string.match(reAsciiWord) || []; + } + + /** + * The base implementation of methods like `_.findKey` and `_.findLastKey`, + * without support for iteratee shorthands, which iterates over `collection` + * using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the found element or its key, else `undefined`. + */ + function baseFindKey(collection, predicate, eachFunc) { + var result; + eachFunc(collection, function(value, key, collection) { + if (predicate(value, key, collection)) { + result = key; + return false; + } + }); + return result; + } + + /** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOf(array, value, fromIndex) { + return value === value + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); + } + + /** + * This function is like `baseIndexOf` except that it accepts a comparator. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @param {Function} comparator The comparator invoked per element. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOfWith(array, value, fromIndex, comparator) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (comparator(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ + function baseIsNaN(value) { + return value !== value; + } + + /** + * The base implementation of `_.mean` and `_.meanBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the mean. + */ + function baseMean(array, iteratee) { + var length = array == null ? 0 : array.length; + return length ? (baseSum(array, iteratee) / length) : NAN; + } + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } + + /** + * The base implementation of `_.propertyOf` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. + */ + function basePropertyOf(object) { + return function(key) { + return object == null ? undefined : object[key]; + }; + } + + /** + * The base implementation of `_.reduce` and `_.reduceRight`, without support + * for iteratee shorthands, which iterates over `collection` using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} accumulator The initial value. + * @param {boolean} initAccum Specify using the first or last element of + * `collection` as the initial value. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the accumulated value. + */ + function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { + eachFunc(collection, function(value, index, collection) { + accumulator = initAccum + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); + }); + return accumulator; + } + + /** + * The base implementation of `_.sortBy` which uses `comparer` to define the + * sort order of `array` and replaces criteria objects with their corresponding + * values. + * + * @private + * @param {Array} array The array to sort. + * @param {Function} comparer The function to define sort order. + * @returns {Array} Returns `array`. + */ + function baseSortBy(array, comparer) { + var length = array.length; + + array.sort(comparer); + while (length--) { + array[length] = array[length].value; + } + return array; + } + + /** + * The base implementation of `_.sum` and `_.sumBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the sum. + */ + function baseSum(array, iteratee) { + var result, + index = -1, + length = array.length; + + while (++index < length) { + var current = iteratee(array[index]); + if (current !== undefined) { + result = result === undefined ? current : (result + current); + } + } + return result; + } + + /** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ + function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; + } + + /** + * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array + * of key-value pairs for `object` corresponding to the property names of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the key-value pairs. + */ + function baseToPairs(object, props) { + return arrayMap(props, function(key) { + return [key, object[key]]; + }); + } + + /** + * The base implementation of `_.trim`. + * + * @private + * @param {string} string The string to trim. + * @returns {string} Returns the trimmed string. + */ + function baseTrim(string) { + return string + ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') + : string; + } + + /** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ + function baseUnary(func) { + return function(value) { + return func(value); + }; + } + + /** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ + function baseValues(object, props) { + return arrayMap(props, function(key) { + return object[key]; + }); + } + + /** + * Checks if a `cache` value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function cacheHas(cache, key) { + return cache.has(key); + } + + /** + * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the first unmatched string symbol. + */ + function charsStartIndex(strSymbols, chrSymbols) { + var index = -1, + length = strSymbols.length; + + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; + } + + /** + * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the last unmatched string symbol. + */ + function charsEndIndex(strSymbols, chrSymbols) { + var index = strSymbols.length; + + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; + } + + /** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ + function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + ++result; + } + } + return result; + } + + /** + * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A + * letters to basic Latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ + var deburrLetter = basePropertyOf(deburredLetters); + + /** + * Used by `_.escape` to convert characters to HTML entities. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + var escapeHtmlChar = basePropertyOf(htmlEscapes); + + /** + * Used by `_.template` to escape characters for inclusion in compiled string literals. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + function escapeStringChar(chr) { + return '\\' + stringEscapes[chr]; + } + + /** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function getValue(object, key) { + return object == null ? undefined : object[key]; + } + + /** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ + function hasUnicode(string) { + return reHasUnicode.test(string); + } + + /** + * Checks if `string` contains a word composed of Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a word is found, else `false`. + */ + function hasUnicodeWord(string) { + return reHasUnicodeWord.test(string); + } + + /** + * Converts `iterator` to an array. + * + * @private + * @param {Object} iterator The iterator to convert. + * @returns {Array} Returns the converted array. + */ + function iteratorToArray(iterator) { + var data, + result = []; + + while (!(data = iterator.next()).done) { + result.push(data.value); + } + return result; + } + + /** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ + function mapToArray(map) { + var index = -1, + result = Array(map.size); + + map.forEach(function(value, key) { + result[++index] = [key, value]; + }); + return result; + } + + /** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ + function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; + } + + /** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ + function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value === placeholder || value === PLACEHOLDER) { + array[index] = PLACEHOLDER; + result[resIndex++] = index; + } + } + return result; + } + + /** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ + function setToArray(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = value; + }); + return result; + } + + /** + * Converts `set` to its value-value pairs. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the value-value pairs. + */ + function setToPairs(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = [value, value]; + }); + return result; + } + + /** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * A specialized version of `_.lastIndexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictLastIndexOf(array, value, fromIndex) { + var index = fromIndex + 1; + while (index--) { + if (array[index] === value) { + return index; + } + } + return index; + } + + /** + * Gets the number of symbols in `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the string size. + */ + function stringSize(string) { + return hasUnicode(string) + ? unicodeSize(string) + : asciiSize(string); + } + + /** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function stringToArray(string) { + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); + } + + /** + * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the last non-whitespace character. + */ + function trimmedEndIndex(string) { + var index = string.length; + + while (index-- && reWhitespace.test(string.charAt(index))) {} + return index; + } + + /** + * Used by `_.unescape` to convert HTML entities to characters. + * + * @private + * @param {string} chr The matched character to unescape. + * @returns {string} Returns the unescaped character. + */ + var unescapeHtmlChar = basePropertyOf(htmlUnescapes); + + /** + * Gets the size of a Unicode `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ + function unicodeSize(string) { + var result = reUnicode.lastIndex = 0; + while (reUnicode.test(string)) { + ++result; + } + return result; + } + + /** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function unicodeToArray(string) { + return string.match(reUnicode) || []; + } + + /** + * Splits a Unicode `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ + function unicodeWords(string) { + return string.match(reUnicodeWord) || []; + } + + /*--------------------------------------------------------------------------*/ + + /** + * Create a new pristine `lodash` function using the `context` object. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Util + * @param {Object} [context=root] The context object. + * @returns {Function} Returns a new `lodash` function. + * @example + * + * _.mixin({ 'foo': _.constant('foo') }); + * + * var lodash = _.runInContext(); + * lodash.mixin({ 'bar': lodash.constant('bar') }); + * + * _.isFunction(_.foo); + * // => true + * _.isFunction(_.bar); + * // => false + * + * lodash.isFunction(lodash.foo); + * // => false + * lodash.isFunction(lodash.bar); + * // => true + * + * // Create a suped-up `defer` in Node.js. + * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; + */ + var runInContext = (function runInContext(context) { + context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); + + /** Built-in constructor references. */ + var Array = context.Array, + Date = context.Date, + Error = context.Error, + Function = context.Function, + Math = context.Math, + Object = context.Object, + RegExp = context.RegExp, + String = context.String, + TypeError = context.TypeError; + + /** Used for built-in method references. */ + var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; + + /** Used to detect overreaching core-js shims. */ + var coreJsData = context['__core-js_shared__']; + + /** Used to resolve the decompiled source of functions. */ + var funcToString = funcProto.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to generate unique IDs. */ + var idCounter = 0; + + /** Used to detect methods masquerading as native. */ + var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; + }()); + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString = objectProto.toString; + + /** Used to infer the `Object` constructor. */ + var objectCtorString = funcToString.call(Object); + + /** Used to restore the original `_` reference in `_.noConflict`. */ + var oldDash = root._; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /** Built-in value references. */ + var Buffer = moduleExports ? context.Buffer : undefined, + Symbol = context.Symbol, + Uint8Array = context.Uint8Array, + allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, + getPrototype = overArg(Object.getPrototypeOf, Object), + objectCreate = Object.create, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + splice = arrayProto.splice, + spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, + symIterator = Symbol ? Symbol.iterator : undefined, + symToStringTag = Symbol ? Symbol.toStringTag : undefined; + + var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} + }()); + + /** Mocked built-ins. */ + var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, + ctxNow = Date && Date.now !== root.Date.now && Date.now, + ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeCeil = Math.ceil, + nativeFloor = Math.floor, + nativeGetSymbols = Object.getOwnPropertySymbols, + nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, + nativeIsFinite = context.isFinite, + nativeJoin = arrayProto.join, + nativeKeys = overArg(Object.keys, Object), + nativeMax = Math.max, + nativeMin = Math.min, + nativeNow = Date.now, + nativeParseInt = context.parseInt, + nativeRandom = Math.random, + nativeReverse = arrayProto.reverse; + + /* Built-in method references that are verified to be native. */ + var DataView = getNative(context, 'DataView'), + Map = getNative(context, 'Map'), + Promise = getNative(context, 'Promise'), + Set = getNative(context, 'Set'), + WeakMap = getNative(context, 'WeakMap'), + nativeCreate = getNative(Object, 'create'); + + /** Used to store function metadata. */ + var metaMap = WeakMap && new WeakMap; + + /** Used to lookup unminified function names. */ + var realNames = {}; + + /** Used to detect maps, sets, and weakmaps. */ + var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); + + /** Used to convert symbols to primitives and strings. */ + var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` object which wraps `value` to enable implicit method + * chain sequences. Methods that operate on and return arrays, collections, + * and functions can be chained together. Methods that retrieve a single value + * or may return a primitive value will automatically end the chain sequence + * and return the unwrapped value. Otherwise, the value must be unwrapped + * with `_#value`. + * + * Explicit chain sequences, which must be unwrapped with `_#value`, may be + * enabled using `_.chain`. + * + * The execution of chained methods is lazy, that is, it's deferred until + * `_#value` is implicitly or explicitly called. + * + * Lazy evaluation allows several methods to support shortcut fusion. + * Shortcut fusion is an optimization to merge iteratee calls; this avoids + * the creation of intermediate arrays and can greatly reduce the number of + * iteratee executions. Sections of a chain sequence qualify for shortcut + * fusion if the section is applied to an array and iteratees accept only + * one argument. The heuristic for whether a section qualifies for shortcut + * fusion is subject to change. + * + * Chaining is supported in custom builds as long as the `_#value` method is + * directly or indirectly included in the build. + * + * In addition to lodash methods, wrappers have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, + * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, + * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, + * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, + * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, + * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, + * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, + * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, + * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, + * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, + * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, + * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, + * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, + * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, + * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, + * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, + * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, + * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, + * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, + * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, + * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, + * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, + * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, + * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, + * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, + * `zipObject`, `zipObjectDeep`, and `zipWith` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, + * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, + * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, + * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, + * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, + * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, + * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, + * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, + * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, + * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, + * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, + * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, + * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, + * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, + * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, + * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, + * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, + * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, + * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, + * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, + * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, + * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, + * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, + * `upperFirst`, `value`, and `words` + * + * @name _ + * @constructor + * @category Seq + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var wrapped = _([1, 2, 3]); + * + * // Returns an unwrapped value. + * wrapped.reduce(_.add); + * // => 6 + * + * // Returns a wrapped value. + * var squares = wrapped.map(square); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ + function lodash(value) { + if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { + if (value instanceof LodashWrapper) { + return value; + } + if (hasOwnProperty.call(value, '__wrapped__')) { + return wrapperClone(value); + } + } + return new LodashWrapper(value); + } + + /** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} proto The object to inherit from. + * @returns {Object} Returns the new object. + */ + var baseCreate = (function() { + function object() {} + return function(proto) { + if (!isObject(proto)) { + return {}; + } + if (objectCreate) { + return objectCreate(proto); + } + object.prototype = proto; + var result = new object; + object.prototype = undefined; + return result; + }; + }()); + + /** + * The function whose prototype chain sequence wrappers inherit from. + * + * @private + */ + function baseLodash() { + // No operation performed. + } + + /** + * The base constructor for creating `lodash` wrapper objects. + * + * @private + * @param {*} value The value to wrap. + * @param {boolean} [chainAll] Enable explicit method chain sequences. + */ + function LodashWrapper(value, chainAll) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__chain__ = !!chainAll; + this.__index__ = 0; + this.__values__ = undefined; + } + + /** + * By default, the template delimiters used by lodash are like those in + * embedded Ruby (ERB) as well as ES2015 template strings. Change the + * following template settings to use alternative delimiters. + * + * @static + * @memberOf _ + * @type {Object} + */ + lodash.templateSettings = { + + /** + * Used to detect `data` property values to be HTML-escaped. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'escape': reEscape, + + /** + * Used to detect code to be evaluated. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'evaluate': reEvaluate, + + /** + * Used to detect `data` property values to inject. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'interpolate': reInterpolate, + + /** + * Used to reference the data object in the template text. + * + * @memberOf _.templateSettings + * @type {string} + */ + 'variable': '', + + /** + * Used to import variables into the compiled template. + * + * @memberOf _.templateSettings + * @type {Object} + */ + 'imports': { + + /** + * A reference to the `lodash` function. + * + * @memberOf _.templateSettings.imports + * @type {Function} + */ + '_': lodash + } + }; + + // Ensure wrappers are instances of `baseLodash`. + lodash.prototype = baseLodash.prototype; + lodash.prototype.constructor = lodash; + + LodashWrapper.prototype = baseCreate(baseLodash.prototype); + LodashWrapper.prototype.constructor = LodashWrapper; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. + * + * @private + * @constructor + * @param {*} value The value to wrap. + */ + function LazyWrapper(value) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__dir__ = 1; + this.__filtered__ = false; + this.__iteratees__ = []; + this.__takeCount__ = MAX_ARRAY_LENGTH; + this.__views__ = []; + } + + /** + * Creates a clone of the lazy wrapper object. + * + * @private + * @name clone + * @memberOf LazyWrapper + * @returns {Object} Returns the cloned `LazyWrapper` object. + */ + function lazyClone() { + var result = new LazyWrapper(this.__wrapped__); + result.__actions__ = copyArray(this.__actions__); + result.__dir__ = this.__dir__; + result.__filtered__ = this.__filtered__; + result.__iteratees__ = copyArray(this.__iteratees__); + result.__takeCount__ = this.__takeCount__; + result.__views__ = copyArray(this.__views__); + return result; + } + + /** + * Reverses the direction of lazy iteration. + * + * @private + * @name reverse + * @memberOf LazyWrapper + * @returns {Object} Returns the new reversed `LazyWrapper` object. + */ + function lazyReverse() { + if (this.__filtered__) { + var result = new LazyWrapper(this); + result.__dir__ = -1; + result.__filtered__ = true; + } else { + result = this.clone(); + result.__dir__ *= -1; + } + return result; + } + + /** + * Extracts the unwrapped value from its lazy wrapper. + * + * @private + * @name value + * @memberOf LazyWrapper + * @returns {*} Returns the unwrapped value. + */ + function lazyValue() { + var array = this.__wrapped__.value(), + dir = this.__dir__, + isArr = isArray(array), + isRight = dir < 0, + arrLength = isArr ? array.length : 0, + view = getView(0, arrLength, this.__views__), + start = view.start, + end = view.end, + length = end - start, + index = isRight ? end : (start - 1), + iteratees = this.__iteratees__, + iterLength = iteratees.length, + resIndex = 0, + takeCount = nativeMin(length, this.__takeCount__); + + if (!isArr || (!isRight && arrLength == length && takeCount == length)) { + return baseWrapperValue(array, this.__actions__); + } + var result = []; + + outer: + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; + } + } + } + result[resIndex++] = value; + } + return result; + } + + // Ensure `LazyWrapper` is an instance of `baseLodash`. + LazyWrapper.prototype = baseCreate(baseLodash.prototype); + LazyWrapper.prototype.constructor = LazyWrapper; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ + function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; + } + + /** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; + } + + /** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; + } + + /** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function hashHas(key) { + var data = this.__data__; + return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); + } + + /** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ + function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; + } + + // Add methods to `Hash`. + Hash.prototype.clear = hashClear; + Hash.prototype['delete'] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ + function listCacheClear() { + this.__data__ = []; + this.size = 0; + } + + /** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; + } + + /** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; + } + + /** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; + } + + /** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ + function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; + } + + // Add methods to `ListCache`. + ListCache.prototype.clear = listCacheClear; + ListCache.prototype['delete'] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ + function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; + } + + /** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; + } + + /** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function mapCacheGet(key) { + return getMapData(this, key).get(key); + } + + /** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function mapCacheHas(key) { + return getMapData(this, key).has(key); + } + + /** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ + function mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; + } + + // Add methods to `MapCache`. + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype['delete'] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + + /*------------------------------------------------------------------------*/ + + /** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ + function SetCache(values) { + var index = -1, + length = values == null ? 0 : values.length; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } + } + + /** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ + function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; + } + + /** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ + function setCacheHas(value) { + return this.__data__.has(value); + } + + // Add methods to `SetCache`. + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; + SetCache.prototype.has = setCacheHas; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; + } + + /** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ + function stackClear() { + this.__data__ = new ListCache; + this.size = 0; + } + + /** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function stackDelete(key) { + var data = this.__data__, + result = data['delete'](key); + + this.size = data.size; + return result; + } + + /** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function stackGet(key) { + return this.__data__.get(key); + } + + /** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function stackHas(key) { + return this.__data__.has(key); + } + + /** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ + function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; + } + + // Add methods to `Stack`. + Stack.prototype.clear = stackClear; + Stack.prototype['delete'] = stackDelete; + Stack.prototype.get = stackGet; + Stack.prototype.has = stackHas; + Stack.prototype.set = stackSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ + function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; + } + + /** + * A specialized version of `_.sample` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @returns {*} Returns the random element. + */ + function arraySample(array) { + var length = array.length; + return length ? array[baseRandom(0, length - 1)] : undefined; + } + + /** + * A specialized version of `_.sampleSize` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ + function arraySampleSize(array, n) { + return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); + } + + /** + * A specialized version of `_.shuffle` for arrays. + * + * @private + * @param {Array} array The array to shuffle. + * @returns {Array} Returns the new shuffled array. + */ + function arrayShuffle(array) { + return shuffleSelf(copyArray(array)); + } + + /** + * This function is like `assignValue` except that it doesn't assign + * `undefined` values. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function assignMergeValue(object, key, value) { + if ((value !== undefined && !eq(object[key], value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } + } + + /** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } + } + + /** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; + } + + /** + * Aggregates elements of `collection` on `accumulator` with keys transformed + * by `iteratee` and values set by `setter`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ + function baseAggregator(collection, setter, iteratee, accumulator) { + baseEach(collection, function(value, key, collection) { + setter(accumulator, value, iteratee(value), collection); + }); + return accumulator; + } + + /** + * The base implementation of `_.assign` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssign(object, source) { + return object && copyObject(source, keys(source), object); + } + + /** + * The base implementation of `_.assignIn` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssignIn(object, source) { + return object && copyObject(source, keysIn(source), object); + } + + /** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } + } + + /** + * The base implementation of `_.at` without support for individual paths. + * + * @private + * @param {Object} object The object to iterate over. + * @param {string[]} paths The property paths to pick. + * @returns {Array} Returns the picked elements. + */ + function baseAt(object, paths) { + var index = -1, + length = paths.length, + result = Array(length), + skip = object == null; + + while (++index < length) { + result[index] = skip ? undefined : get(object, paths[index]); + } + return result; + } + + /** + * The base implementation of `_.clamp` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + */ + function baseClamp(number, lower, upper) { + if (number === number) { + if (upper !== undefined) { + number = number <= upper ? number : upper; + } + if (lower !== undefined) { + number = number >= lower ? number : lower; + } + } + return number; + } + + /** + * The base implementation of `_.clone` and `_.cloneDeep` which tracks + * traversed objects. + * + * @private + * @param {*} value The value to clone. + * @param {boolean} bitmask The bitmask flags. + * 1 - Deep clone + * 2 - Flatten inherited properties + * 4 - Clone symbols + * @param {Function} [customizer] The function to customize cloning. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The parent object of `value`. + * @param {Object} [stack] Tracks traversed objects and their clone counterparts. + * @returns {*} Returns the cloned value. + */ + function baseClone(value, bitmask, customizer, key, object, stack) { + var result, + isDeep = bitmask & CLONE_DEEP_FLAG, + isFlat = bitmask & CLONE_FLAT_FLAG, + isFull = bitmask & CLONE_SYMBOLS_FLAG; + + if (customizer) { + result = object ? customizer(value, key, object, stack) : customizer(value); + } + if (result !== undefined) { + return result; + } + if (!isObject(value)) { + return value; + } + var isArr = isArray(value); + if (isArr) { + result = initCloneArray(value); + if (!isDeep) { + return copyArray(value, result); + } + } else { + var tag = getTag(value), + isFunc = tag == funcTag || tag == genTag; + + if (isBuffer(value)) { + return cloneBuffer(value, isDeep); + } + if (tag == objectTag || tag == argsTag || (isFunc && !object)) { + result = (isFlat || isFunc) ? {} : initCloneObject(value); + if (!isDeep) { + return isFlat + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); + } + } else { + if (!cloneableTags[tag]) { + return object ? value : {}; + } + result = initCloneByTag(value, tag, isDeep); + } + } + // Check for circular references and return its corresponding clone. + stack || (stack = new Stack); + var stacked = stack.get(value); + if (stacked) { + return stacked; + } + stack.set(value, result); + + if (isSet(value)) { + value.forEach(function(subValue) { + result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); + }); + } else if (isMap(value)) { + value.forEach(function(subValue, key) { + result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + } + + var keysFunc = isFull + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); + + var props = isArr ? undefined : keysFunc(value); + arrayEach(props || value, function(subValue, key) { + if (props) { + key = subValue; + subValue = value[key]; + } + // Recursively populate clone (susceptible to call stack limits). + assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + return result; + } + + /** + * The base implementation of `_.conforms` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property predicates to conform to. + * @returns {Function} Returns the new spec function. + */ + function baseConforms(source) { + var props = keys(source); + return function(object) { + return baseConformsTo(object, source, props); + }; + } + + /** + * The base implementation of `_.conformsTo` which accepts `props` to check. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + */ + function baseConformsTo(object, source, props) { + var length = props.length; + if (object == null) { + return !length; + } + object = Object(object); + while (length--) { + var key = props[length], + predicate = source[key], + value = object[key]; + + if ((value === undefined && !(key in object)) || !predicate(value)) { + return false; + } + } + return true; + } + + /** + * The base implementation of `_.delay` and `_.defer` which accepts `args` + * to provide to `func`. + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {Array} args The arguments to provide to `func`. + * @returns {number|Object} Returns the timer id or timeout object. + */ + function baseDelay(func, wait, args) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return setTimeout(function() { func.apply(undefined, args); }, wait); + } + + /** + * The base implementation of methods like `_.difference` without support + * for excluding multiple arrays or iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Array} values The values to exclude. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + */ + function baseDifference(array, values, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + isCommon = true, + length = array.length, + result = [], + valuesLength = values.length; + + if (!length) { + return result; + } + if (iteratee) { + values = arrayMap(values, baseUnary(iteratee)); + } + if (comparator) { + includes = arrayIncludesWith; + isCommon = false; + } + else if (values.length >= LARGE_ARRAY_SIZE) { + includes = cacheHas; + isCommon = false; + values = new SetCache(values); + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; + } + } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.forEach` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + var baseEach = createBaseEach(baseForOwn); + + /** + * The base implementation of `_.forEachRight` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + var baseEachRight = createBaseEach(baseForOwnRight, true); + + /** + * The base implementation of `_.every` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` + */ + function baseEvery(collection, predicate) { + var result = true; + baseEach(collection, function(value, index, collection) { + result = !!predicate(value, index, collection); + return result; + }); + return result; + } + + /** + * The base implementation of methods like `_.max` and `_.min` which accepts a + * `comparator` to determine the extremum value. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The iteratee invoked per iteration. + * @param {Function} comparator The comparator used to compare values. + * @returns {*} Returns the extremum value. + */ + function baseExtremum(array, iteratee, comparator) { + var index = -1, + length = array.length; + + while (++index < length) { + var value = array[index], + current = iteratee(value); + + if (current != null && (computed === undefined + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { + var computed = current, + result = value; + } + } + return result; + } + + /** + * The base implementation of `_.fill` without an iteratee call guard. + * + * @private + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + */ + function baseFill(array, value, start, end) { + var length = array.length; + + start = toInteger(start); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined || end > length) ? length : toInteger(end); + if (end < 0) { + end += length; + } + end = start > end ? 0 : toLength(end); + while (start < end) { + array[start++] = value; + } + return array; + } + + /** + * The base implementation of `_.filter` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function baseFilter(collection, predicate) { + var result = []; + baseEach(collection, function(value, index, collection) { + if (predicate(value, index, collection)) { + result.push(value); + } + }); + return result; + } + + /** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ + function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; + } + + /** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseFor = createBaseFor(); + + /** + * This function is like `baseFor` except that it iterates over properties + * in the opposite order. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseForRight = createBaseFor(true); + + /** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); + } + + /** + * The base implementation of `_.forOwnRight` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwnRight(object, iteratee) { + return object && baseForRight(object, iteratee, keys); + } + + /** + * The base implementation of `_.functions` which creates an array of + * `object` function property names filtered from `props`. + * + * @private + * @param {Object} object The object to inspect. + * @param {Array} props The property names to filter. + * @returns {Array} Returns the function names. + */ + function baseFunctions(object, props) { + return arrayFilter(props, function(key) { + return isFunction(object[key]); + }); + } + + /** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path) { + path = castPath(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return (index && index == length) ? object : undefined; + } + + /** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ + function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); + } + + /** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); + } + + /** + * The base implementation of `_.gt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + */ + function baseGt(value, other) { + return value > other; + } + + /** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + function baseHas(object, key) { + return object != null && hasOwnProperty.call(object, key); + } + + /** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + function baseHasIn(object, key) { + return object != null && key in Object(object); + } + + /** + * The base implementation of `_.inRange` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to check. + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + */ + function baseInRange(number, start, end) { + return number >= nativeMin(start, end) && number < nativeMax(start, end); + } + + /** + * The base implementation of methods like `_.intersection`, without support + * for iteratee shorthands, that accepts an array of arrays to inspect. + * + * @private + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of shared values. + */ + function baseIntersection(arrays, iteratee, comparator) { + var includes = comparator ? arrayIncludesWith : arrayIncludes, + length = arrays[0].length, + othLength = arrays.length, + othIndex = othLength, + caches = Array(othLength), + maxLength = Infinity, + result = []; + + while (othIndex--) { + var array = arrays[othIndex]; + if (othIndex && iteratee) { + array = arrayMap(array, baseUnary(iteratee)); + } + maxLength = nativeMin(array.length, maxLength); + caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) + ? new SetCache(othIndex && array) + : undefined; + } + array = arrays[0]; + + var index = -1, + seen = caches[0]; + + outer: + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) + )) { + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) + ) { + continue outer; + } + } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.invert` and `_.invertBy` which inverts + * `object` with values transformed by `iteratee` and set by `setter`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform values. + * @param {Object} accumulator The initial inverted object. + * @returns {Function} Returns `accumulator`. + */ + function baseInverter(object, setter, iteratee, accumulator) { + baseForOwn(object, function(value, key, object) { + setter(accumulator, iteratee(value), key, object); + }); + return accumulator; + } + + /** + * The base implementation of `_.invoke` without support for individual + * method arguments. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {Array} args The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + */ + function baseInvoke(object, path, args) { + path = castPath(path, object); + object = parent(object, path); + var func = object == null ? object : object[toKey(last(path))]; + return func == null ? undefined : apply(func, object, args); + } + + /** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ + function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; + } + + /** + * The base implementation of `_.isArrayBuffer` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + */ + function baseIsArrayBuffer(value) { + return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; + } + + /** + * The base implementation of `_.isDate` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + */ + function baseIsDate(value) { + return isObjectLike(value) && baseGetTag(value) == dateTag; + } + + /** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Function} [customizer] The function to customize comparisons. + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ + function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); + } + + /** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = objIsArr ? arrayTag : getTag(object), + othTag = othIsArr ? arrayTag : getTag(other); + + objTag = objTag == argsTag ? objectTag : objTag; + othTag = othTag == argsTag ? objectTag : othTag; + + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return (objIsArr || isTypedArray(object)) + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + + stack || (stack = new Stack); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack); + return equalObjects(object, other, bitmask, customizer, equalFunc, stack); + } + + /** + * The base implementation of `_.isMap` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + */ + function baseIsMap(value) { + return isObjectLike(value) && getTag(value) == mapTag; + } + + /** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ + function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var stack = new Stack; + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result === undefined + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { + return false; + } + } + } + return true; + } + + /** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ + function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); + } + + /** + * The base implementation of `_.isRegExp` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + */ + function baseIsRegExp(value) { + return isObjectLike(value) && baseGetTag(value) == regexpTag; + } + + /** + * The base implementation of `_.isSet` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + */ + function baseIsSet(value) { + return isObjectLike(value) && getTag(value) == setTag; + } + + /** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ + function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + } + + /** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ + function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; + } + if (value == null) { + return identity; + } + if (typeof value == 'object') { + return isArray(value) + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); + } + return property(value); + } + + /** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; + } + + /** + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function baseKeysIn(object) { + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; + + for (var key in object) { + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; + } + + /** + * The base implementation of `_.lt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. + */ + function baseLt(value, other) { + return value < other; + } + + /** + * The base implementation of `_.map` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; + } + + /** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; + } + + /** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path), srcValue); + } + return function(object) { + var objValue = get(object, path); + return (objValue === undefined && objValue === srcValue) + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + }; + } + + /** + * The base implementation of `_.merge` without support for multiple sources. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {number} srcIndex The index of `source`. + * @param {Function} [customizer] The function to customize merged values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ + function baseMerge(object, source, srcIndex, customizer, stack) { + if (object === source) { + return; + } + baseFor(source, function(srcValue, key) { + stack || (stack = new Stack); + if (isObject(srcValue)) { + baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); + } + else { + var newValue = customizer + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; + + if (newValue === undefined) { + newValue = srcValue; + } + assignMergeValue(object, key, newValue); + } + }, keysIn); + } + + /** + * A specialized version of `baseMerge` for arrays and objects which performs + * deep merges and tracks traversed objects enabling objects with circular + * references to be merged. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {string} key The key of the value to merge. + * @param {number} srcIndex The index of `source`. + * @param {Function} mergeFunc The function to merge values. + * @param {Function} [customizer] The function to customize assigned values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ + function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { + var objValue = safeGet(object, key), + srcValue = safeGet(source, key), + stacked = stack.get(srcValue); + + if (stacked) { + assignMergeValue(object, key, stacked); + return; + } + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; + + var isCommon = newValue === undefined; + + if (isCommon) { + var isArr = isArray(srcValue), + isBuff = !isArr && isBuffer(srcValue), + isTyped = !isArr && !isBuff && isTypedArray(srcValue); + + newValue = srcValue; + if (isArr || isBuff || isTyped) { + if (isArray(objValue)) { + newValue = objValue; + } + else if (isArrayLikeObject(objValue)) { + newValue = copyArray(objValue); + } + else if (isBuff) { + isCommon = false; + newValue = cloneBuffer(srcValue, true); + } + else if (isTyped) { + isCommon = false; + newValue = cloneTypedArray(srcValue, true); + } + else { + newValue = []; + } + } + else if (isPlainObject(srcValue) || isArguments(srcValue)) { + newValue = objValue; + if (isArguments(objValue)) { + newValue = toPlainObject(objValue); + } + else if (!isObject(objValue) || isFunction(objValue)) { + newValue = initCloneObject(srcValue); + } + } + else { + isCommon = false; + } + } + if (isCommon) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, newValue); + mergeFunc(newValue, srcValue, srcIndex, customizer, stack); + stack['delete'](srcValue); + } + assignMergeValue(object, key, newValue); + } + + /** + * The base implementation of `_.nth` which doesn't coerce arguments. + * + * @private + * @param {Array} array The array to query. + * @param {number} n The index of the element to return. + * @returns {*} Returns the nth element of `array`. + */ + function baseNth(array, n) { + var length = array.length; + if (!length) { + return; + } + n += n < 0 ? length : 0; + return isIndex(n, length) ? array[n] : undefined; + } + + /** + * The base implementation of `_.orderBy` without param guards. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {string[]} orders The sort orders of `iteratees`. + * @returns {Array} Returns the new sorted array. + */ + function baseOrderBy(collection, iteratees, orders) { + if (iteratees.length) { + iteratees = arrayMap(iteratees, function(iteratee) { + if (isArray(iteratee)) { + return function(value) { + return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); + } + } + return iteratee; + }); + } else { + iteratees = [identity]; + } + + var index = -1; + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + + var result = baseMap(collection, function(value, key, collection) { + var criteria = arrayMap(iteratees, function(iteratee) { + return iteratee(value); + }); + return { 'criteria': criteria, 'index': ++index, 'value': value }; + }); + + return baseSortBy(result, function(object, other) { + return compareMultiple(object, other, orders); + }); + } + + /** + * The base implementation of `_.pick` without support for individual + * property identifiers. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @returns {Object} Returns the new object. + */ + function basePick(object, paths) { + return basePickBy(object, paths, function(value, path) { + return hasIn(object, path); + }); + } + + /** + * The base implementation of `_.pickBy` without support for iteratee shorthands. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @param {Function} predicate The function invoked per property. + * @returns {Object} Returns the new object. + */ + function basePickBy(object, paths, predicate) { + var index = -1, + length = paths.length, + result = {}; + + while (++index < length) { + var path = paths[index], + value = baseGet(object, path); + + if (predicate(value, path)) { + baseSet(result, castPath(path, object), value); + } + } + return result; + } + + /** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function basePropertyDeep(path) { + return function(object) { + return baseGet(object, path); + }; + } + + /** + * The base implementation of `_.pullAllBy` without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + */ + function basePullAll(array, values, iteratee, comparator) { + var indexOf = comparator ? baseIndexOfWith : baseIndexOf, + index = -1, + length = values.length, + seen = array; + + if (array === values) { + values = copyArray(values); + } + if (iteratee) { + seen = arrayMap(array, baseUnary(iteratee)); + } + while (++index < length) { + var fromIndex = 0, + value = values[index], + computed = iteratee ? iteratee(value) : value; + + while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { + if (seen !== array) { + splice.call(seen, fromIndex, 1); + } + splice.call(array, fromIndex, 1); + } + } + return array; + } + + /** + * The base implementation of `_.pullAt` without support for individual + * indexes or capturing the removed elements. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns `array`. + */ + function basePullAt(array, indexes) { + var length = array ? indexes.length : 0, + lastIndex = length - 1; + + while (length--) { + var index = indexes[length]; + if (length == lastIndex || index !== previous) { + var previous = index; + if (isIndex(index)) { + splice.call(array, index, 1); + } else { + baseUnset(array, index); + } + } + } + return array; + } + + /** + * The base implementation of `_.random` without support for returning + * floating-point numbers. + * + * @private + * @param {number} lower The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the random number. + */ + function baseRandom(lower, upper) { + return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); + } + + /** + * The base implementation of `_.range` and `_.rangeRight` which doesn't + * coerce arguments. + * + * @private + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @param {number} step The value to increment or decrement by. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the range of numbers. + */ + function baseRange(start, end, step, fromRight) { + var index = -1, + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), + result = Array(length); + + while (length--) { + result[fromRight ? length : ++index] = start; + start += step; + } + return result; + } + + /** + * The base implementation of `_.repeat` which doesn't coerce arguments. + * + * @private + * @param {string} string The string to repeat. + * @param {number} n The number of times to repeat the string. + * @returns {string} Returns the repeated string. + */ + function baseRepeat(string, n) { + var result = ''; + if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + return result; + } + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = nativeFloor(n / 2); + if (n) { + string += string; + } + } while (n); + + return result; + } + + /** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ + function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); + } + + /** + * The base implementation of `_.sample`. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + */ + function baseSample(collection) { + return arraySample(values(collection)); + } + + /** + * The base implementation of `_.sampleSize` without param guards. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ + function baseSampleSize(collection, n) { + var array = values(collection); + return shuffleSelf(array, baseClamp(n, 0, array.length)); + } + + /** + * The base implementation of `_.set`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseSet(object, path, value, customizer) { + if (!isObject(object)) { + return object; + } + path = castPath(path, object); + + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = toKey(path[index]), + newValue = value; + + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : undefined; + if (newValue === undefined) { + newValue = isObject(objValue) + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); + } + } + assignValue(nested, key, newValue); + nested = nested[key]; + } + return object; + } + + /** + * The base implementation of `setData` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ + var baseSetData = !metaMap ? identity : function(func, data) { + metaMap.set(func, data); + return func; + }; + + /** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var baseSetToString = !defineProperty ? identity : function(func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); + }; + + /** + * The base implementation of `_.shuffle`. + * + * @private + * @param {Array|Object} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + */ + function baseShuffle(collection) { + return shuffleSelf(values(collection)); + } + + /** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; + } + + /** + * The base implementation of `_.some` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ + function baseSome(collection, predicate) { + var result; + + baseEach(collection, function(value, index, collection) { + result = predicate(value, index, collection); + return !result; + }); + return !!result; + } + + /** + * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which + * performs a binary search of `array` to determine the index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function baseSortedIndex(array, value, retHighest) { + var low = 0, + high = array == null ? low : array.length; + + if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + var mid = (low + high) >>> 1, + computed = array[mid]; + + if (computed !== null && !isSymbol(computed) && + (retHighest ? (computed <= value) : (computed < value))) { + low = mid + 1; + } else { + high = mid; + } + } + return high; + } + return baseSortedIndexBy(array, value, identity, retHighest); + } + + /** + * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` + * which invokes `iteratee` for `value` and each element of `array` to compute + * their sort ranking. The iteratee is invoked with one argument; (value). + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} iteratee The iteratee invoked per element. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function baseSortedIndexBy(array, value, iteratee, retHighest) { + var low = 0, + high = array == null ? 0 : array.length; + if (high === 0) { + return 0; + } + + value = iteratee(value); + var valIsNaN = value !== value, + valIsNull = value === null, + valIsSymbol = isSymbol(value), + valIsUndefined = value === undefined; + + while (low < high) { + var mid = nativeFloor((low + high) / 2), + computed = iteratee(array[mid]), + othIsDefined = computed !== undefined, + othIsNull = computed === null, + othIsReflexive = computed === computed, + othIsSymbol = isSymbol(computed); + + if (valIsNaN) { + var setLow = retHighest || othIsReflexive; + } else if (valIsUndefined) { + setLow = othIsReflexive && (retHighest || othIsDefined); + } else if (valIsNull) { + setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); + } else if (valIsSymbol) { + setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); + } else if (othIsNull || othIsSymbol) { + setLow = false; + } else { + setLow = retHighest ? (computed <= value) : (computed < value); + } + if (setLow) { + low = mid + 1; + } else { + high = mid; + } + } + return nativeMin(high, MAX_ARRAY_INDEX); + } + + /** + * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ + function baseSortedUniq(array, iteratee) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + if (!index || !eq(computed, seen)) { + var seen = computed; + result[resIndex++] = value === 0 ? 0 : value; + } + } + return result; + } + + /** + * The base implementation of `_.toNumber` which doesn't ensure correct + * conversions of binary, hexadecimal, or octal string values. + * + * @private + * @param {*} value The value to process. + * @returns {number} Returns the number. + */ + function baseToNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + return +value; + } + + /** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + /** + * The base implementation of `_.uniqBy` without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ + function baseUniq(array, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + length = array.length, + isCommon = true, + result = [], + seen = result; + + if (comparator) { + isCommon = false; + includes = arrayIncludesWith; + } + else if (length >= LARGE_ARRAY_SIZE) { + var set = iteratee ? null : createSet(array); + if (set) { + return setToArray(set); + } + isCommon = false; + includes = cacheHas; + seen = new SetCache; + } + else { + seen = iteratee ? [] : result; + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.unset`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The property path to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. + */ + function baseUnset(object, path) { + path = castPath(path, object); + object = parent(object, path); + return object == null || delete object[toKey(last(path))]; + } + + /** + * The base implementation of `_.update`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to update. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseUpdate(object, path, updater, customizer) { + return baseSet(object, path, updater(baseGet(object, path)), customizer); + } + + /** + * The base implementation of methods like `_.dropWhile` and `_.takeWhile` + * without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to query. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [isDrop] Specify dropping elements instead of taking them. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the slice of `array`. + */ + function baseWhile(array, predicate, isDrop, fromRight) { + var length = array.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length) && + predicate(array[index], index, array)) {} + + return isDrop + ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) + : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); + } + + /** + * The base implementation of `wrapperValue` which returns the result of + * performing a sequence of actions on the unwrapped `value`, where each + * successive action is supplied the return value of the previous. + * + * @private + * @param {*} value The unwrapped value. + * @param {Array} actions Actions to perform to resolve the unwrapped value. + * @returns {*} Returns the resolved value. + */ + function baseWrapperValue(value, actions) { + var result = value; + if (result instanceof LazyWrapper) { + result = result.value(); + } + return arrayReduce(actions, function(result, action) { + return action.func.apply(action.thisArg, arrayPush([result], action.args)); + }, result); + } + + /** + * The base implementation of methods like `_.xor`, without support for + * iteratee shorthands, that accepts an array of arrays to inspect. + * + * @private + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of values. + */ + function baseXor(arrays, iteratee, comparator) { + var length = arrays.length; + if (length < 2) { + return length ? baseUniq(arrays[0]) : []; + } + var index = -1, + result = Array(length); + + while (++index < length) { + var array = arrays[index], + othIndex = -1; + + while (++othIndex < length) { + if (othIndex != index) { + result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); + } + } + } + return baseUniq(baseFlatten(result, 1), iteratee, comparator); + } + + /** + * This base implementation of `_.zipObject` which assigns values using `assignFunc`. + * + * @private + * @param {Array} props The property identifiers. + * @param {Array} values The property values. + * @param {Function} assignFunc The function to assign values. + * @returns {Object} Returns the new object. + */ + function baseZipObject(props, values, assignFunc) { + var index = -1, + length = props.length, + valsLength = values.length, + result = {}; + + while (++index < length) { + var value = index < valsLength ? values[index] : undefined; + assignFunc(result, props[index], value); + } + return result; + } + + /** + * Casts `value` to an empty array if it's not an array like object. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array|Object} Returns the cast array-like object. + */ + function castArrayLikeObject(value) { + return isArrayLikeObject(value) ? value : []; + } + + /** + * Casts `value` to `identity` if it's not a function. + * + * @private + * @param {*} value The value to inspect. + * @returns {Function} Returns cast function. + */ + function castFunction(value) { + return typeof value == 'function' ? value : identity; + } + + /** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ + function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); + } + + /** + * A `baseRest` alias which can be replaced with `identity` by module + * replacement plugins. + * + * @private + * @type {Function} + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + var castRest = baseRest; + + /** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ + function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); + } + + /** + * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). + * + * @private + * @param {number|Object} id The timer id or timeout object of the timer to clear. + */ + var clearTimeout = ctxClearTimeout || function(id) { + return root.clearTimeout(id); + }; + + /** + * Creates a clone of `buffer`. + * + * @private + * @param {Buffer} buffer The buffer to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Buffer} Returns the cloned buffer. + */ + function cloneBuffer(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); + } + var length = buffer.length, + result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); + + buffer.copy(result); + return result; + } + + /** + * Creates a clone of `arrayBuffer`. + * + * @private + * @param {ArrayBuffer} arrayBuffer The array buffer to clone. + * @returns {ArrayBuffer} Returns the cloned array buffer. + */ + function cloneArrayBuffer(arrayBuffer) { + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array(result).set(new Uint8Array(arrayBuffer)); + return result; + } + + /** + * Creates a clone of `dataView`. + * + * @private + * @param {Object} dataView The data view to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned data view. + */ + function cloneDataView(dataView, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + } + + /** + * Creates a clone of `regexp`. + * + * @private + * @param {Object} regexp The regexp to clone. + * @returns {Object} Returns the cloned regexp. + */ + function cloneRegExp(regexp) { + var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); + result.lastIndex = regexp.lastIndex; + return result; + } + + /** + * Creates a clone of the `symbol` object. + * + * @private + * @param {Object} symbol The symbol object to clone. + * @returns {Object} Returns the cloned symbol object. + */ + function cloneSymbol(symbol) { + return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; + } + + /** + * Creates a clone of `typedArray`. + * + * @private + * @param {Object} typedArray The typed array to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned typed array. + */ + function cloneTypedArray(typedArray, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); + } + + /** + * Compares values to sort them in ascending order. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {number} Returns the sort order indicator for `value`. + */ + function compareAscending(value, other) { + if (value !== other) { + var valIsDefined = value !== undefined, + valIsNull = value === null, + valIsReflexive = value === value, + valIsSymbol = isSymbol(value); + + var othIsDefined = other !== undefined, + othIsNull = other === null, + othIsReflexive = other === other, + othIsSymbol = isSymbol(other); + + if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || + (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || + (valIsNull && othIsDefined && othIsReflexive) || + (!valIsDefined && othIsReflexive) || + !valIsReflexive) { + return 1; + } + if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || + (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || + (othIsNull && valIsDefined && valIsReflexive) || + (!othIsDefined && valIsReflexive) || + !othIsReflexive) { + return -1; + } + } + return 0; + } + + /** + * Used by `_.orderBy` to compare multiple properties of a value to another + * and stable sort them. + * + * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, + * specify an order of "desc" for descending or "asc" for ascending sort order + * of corresponding values. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {boolean[]|string[]} orders The order to sort by for each property. + * @returns {number} Returns the sort order indicator for `object`. + */ + function compareMultiple(object, other, orders) { + var index = -1, + objCriteria = object.criteria, + othCriteria = other.criteria, + length = objCriteria.length, + ordersLength = orders.length; + + while (++index < length) { + var result = compareAscending(objCriteria[index], othCriteria[index]); + if (result) { + if (index >= ordersLength) { + return result; + } + var order = orders[index]; + return result * (order == 'desc' ? -1 : 1); + } + } + // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications + // that causes it, under certain circumstances, to provide the same value for + // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 + // for more details. + // + // This also ensures a stable sort in V8 and other engines. + // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. + return object.index - other.index; + } + + /** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, + leftIndex = -1, + leftLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; + } + + /** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, + holdersLength = holders.length, + rightIndex = -1, + rightLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; + + while (++argsIndex < rangeLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + return result; + } + + /** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ + function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; + } + + /** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property identifiers to copy. + * @param {Object} [object={}] The object to copy properties to. + * @param {Function} [customizer] The function to customize copied values. + * @returns {Object} Returns `object`. + */ + function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : undefined; + + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } + } + return object; + } + + /** + * Copies own symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ + function copySymbols(source, object) { + return copyObject(source, getSymbols(source), object); + } + + /** + * Copies own and inherited symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ + function copySymbolsIn(source, object) { + return copyObject(source, getSymbolsIn(source), object); + } + + /** + * Creates a function like `_.groupBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} [initializer] The accumulator object initializer. + * @returns {Function} Returns the new aggregator function. + */ + function createAggregator(setter, initializer) { + return function(collection, iteratee) { + var func = isArray(collection) ? arrayAggregator : baseAggregator, + accumulator = initializer ? initializer() : {}; + + return func(collection, setter, getIteratee(iteratee, 2), accumulator); + }; + } + + /** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ + function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; + + customizer = (assigner.length > 3 && typeof customizer == 'function') + ? (length--, customizer) + : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); + } + + /** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { + return eachFunc(collection, iteratee); + } + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); + + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; + } + + /** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; + } + + /** + * Creates a function that wraps `func` to invoke it with the optional `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createBind(func, bitmask, thisArg) { + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; + } + + /** + * Creates a function like `_.lowerFirst`. + * + * @private + * @param {string} methodName The name of the `String` case method to use. + * @returns {Function} Returns the new case function. + */ + function createCaseFirst(methodName) { + return function(string) { + string = toString(string); + + var strSymbols = hasUnicode(string) + ? stringToArray(string) + : undefined; + + var chr = strSymbols + ? strSymbols[0] + : string.charAt(0); + + var trailing = strSymbols + ? castSlice(strSymbols, 1).join('') + : string.slice(1); + + return chr[methodName]() + trailing; + }; + } + + /** + * Creates a function like `_.camelCase`. + * + * @private + * @param {Function} callback The function to combine each word. + * @returns {Function} Returns the new compounder function. + */ + function createCompounder(callback) { + return function(string) { + return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); + }; + } + + /** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ + function createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; + } + + /** + * Creates a function that wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length, + placeholder = getHolder(wrapper); + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + if (length < arity) { + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; + } + + /** + * Creates a `_.find` or `_.findLast` function. + * + * @private + * @param {Function} findIndexFunc The function to find the collection index. + * @returns {Function} Returns the new find function. + */ + function createFind(findIndexFunc) { + return function(collection, predicate, fromIndex) { + var iterable = Object(collection); + if (!isArrayLike(collection)) { + var iteratee = getIteratee(predicate, 3); + collection = keys(collection); + predicate = function(key) { return iteratee(iterable[key], key, iterable); }; + } + var index = findIndexFunc(collection, predicate, fromIndex); + return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; + }; + } + + /** + * Creates a `_.flow` or `_.flowRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new flow function. + */ + function createFlow(fromRight) { + return flatRest(function(funcs) { + var length = funcs.length, + index = length, + prereq = LodashWrapper.prototype.thru; + + if (fromRight) { + funcs.reverse(); + } + while (index--) { + var func = funcs[index]; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (prereq && !wrapper && getFuncName(func) == 'wrapper') { + var wrapper = new LodashWrapper([], true); + } + } + index = wrapper ? index : length; + while (++index < length) { + func = funcs[index]; + + var funcName = getFuncName(func), + data = funcName == 'wrapper' ? getData(func) : undefined; + + if (data && isLaziable(data[0]) && + data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && + !data[4].length && data[9] == 1 + ) { + wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); + } else { + wrapper = (func.length == 1 && isLaziable(func)) + ? wrapper[funcName]() + : wrapper.thru(func); + } + } + return function() { + var args = arguments, + value = args[0]; + + if (wrapper && args.length == 1 && isArray(value)) { + return wrapper.plant(value).value(); + } + var index = 0, + result = length ? funcs[index].apply(this, args) : value; + + while (++index < length) { + result = funcs[index].call(this, result); + } + return result; + }; + }); + } + + /** + * Creates a function that wraps `func` to invoke it with optional `this` + * binding of `thisArg`, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & WRAP_ARY_FLAG, + isBind = bitmask & WRAP_BIND_FLAG, + isBindKey = bitmask & WRAP_BIND_KEY_FLAG, + isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), + isFlip = bitmask & WRAP_FLIP_FLAG, + Ctor = isBindKey ? undefined : createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length; + + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), + holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary < length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; + } + + /** + * Creates a function like `_.invertBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} toIteratee The function to resolve iteratees. + * @returns {Function} Returns the new inverter function. + */ + function createInverter(setter, toIteratee) { + return function(object, iteratee) { + return baseInverter(object, setter, toIteratee(iteratee), {}); + }; + } + + /** + * Creates a function that performs a mathematical operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @param {number} [defaultValue] The value used for `undefined` arguments. + * @returns {Function} Returns the new mathematical operation function. + */ + function createMathOperation(operator, defaultValue) { + return function(value, other) { + var result; + if (value === undefined && other === undefined) { + return defaultValue; + } + if (value !== undefined) { + result = value; + } + if (other !== undefined) { + if (result === undefined) { + return other; + } + if (typeof value == 'string' || typeof other == 'string') { + value = baseToString(value); + other = baseToString(other); + } else { + value = baseToNumber(value); + other = baseToNumber(other); + } + result = operator(value, other); + } + return result; + }; + } + + /** + * Creates a function like `_.over`. + * + * @private + * @param {Function} arrayFunc The function to iterate over iteratees. + * @returns {Function} Returns the new over function. + */ + function createOver(arrayFunc) { + return flatRest(function(iteratees) { + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + return baseRest(function(args) { + var thisArg = this; + return arrayFunc(iteratees, function(iteratee) { + return apply(iteratee, thisArg, args); + }); + }); + }); + } + + /** + * Creates the padding for `string` based on `length`. The `chars` string + * is truncated if the number of characters exceeds `length`. + * + * @private + * @param {number} length The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padding for `string`. + */ + function createPadding(length, chars) { + chars = chars === undefined ? ' ' : baseToString(chars); + + var charsLength = chars.length; + if (charsLength < 2) { + return charsLength ? baseRepeat(chars, length) : chars; + } + var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); + return hasUnicode(chars) + ? castSlice(stringToArray(result), 0, length).join('') + : result.slice(0, length); + } + + /** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. + * @returns {Function} Returns the new wrapped function. + */ + function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; + } + + /** + * Creates a `_.range` or `_.rangeRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new range function. + */ + function createRange(fromRight) { + return function(start, end, step) { + if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { + end = step = undefined; + } + // Ensure the sign of `-0` is preserved. + start = toFinite(start); + if (end === undefined) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); + return baseRange(start, end, step, fromRight); + }; + } + + /** + * Creates a function that performs a relational operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @returns {Function} Returns the new relational operation function. + */ + function createRelationalOperation(operator) { + return function(value, other) { + if (!(typeof value == 'string' && typeof other == 'string')) { + value = toNumber(value); + other = toNumber(other); + } + return operator(value, other); + }; + } + + /** + * Creates a function that wraps `func` to continue currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {Function} wrapFunc The function to create the `func` wrapper. + * @param {*} placeholder The placeholder value. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { + var isCurry = bitmask & WRAP_CURRY_FLAG, + newHolders = isCurry ? holders : undefined, + newHoldersRight = isCurry ? undefined : holders, + newPartials = isCurry ? partials : undefined, + newPartialsRight = isCurry ? undefined : partials; + + bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); + + if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { + bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); + } + var newData = [ + func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, + newHoldersRight, argPos, ary, arity + ]; + + var result = wrapFunc.apply(undefined, newData); + if (isLaziable(func)) { + setData(result, newData); + } + result.placeholder = placeholder; + return setWrapToString(result, func, bitmask); + } + + /** + * Creates a function like `_.round`. + * + * @private + * @param {string} methodName The name of the `Math` method to use when rounding. + * @returns {Function} Returns the new round function. + */ + function createRound(methodName) { + var func = Math[methodName]; + return function(number, precision) { + number = toNumber(number); + precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); + if (precision && nativeIsFinite(number)) { + // Shift with exponential notation to avoid floating-point issues. + // See [MDN](https://mdn.io/round#Examples) for more details. + var pair = (toString(number) + 'e').split('e'), + value = func(pair[0] + 'e' + (+pair[1] + precision)); + + pair = (toString(value) + 'e').split('e'); + return +(pair[0] + 'e' + (+pair[1] - precision)); + } + return func(number); + }; + } + + /** + * Creates a set object of `values`. + * + * @private + * @param {Array} values The values to add to the set. + * @returns {Object} Returns the new set. + */ + var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { + return new Set(values); + }; + + /** + * Creates a `_.toPairs` or `_.toPairsIn` function. + * + * @private + * @param {Function} keysFunc The function to get the keys of a given object. + * @returns {Function} Returns the new pairs function. + */ + function createToPairs(keysFunc) { + return function(object) { + var tag = getTag(object); + if (tag == mapTag) { + return mapToArray(object); + } + if (tag == setTag) { + return setToPairs(object); + } + return baseToPairs(object, keysFunc(object)); + }; + } + + /** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * 512 - `_.flip` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); + partials = holders = undefined; + } + ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); + arity = arity === undefined ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + + if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined; + } + var data = isBindKey ? undefined : getData(func); + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; + + if (data) { + mergeData(newData, data); + } + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] === undefined + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); + + if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { + bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == WRAP_BIND_FLAG) { + var result = createBind(func, bitmask, thisArg); + } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { + result = createCurry(func, bitmask, arity); + } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { + result = createPartial(func, bitmask, thisArg, partials); + } else { + result = createHybrid.apply(undefined, newData); + } + var setter = data ? baseSetData : setData; + return setWrapToString(setter(result, newData), func, bitmask); + } + + /** + * Used by `_.defaults` to customize its `_.assignIn` use to assign properties + * of source objects to the destination object for all destination properties + * that resolve to `undefined`. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to assign. + * @param {Object} object The parent object of `objValue`. + * @returns {*} Returns the value to assign. + */ + function customDefaultsAssignIn(objValue, srcValue, key, object) { + if (objValue === undefined || + (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { + return srcValue; + } + return objValue; + } + + /** + * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source + * objects into destination objects that are passed thru. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to merge. + * @param {Object} object The parent object of `objValue`. + * @param {Object} source The parent object of `srcValue`. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + * @returns {*} Returns the value to assign. + */ + function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { + if (isObject(objValue) && isObject(srcValue)) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, objValue); + baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); + stack['delete'](srcValue); + } + return objValue; + } + + /** + * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain + * objects. + * + * @private + * @param {*} value The value to inspect. + * @param {string} key The key of the property to inspect. + * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. + */ + function customOmitClone(value) { + return isPlainObject(value) ? undefined : value; + } + + /** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ + function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Check that cyclic values are equal. + var arrStacked = stack.get(array); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array; + } + var index = -1, + result = true, + seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; + + stack.set(array, other); + stack.set(other, array); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!( + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { + result = false; + break; + } + } + stack['delete'](array); + stack['delete'](other); + return result; + } + + /** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag: + if ((object.byteLength != other.byteLength) || + (object.byteOffset != other.byteOffset)) { + return false; + } + object = object.buffer; + other = other.buffer; + + case arrayBufferTag: + if ((object.byteLength != other.byteLength) || + !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); + + case errorTag: + return object.name == other.name && object.message == other.message; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == (other + ''); + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG; + convert || (convert = setToArray); + + if (object.size != other.size && !isPartial) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG; + + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + stack['delete'](object); + return result; + + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; + } + + /** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + objProps = getAllKeys(object), + objLength = objProps.length, + othProps = getAllKeys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + // Check that cyclic values are equal. + var objStacked = stack.get(object); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object; + } + var result = true; + stack.set(object, other); + stack.set(other, object); + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); + } + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { + result = false; + break; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + result = false; + } + } + stack['delete'](object); + stack['delete'](other); + return result; + } + + /** + * A specialized version of `baseRest` which flattens the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + function flatRest(func) { + return setToString(overRest(func, undefined, flatten), func + ''); + } + + /** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeys(object) { + return baseGetAllKeys(object, keys, getSymbols); + } + + /** + * Creates an array of own and inherited enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeysIn(object) { + return baseGetAllKeys(object, keysIn, getSymbolsIn); + } + + /** + * Gets metadata for `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {*} Returns the metadata for `func`. + */ + var getData = !metaMap ? noop : function(func) { + return metaMap.get(func); + }; + + /** + * Gets the name of `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {string} Returns the function name. + */ + function getFuncName(func) { + var result = (func.name + ''), + array = realNames[result], + length = hasOwnProperty.call(realNames, result) ? array.length : 0; + + while (length--) { + var data = array[length], + otherFunc = data.func; + if (otherFunc == null || otherFunc == func) { + return data.name; + } + } + return result; + } + + /** + * Gets the argument placeholder value for `func`. + * + * @private + * @param {Function} func The function to inspect. + * @returns {*} Returns the placeholder value. + */ + function getHolder(func) { + var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; + return object.placeholder; + } + + /** + * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, + * this function returns the custom method, otherwise it returns `baseIteratee`. + * If arguments are provided, the chosen function is invoked with them and + * its result is returned. + * + * @private + * @param {*} [value] The value to convert to an iteratee. + * @param {number} [arity] The arity of the created iteratee. + * @returns {Function} Returns the chosen function or its result. + */ + function getIteratee() { + var result = lodash.iteratee || iteratee; + result = result === iteratee ? baseIteratee : result; + return arguments.length ? result(arguments[0], arguments[1]) : result; + } + + /** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ + function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; + } + + /** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ + function getMatchData(object) { + var result = keys(object), + length = result.length; + + while (length--) { + var key = result[length], + value = object[key]; + + result[length] = [key, value, isStrictComparable(value)]; + } + return result; + } + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; + } + + /** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ + function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; + } + + /** + * Creates an array of the own enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbols = !nativeGetSymbols ? stubArray : function(object) { + if (object == null) { + return []; + } + object = Object(object); + return arrayFilter(nativeGetSymbols(object), function(symbol) { + return propertyIsEnumerable.call(object, symbol); + }); + }; + + /** + * Creates an array of the own and inherited enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { + var result = []; + while (object) { + arrayPush(result, getSymbols(object)); + object = getPrototype(object); + } + return result; + }; + + /** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + var getTag = baseGetTag; + + // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. + if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || + (Map && getTag(new Map) != mapTag) || + (Promise && getTag(Promise.resolve()) != promiseTag) || + (Set && getTag(new Set) != setTag) || + (WeakMap && getTag(new WeakMap) != weakMapTag)) { + getTag = function(value) { + var result = baseGetTag(value), + Ctor = result == objectTag ? value.constructor : undefined, + ctorString = Ctor ? toSource(Ctor) : ''; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: return dataViewTag; + case mapCtorString: return mapTag; + case promiseCtorString: return promiseTag; + case setCtorString: return setTag; + case weakMapCtorString: return weakMapTag; + } + } + return result; + }; + } + + /** + * Gets the view, applying any `transforms` to the `start` and `end` positions. + * + * @private + * @param {number} start The start of the view. + * @param {number} end The end of the view. + * @param {Array} transforms The transformations to apply to the view. + * @returns {Object} Returns an object containing the `start` and `end` + * positions of the view. + */ + function getView(start, end, transforms) { + var index = -1, + length = transforms.length; + + while (++index < length) { + var data = transforms[index], + size = data.size; + + switch (data.type) { + case 'drop': start += size; break; + case 'dropRight': end -= size; break; + case 'take': end = nativeMin(end, start + size); break; + case 'takeRight': start = nativeMax(start, end - size); break; + } + } + return { 'start': start, 'end': end }; + } + + /** + * Extracts wrapper details from the `source` body comment. + * + * @private + * @param {string} source The source to inspect. + * @returns {Array} Returns the wrapper details. + */ + function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; + } + + /** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ + function hasPath(object, path, hasFunc) { + path = castPath(path, object); + + var index = -1, + length = path.length, + result = false; + + while (++index < length) { + var key = toKey(path[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; + } + object = object[key]; + } + if (result || ++index != length) { + return result; + } + length = object == null ? 0 : object.length; + return !!length && isLength(length) && isIndex(key, length) && + (isArray(object) || isArguments(object)); + } + + /** + * Initializes an array clone. + * + * @private + * @param {Array} array The array to clone. + * @returns {Array} Returns the initialized clone. + */ + function initCloneArray(array) { + var length = array.length, + result = new array.constructor(length); + + // Add properties assigned by `RegExp#exec`. + if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { + result.index = array.index; + result.input = array.input; + } + return result; + } + + /** + * Initializes an object clone. + * + * @private + * @param {Object} object The object to clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneObject(object) { + return (typeof object.constructor == 'function' && !isPrototype(object)) + ? baseCreate(getPrototype(object)) + : {}; + } + + /** + * Initializes an object clone based on its `toStringTag`. + * + * **Note:** This function only supports cloning values with tags of + * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. + * + * @private + * @param {Object} object The object to clone. + * @param {string} tag The `toStringTag` of the object to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneByTag(object, tag, isDeep) { + var Ctor = object.constructor; + switch (tag) { + case arrayBufferTag: + return cloneArrayBuffer(object); + + case boolTag: + case dateTag: + return new Ctor(+object); + + case dataViewTag: + return cloneDataView(object, isDeep); + + case float32Tag: case float64Tag: + case int8Tag: case int16Tag: case int32Tag: + case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: + return cloneTypedArray(object, isDeep); + + case mapTag: + return new Ctor; + + case numberTag: + case stringTag: + return new Ctor(object); + + case regexpTag: + return cloneRegExp(object); + + case setTag: + return new Ctor; + + case symbolTag: + return cloneSymbol(object); + } + } + + /** + * Inserts wrapper `details` in a comment at the top of the `source` body. + * + * @private + * @param {string} source The source to modify. + * @returns {Array} details The details to insert. + * @returns {string} Returns the modified source. + */ + function insertWrapDetails(source, details) { + var length = details.length; + if (!length) { + return source; + } + var lastIndex = length - 1; + details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; + details = details.join(length > 2 ? ', ' : ' '); + return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); + } + + /** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ + function isFlattenable(value) { + return isArray(value) || isArguments(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); + } + + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); + } + + /** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ + function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; + } + + /** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ + function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); + } + + /** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ + function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); + } + + /** + * Checks if `func` has a lazy counterpart. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` has a lazy counterpart, + * else `false`. + */ + function isLaziable(func) { + var funcName = getFuncName(func), + other = lodash[funcName]; + + if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { + return false; + } + if (func === other) { + return true; + } + var data = getData(other); + return !!data && func === data[0]; + } + + /** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ + function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); + } + + /** + * Checks if `func` is capable of being masked. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `func` is maskable, else `false`. + */ + var isMaskable = coreJsData ? isFunction : stubFalse; + + /** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ + function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; + } + + /** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ + function isStrictComparable(value) { + return value === value && !isObject(value); + } + + /** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === srcValue && + (srcValue !== undefined || (key in Object(object))); + }; + } + + /** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ + function memoizeCapped(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; + } + + /** + * Merges the function metadata of `source` into `data`. + * + * Merging metadata reduces the number of wrappers used to invoke a function. + * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` + * may be applied regardless of execution order. Methods like `_.ary` and + * `_.rearg` modify function arguments, making the order in which they are + * executed important, preventing the merging of metadata. However, we make + * an exception for a safe combined case where curried functions have `_.ary` + * and or `_.rearg` applied. + * + * @private + * @param {Array} data The destination metadata. + * @param {Array} source The source metadata. + * @returns {Array} Returns `data`. + */ + function mergeData(data, source) { + var bitmask = data[1], + srcBitmask = source[1], + newBitmask = bitmask | srcBitmask, + isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); + + var isCombo = + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + + // Exit early if metadata can't be merged. + if (!(isCommon || isCombo)) { + return data; + } + // Use source `thisArg` if available. + if (srcBitmask & WRAP_BIND_FLAG) { + data[2] = source[2]; + // Set when currying a bound function. + newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; + } + // Compose partial arguments. + var value = source[3]; + if (value) { + var partials = data[3]; + data[3] = partials ? composeArgs(partials, value, source[4]) : value; + data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; + } + // Compose partial right arguments. + value = source[5]; + if (value) { + partials = data[5]; + data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; + data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; + } + // Use source `argPos` if available. + value = source[7]; + if (value) { + data[7] = value; + } + // Use source `ary` if it's smaller. + if (srcBitmask & WRAP_ARY_FLAG) { + data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); + } + // Use source `arity` if one is not provided. + if (data[9] == null) { + data[9] = source[9]; + } + // Use source `func` and merge bitmasks. + data[0] = source[0]; + data[1] = newBitmask; + + return data; + } + + /** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; + } + + /** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ + function objectToString(value) { + return nativeObjectToString.call(value); + } + + /** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ + function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; + } + + /** + * Gets the parent value at `path` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path to get the parent value of. + * @returns {*} Returns the parent value. + */ + function parent(object, path) { + return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); + } + + /** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ + function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = copyArray(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; + } + return array; + } + + /** + * Gets the value at `key`, unless `key` is "__proto__" or "constructor". + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function safeGet(object, key) { + if (key === 'constructor' && typeof object[key] === 'function') { + return; + } + + if (key == '__proto__') { + return; + } + + return object[key]; + } + + /** + * Sets metadata for `func`. + * + * **Note:** If this function becomes hot, i.e. is invoked a lot in a short + * period of time, it will trip its breaker and transition to an identity + * function to avoid garbage collection pauses in V8. See + * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) + * for more details. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ + var setData = shortOut(baseSetData); + + /** + * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @returns {number|Object} Returns the timer id or timeout object. + */ + var setTimeout = ctxSetTimeout || function(func, wait) { + return root.setTimeout(func, wait); + }; + + /** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var setToString = shortOut(baseSetToString); + + /** + * Sets the `toString` method of `wrapper` to mimic the source of `reference` + * with wrapper details in a comment at the top of the source body. + * + * @private + * @param {Function} wrapper The function to modify. + * @param {Function} reference The reference function. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Function} Returns `wrapper`. + */ + function setWrapToString(wrapper, reference, bitmask) { + var source = (reference + ''); + return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); + } + + /** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ + function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; + } + + /** + * A specialized version of `_.shuffle` which mutates and sets the size of `array`. + * + * @private + * @param {Array} array The array to shuffle. + * @param {number} [size=array.length] The size of `array`. + * @returns {Array} Returns `array`. + */ + function shuffleSelf(array, size) { + var index = -1, + length = array.length, + lastIndex = length - 1; + + size = size === undefined ? length : size; + while (++index < size) { + var rand = baseRandom(index, lastIndex), + value = array[rand]; + + array[rand] = array[index]; + array[index] = value; + } + array.length = size; + return array; + } + + /** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ + var stringToPath = memoizeCapped(function(string) { + var result = []; + if (string.charCodeAt(0) === 46 /* . */) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; + }); + + /** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ + function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + /** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; + } + + /** + * Updates wrapper `details` based on `bitmask` flags. + * + * @private + * @returns {Array} details The details to modify. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Array} Returns `details`. + */ + function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = '_.' + pair[0]; + if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); + } + + /** + * Creates a clone of `wrapper`. + * + * @private + * @param {Object} wrapper The wrapper to clone. + * @returns {Object} Returns the cloned wrapper. + */ + function wrapperClone(wrapper) { + if (wrapper instanceof LazyWrapper) { + return wrapper.clone(); + } + var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); + result.__actions__ = copyArray(wrapper.__actions__); + result.__index__ = wrapper.__index__; + result.__values__ = wrapper.__values__; + return result; + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array of elements split into groups the length of `size`. + * If `array` can't be split evenly, the final chunk will be the remaining + * elements. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to process. + * @param {number} [size=1] The length of each chunk + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the new array of chunks. + * @example + * + * _.chunk(['a', 'b', 'c', 'd'], 2); + * // => [['a', 'b'], ['c', 'd']] + * + * _.chunk(['a', 'b', 'c', 'd'], 3); + * // => [['a', 'b', 'c'], ['d']] + */ + function chunk(array, size, guard) { + if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { + size = 1; + } else { + size = nativeMax(toInteger(size), 0); + } + var length = array == null ? 0 : array.length; + if (!length || size < 1) { + return []; + } + var index = 0, + resIndex = 0, + result = Array(nativeCeil(length / size)); + + while (index < length) { + result[resIndex++] = baseSlice(array, index, (index += size)); + } + return result; + } + + /** + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are falsey. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to compact. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.compact([0, 1, false, 2, '', 3]); + * // => [1, 2, 3] + */ + function compact(array) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value) { + result[resIndex++] = value; + } + } + return result; + } + + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to concatenate. + * @param {...*} [values] The values to concatenate. + * @returns {Array} Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + function concat() { + var length = arguments.length; + if (!length) { + return []; + } + var args = Array(length - 1), + array = arguments[0], + index = length; + + while (index--) { + args[index - 1] = arguments[index]; + } + return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); + } + + /** + * Creates an array of `array` values not included in the other given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * **Note:** Unlike `_.pullAll`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.without, _.xor + * @example + * + * _.difference([2, 1], [2, 3]); + * // => [1] + */ + var difference = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; + }); + + /** + * This method is like `_.difference` except that it accepts `iteratee` which + * is invoked for each element of `array` and `values` to generate the criterion + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). + * + * **Note:** Unlike `_.pullAllBy`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2] + * + * // The `_.property` iteratee shorthand. + * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + var differenceBy = baseRest(function(array, values) { + var iteratee = last(values); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) + : []; + }); + + /** + * This method is like `_.difference` except that it accepts `comparator` + * which is invoked to compare elements of `array` to `values`. The order and + * references of result values are determined by the first array. The comparator + * is invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.pullAllWith`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + var differenceWith = baseRest(function(array, values) { + var comparator = last(values); + if (isArrayLikeObject(comparator)) { + comparator = undefined; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) + : []; + }); + + /** + * Creates a slice of `array` with `n` elements dropped from the beginning. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.drop([1, 2, 3]); + * // => [2, 3] + * + * _.drop([1, 2, 3], 2); + * // => [3] + * + * _.drop([1, 2, 3], 5); + * // => [] + * + * _.drop([1, 2, 3], 0); + * // => [1, 2, 3] + */ + function drop(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + return baseSlice(array, n < 0 ? 0 : n, length); + } + + /** + * Creates a slice of `array` with `n` elements dropped from the end. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRight([1, 2, 3]); + * // => [1, 2] + * + * _.dropRight([1, 2, 3], 2); + * // => [1] + * + * _.dropRight([1, 2, 3], 5); + * // => [] + * + * _.dropRight([1, 2, 3], 0); + * // => [1, 2, 3] + */ + function dropRight(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + n = length - n; + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` excluding elements dropped from the end. + * Elements are dropped until `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.dropRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney'] + * + * // The `_.matches` iteratee shorthand. + * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['barney', 'fred'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.dropRightWhile(users, ['active', false]); + * // => objects for ['barney'] + * + * // The `_.property` iteratee shorthand. + * _.dropRightWhile(users, 'active'); + * // => objects for ['barney', 'fred', 'pebbles'] + */ + function dropRightWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), true, true) + : []; + } + + /** + * Creates a slice of `array` excluding elements dropped from the beginning. + * Elements are dropped until `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.dropWhile(users, function(o) { return !o.active; }); + * // => objects for ['pebbles'] + * + * // The `_.matches` iteratee shorthand. + * _.dropWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.dropWhile(users, ['active', false]); + * // => objects for ['pebbles'] + * + * // The `_.property` iteratee shorthand. + * _.dropWhile(users, 'active'); + * // => objects for ['barney', 'fred', 'pebbles'] + */ + function dropWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), true) + : []; + } + + /** + * Fills elements of `array` with `value` from `start` up to, but not + * including, `end`. + * + * **Note:** This method mutates `array`. + * + * @static + * @memberOf _ + * @since 3.2.0 + * @category Array + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.fill(array, 'a'); + * console.log(array); + * // => ['a', 'a', 'a'] + * + * _.fill(Array(3), 2); + * // => [2, 2, 2] + * + * _.fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + */ + function fill(array, value, start, end) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); + } + + /** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(o) { return o.user == 'barney'; }); + * // => 0 + * + * // The `_.matches` iteratee shorthand. + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findIndex(users, ['active', false]); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.findIndex(users, 'active'); + * // => 2 + */ + function findIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, getIteratee(predicate, 3), index); + } + + /** + * This method is like `_.findIndex` except that it iterates over elements + * of `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); + * // => 2 + * + * // The `_.matches` iteratee shorthand. + * _.findLastIndex(users, { 'user': 'barney', 'active': true }); + * // => 0 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastIndex(users, ['active', false]); + * // => 2 + * + * // The `_.property` iteratee shorthand. + * _.findLastIndex(users, 'active'); + * // => 0 + */ + function findLastIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length - 1; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = fromIndex < 0 + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); + } + return baseFindIndex(array, getIteratee(predicate, 3), index, true); + } + + /** + * Flattens `array` a single level deep. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] + */ + function flatten(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, 1) : []; + } + + /** + * Recursively flattens `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] + */ + function flattenDeep(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, INFINITY) : []; + } + + /** + * Recursively flatten `array` up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Array + * @param {Array} array The array to flatten. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * var array = [1, [2, [3, [4]], 5]]; + * + * _.flattenDepth(array, 1); + * // => [1, 2, [3, [4]], 5] + * + * _.flattenDepth(array, 2); + * // => [1, 2, 3, [4], 5] + */ + function flattenDepth(array, depth) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(array, depth); + } + + /** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} pairs The key-value pairs. + * @returns {Object} Returns the new object. + * @example + * + * _.fromPairs([['a', 1], ['b', 2]]); + * // => { 'a': 1, 'b': 2 } + */ + function fromPairs(pairs) { + var index = -1, + length = pairs == null ? 0 : pairs.length, + result = {}; + + while (++index < length) { + var pair = pairs[index]; + result[pair[0]] = pair[1]; + } + return result; + } + + /** + * Gets the first element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias first + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the first element of `array`. + * @example + * + * _.head([1, 2, 3]); + * // => 1 + * + * _.head([]); + * // => undefined + */ + function head(array) { + return (array && array.length) ? array[0] : undefined; + } + + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the + * offset from the end of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // Search from the `fromIndex`. + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + function indexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseIndexOf(array, value, index); + } + + /** + * Gets all but the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.initial([1, 2, 3]); + * // => [1, 2] + */ + function initial(array) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 0, -1) : []; + } + + /** + * Creates an array of unique values that are included in all given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * _.intersection([2, 1], [2, 3]); + * // => [2] + */ + var intersection = baseRest(function(arrays) { + var mapped = arrayMap(arrays, castArrayLikeObject); + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped) + : []; + }); + + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [2.1] + * + * // The `_.property` iteratee shorthand. + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + var intersectionBy = baseRest(function(arrays) { + var iteratee = last(arrays), + mapped = arrayMap(arrays, castArrayLikeObject); + + if (iteratee === last(mapped)) { + iteratee = undefined; + } else { + mapped.pop(); + } + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped, getIteratee(iteratee, 2)) + : []; + }); + + /** + * This method is like `_.intersection` except that it accepts `comparator` + * which is invoked to compare elements of `arrays`. The order and references + * of result values are determined by the first array. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + var intersectionWith = baseRest(function(arrays) { + var comparator = last(arrays), + mapped = arrayMap(arrays, castArrayLikeObject); + + comparator = typeof comparator == 'function' ? comparator : undefined; + if (comparator) { + mapped.pop(); + } + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped, undefined, comparator) + : []; + }); + + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to convert. + * @param {string} [separator=','] The element separator. + * @returns {string} Returns the joined string. + * @example + * + * _.join(['a', 'b', 'c'], '~'); + * // => 'a~b~c' + */ + function join(array, separator) { + return array == null ? '' : nativeJoin.call(array, separator); + } + + /** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ + function last(array) { + var length = array == null ? 0 : array.length; + return length ? array[length - 1] : undefined; + } + + /** + * This method is like `_.indexOf` except that it iterates over elements of + * `array` from right to left. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * // Search from the `fromIndex`. + * _.lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + */ + function lastIndexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); + } + return value === value + ? strictLastIndexOf(array, value, index) + : baseFindIndex(array, baseIsNaN, index, true); + } + + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth + * element from the end is returned. + * + * @static + * @memberOf _ + * @since 4.11.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=0] The index of the element to return. + * @returns {*} Returns the nth element of `array`. + * @example + * + * var array = ['a', 'b', 'c', 'd']; + * + * _.nth(array, 1); + * // => 'b' + * + * _.nth(array, -2); + * // => 'c'; + */ + function nth(array, n) { + return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; + } + + /** + * Removes all given values from `array` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` + * to remove elements from an array by predicate. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {...*} [values] The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * + * _.pull(array, 'a', 'c'); + * console.log(array); + * // => ['b', 'b'] + */ + var pull = baseRest(pullAll); + + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * + * _.pullAll(array, ['a', 'c']); + * console.log(array); + * // => ['b', 'b'] + */ + function pullAll(array, values) { + return (array && array.length && values && values.length) + ? basePullAll(array, values) + : array; + } + + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to generate the criterion + * by which they're compared. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + function pullAllBy(array, values, iteratee) { + return (array && array.length && values && values.length) + ? basePullAll(array, values, getIteratee(iteratee, 2)) + : array; + } + + /** + * This method is like `_.pullAll` except that it accepts `comparator` which + * is invoked to compare elements of `array` to `values`. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + function pullAllWith(array, values, comparator) { + return (array && array.length && values && values.length) + ? basePullAll(array, values, undefined, comparator) + : array; + } + + /** + * Removes elements from `array` corresponding to `indexes` and returns an + * array of removed elements. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {...(number|number[])} [indexes] The indexes of elements to remove. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = ['a', 'b', 'c', 'd']; + * var pulled = _.pullAt(array, [1, 3]); + * + * console.log(array); + * // => ['a', 'c'] + * + * console.log(pulled); + * // => ['b', 'd'] + */ + var pullAt = flatRest(function(array, indexes) { + var length = array == null ? 0 : array.length, + result = baseAt(array, indexes); + + basePullAt(array, arrayMap(indexes, function(index) { + return isIndex(index, length) ? +index : index; + }).sort(compareAscending)); + + return result; + }); + + /** + * Removes all elements from `array` that `predicate` returns truthy for + * and returns an array of the removed elements. The predicate is invoked + * with three arguments: (value, index, array). + * + * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` + * to pull elements from an array by value. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [1, 2, 3, 4]; + * var evens = _.remove(array, function(n) { + * return n % 2 == 0; + * }); + * + * console.log(array); + * // => [1, 3] + * + * console.log(evens); + * // => [2, 4] + */ + function remove(array, predicate) { + var result = []; + if (!(array && array.length)) { + return result; + } + var index = -1, + indexes = [], + length = array.length; + + predicate = getIteratee(predicate, 3); + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result.push(value); + indexes.push(index); + } + } + basePullAt(array, indexes); + return result; + } + + /** + * Reverses `array` so that the first element becomes the last, the second + * element becomes the second to last, and so on. + * + * **Note:** This method mutates `array` and is based on + * [`Array#reverse`](https://mdn.io/Array/reverse). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.reverse(array); + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function reverse(array) { + return array == null ? array : nativeReverse.call(array); + } + + /** + * Creates a slice of `array` from `start` up to, but not including, `end`. + * + * **Note:** This method is used instead of + * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are + * returned. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function slice(array, start, end) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + else { + start = start == null ? 0 : toInteger(start); + end = end === undefined ? length : toInteger(end); + } + return baseSlice(array, start, end); + } + + /** + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + */ + function sortedIndex(array, value) { + return baseSortedIndex(array, value); + } + + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * + * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); + * // => 0 + */ + function sortedIndexBy(array, value, iteratee) { + return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); + } + + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([4, 5, 5, 5, 6], 5); + * // => 1 + */ + function sortedIndexOf(array, value) { + var length = array == null ? 0 : array.length; + if (length) { + var index = baseSortedIndex(array, value); + if (index < length && eq(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedLastIndex([4, 5, 5, 5, 6], 5); + * // => 4 + */ + function sortedLastIndex(array, value) { + return baseSortedIndex(array, value, true); + } + + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * + * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 1 + * + * // The `_.property` iteratee shorthand. + * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); + * // => 1 + */ + function sortedLastIndexBy(array, value, iteratee) { + return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); + } + + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); + * // => 3 + */ + function sortedLastIndexOf(array, value) { + var length = array == null ? 0 : array.length; + if (length) { + var index = baseSortedIndex(array, value, true) - 1; + if (eq(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * This method is like `_.uniq` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniq([1, 1, 2]); + * // => [1, 2] + */ + function sortedUniq(array) { + return (array && array.length) + ? baseSortedUniq(array) + : []; + } + + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.3] + */ + function sortedUniqBy(array, iteratee) { + return (array && array.length) + ? baseSortedUniq(array, getIteratee(iteratee, 2)) + : []; + } + + /** + * Gets all but the first element of `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.tail([1, 2, 3]); + * // => [2, 3] + */ + function tail(array) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 1, length) : []; + } + + /** + * Creates a slice of `array` with `n` elements taken from the beginning. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.take([1, 2, 3]); + * // => [1] + * + * _.take([1, 2, 3], 2); + * // => [1, 2] + * + * _.take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.take([1, 2, 3], 0); + * // => [] + */ + function take(array, n, guard) { + if (!(array && array.length)) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` with `n` elements taken from the end. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRight([1, 2, 3]); + * // => [3] + * + * _.takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * _.takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.takeRight([1, 2, 3], 0); + * // => [] + */ + function takeRight(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + n = length - n; + return baseSlice(array, n < 0 ? 0 : n, length); + } + + /** + * Creates a slice of `array` with elements taken from the end. Elements are + * taken until `predicate` returns falsey. The predicate is invoked with + * three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.takeRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.matches` iteratee shorthand. + * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['pebbles'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.takeRightWhile(users, ['active', false]); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.property` iteratee shorthand. + * _.takeRightWhile(users, 'active'); + * // => [] + */ + function takeRightWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), false, true) + : []; + } + + /** + * Creates a slice of `array` with elements taken from the beginning. Elements + * are taken until `predicate` returns falsey. The predicate is invoked with + * three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.takeWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney', 'fred'] + * + * // The `_.matches` iteratee shorthand. + * _.takeWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.takeWhile(users, ['active', false]); + * // => objects for ['barney', 'fred'] + * + * // The `_.property` iteratee shorthand. + * _.takeWhile(users, 'active'); + * // => [] + */ + function takeWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3)) + : []; + } + + /** + * Creates an array of unique values, in order, from all given arrays using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.union([2], [1, 2]); + * // => [2, 1] + */ + var union = baseRest(function(arrays) { + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); + }); + + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by + * which uniqueness is computed. Result values are chosen from the first + * array in which the value occurs. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // The `_.property` iteratee shorthand. + * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + var unionBy = baseRest(function(arrays) { + var iteratee = last(arrays); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); + }); + + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. Result values are chosen from + * the first array in which the value occurs. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + var unionWith = baseRest(function(arrays) { + var comparator = last(arrays); + comparator = typeof comparator == 'function' ? comparator : undefined; + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); + }); + + /** + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons, in which only the first occurrence of each element + * is kept. The order of result values is determined by the order they occur + * in the array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + */ + function uniq(array) { + return (array && array.length) ? baseUniq(array) : []; + } + + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The order of result values is determined by the + * order they occur in the array. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // The `_.property` iteratee shorthand. + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + function uniqBy(array, iteratee) { + return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; + } + + /** + * This method is like `_.uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The order of result values is + * determined by the order they occur in the array.The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.uniqWith(objects, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + function uniqWith(array, comparator) { + comparator = typeof comparator == 'function' ? comparator : undefined; + return (array && array.length) ? baseUniq(array, undefined, comparator) : []; + } + + /** + * This method is like `_.zip` except that it accepts an array of grouped + * elements and creates an array regrouping the elements to their pre-zip + * configuration. + * + * @static + * @memberOf _ + * @since 1.2.0 + * @category Array + * @param {Array} array The array of grouped elements to process. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); + * // => [['a', 1, true], ['b', 2, false]] + * + * _.unzip(zipped); + * // => [['a', 'b'], [1, 2], [true, false]] + */ + function unzip(array) { + if (!(array && array.length)) { + return []; + } + var length = 0; + array = arrayFilter(array, function(group) { + if (isArrayLikeObject(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + return baseTimes(length, function(index) { + return arrayMap(array, baseProperty(index)); + }); + } + + /** + * This method is like `_.unzip` except that it accepts `iteratee` to specify + * how regrouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Array + * @param {Array} array The array of grouped elements to process. + * @param {Function} [iteratee=_.identity] The function to combine + * regrouped values. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip([1, 2], [10, 20], [100, 200]); + * // => [[1, 10, 100], [2, 20, 200]] + * + * _.unzipWith(zipped, _.add); + * // => [3, 30, 300] + */ + function unzipWith(array, iteratee) { + if (!(array && array.length)) { + return []; + } + var result = unzip(array); + if (iteratee == null) { + return result; + } + return arrayMap(result, function(group) { + return apply(iteratee, undefined, group); + }); + } + + /** + * Creates an array excluding all given values using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.pull`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...*} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.difference, _.xor + * @example + * + * _.without([2, 1, 2, 3], 1, 2); + * // => [3] + */ + var without = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, values) + : []; + }); + + /** + * Creates an array of unique values that is the + * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * of the given arrays. The order of result values is determined by the order + * they occur in the arrays. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of filtered values. + * @see _.difference, _.without + * @example + * + * _.xor([2, 1], [2, 3]); + * // => [1, 3] + */ + var xor = baseRest(function(arrays) { + return baseXor(arrayFilter(arrays, isArrayLikeObject)); + }); + + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by + * which by which they're compared. The order of result values is determined + * by the order they occur in the arrays. The iteratee is invoked with one + * argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2, 3.4] + * + * // The `_.property` iteratee shorthand. + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + var xorBy = baseRest(function(arrays) { + var iteratee = last(arrays); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); + }); + + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The order of result values is + * determined by the order they occur in the arrays. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + var xorWith = baseRest(function(arrays) { + var comparator = last(arrays); + comparator = typeof comparator == 'function' ? comparator : undefined; + return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); + }); + + /** + * Creates an array of grouped elements, the first of which contains the + * first elements of the given arrays, the second of which contains the + * second elements of the given arrays, and so on. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zip(['a', 'b'], [1, 2], [true, false]); + * // => [['a', 1, true], ['b', 2, false]] + */ + var zip = baseRest(unzip); + + /** + * This method is like `_.fromPairs` except that it accepts two arrays, + * one of property identifiers and one of corresponding values. + * + * @static + * @memberOf _ + * @since 0.4.0 + * @category Array + * @param {Array} [props=[]] The property identifiers. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObject(['a', 'b'], [1, 2]); + * // => { 'a': 1, 'b': 2 } + */ + function zipObject(props, values) { + return baseZipObject(props || [], values || [], assignValue); + } + + /** + * This method is like `_.zipObject` except that it supports property paths. + * + * @static + * @memberOf _ + * @since 4.1.0 + * @category Array + * @param {Array} [props=[]] The property identifiers. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); + * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } + */ + function zipObjectDeep(props, values) { + return baseZipObject(props || [], values || [], baseSet); + } + + /** + * This method is like `_.zip` except that it accepts `iteratee` to specify + * how grouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee=_.identity] The function to combine + * grouped values. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { + * return a + b + c; + * }); + * // => [111, 222] + */ + var zipWith = baseRest(function(arrays) { + var length = arrays.length, + iteratee = length > 1 ? arrays[length - 1] : undefined; + + iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; + return unzipWith(arrays, iteratee); + }); + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` wrapper instance that wraps `value` with explicit method + * chain sequences enabled. The result of such sequences must be unwrapped + * with `_#value`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Seq + * @param {*} value The value to wrap. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'pebbles', 'age': 1 } + * ]; + * + * var youngest = _ + * .chain(users) + * .sortBy('age') + * .map(function(o) { + * return o.user + ' is ' + o.age; + * }) + * .head() + * .value(); + * // => 'pebbles is 1' + */ + function chain(value) { + var result = lodash(value); + result.__chain__ = true; + return result; + } + + /** + * This method invokes `interceptor` and returns `value`. The interceptor + * is invoked with one argument; (value). The purpose of this method is to + * "tap into" a method chain sequence in order to modify intermediate results. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @returns {*} Returns `value`. + * @example + * + * _([1, 2, 3]) + * .tap(function(array) { + * // Mutate input array. + * array.pop(); + * }) + * .reverse() + * .value(); + * // => [2, 1] + */ + function tap(value, interceptor) { + interceptor(value); + return value; + } + + /** + * This method is like `_.tap` except that it returns the result of `interceptor`. + * The purpose of this method is to "pass thru" values replacing intermediate + * results in a method chain sequence. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Seq + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @returns {*} Returns the result of `interceptor`. + * @example + * + * _(' abc ') + * .chain() + * .trim() + * .thru(function(value) { + * return [value]; + * }) + * .value(); + * // => ['abc'] + */ + function thru(value, interceptor) { + return interceptor(value); + } + + /** + * This method is the wrapper version of `_.at`. + * + * @name at + * @memberOf _ + * @since 1.0.0 + * @category Seq + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; + * + * _(object).at(['a[0].b.c', 'a[1]']).value(); + * // => [3, 4] + */ + var wrapperAt = flatRest(function(paths) { + var length = paths.length, + start = length ? paths[0] : 0, + value = this.__wrapped__, + interceptor = function(object) { return baseAt(object, paths); }; + + if (length > 1 || this.__actions__.length || + !(value instanceof LazyWrapper) || !isIndex(start)) { + return this.thru(interceptor); + } + value = value.slice(start, +start + (length ? 1 : 0)); + value.__actions__.push({ + 'func': thru, + 'args': [interceptor], + 'thisArg': undefined + }); + return new LodashWrapper(value, this.__chain__).thru(function(array) { + if (length && !array.length) { + array.push(undefined); + } + return array; + }); + }); + + /** + * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. + * + * @name chain + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // A sequence without explicit chaining. + * _(users).head(); + * // => { 'user': 'barney', 'age': 36 } + * + * // A sequence with explicit chaining. + * _(users) + * .chain() + * .head() + * .pick('user') + * .value(); + * // => { 'user': 'barney' } + */ + function wrapperChain() { + return chain(this); + } + + /** + * Executes the chain sequence and returns the wrapped result. + * + * @name commit + * @memberOf _ + * @since 3.2.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapped = _(array).push(3); + * + * console.log(array); + * // => [1, 2] + * + * wrapped = wrapped.commit(); + * console.log(array); + * // => [1, 2, 3] + * + * wrapped.last(); + * // => 3 + * + * console.log(array); + * // => [1, 2, 3] + */ + function wrapperCommit() { + return new LodashWrapper(this.value(), this.__chain__); + } + + /** + * Gets the next value on a wrapped object following the + * [iterator protocol](https://mdn.io/iteration_protocols#iterator). + * + * @name next + * @memberOf _ + * @since 4.0.0 + * @category Seq + * @returns {Object} Returns the next iterator value. + * @example + * + * var wrapped = _([1, 2]); + * + * wrapped.next(); + * // => { 'done': false, 'value': 1 } + * + * wrapped.next(); + * // => { 'done': false, 'value': 2 } + * + * wrapped.next(); + * // => { 'done': true, 'value': undefined } + */ + function wrapperNext() { + if (this.__values__ === undefined) { + this.__values__ = toArray(this.value()); + } + var done = this.__index__ >= this.__values__.length, + value = done ? undefined : this.__values__[this.__index__++]; + + return { 'done': done, 'value': value }; + } + + /** + * Enables the wrapper to be iterable. + * + * @name Symbol.iterator + * @memberOf _ + * @since 4.0.0 + * @category Seq + * @returns {Object} Returns the wrapper object. + * @example + * + * var wrapped = _([1, 2]); + * + * wrapped[Symbol.iterator]() === wrapped; + * // => true + * + * Array.from(wrapped); + * // => [1, 2] + */ + function wrapperToIterator() { + return this; + } + + /** + * Creates a clone of the chain sequence planting `value` as the wrapped value. + * + * @name plant + * @memberOf _ + * @since 3.2.0 + * @category Seq + * @param {*} value The value to plant. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var wrapped = _([1, 2]).map(square); + * var other = wrapped.plant([3, 4]); + * + * other.value(); + * // => [9, 16] + * + * wrapped.value(); + * // => [1, 4] + */ + function wrapperPlant(value) { + var result, + parent = this; + + while (parent instanceof baseLodash) { + var clone = wrapperClone(parent); + clone.__index__ = 0; + clone.__values__ = undefined; + if (result) { + previous.__wrapped__ = clone; + } else { + result = clone; + } + var previous = clone; + parent = parent.__wrapped__; + } + previous.__wrapped__ = value; + return result; + } + + /** + * This method is the wrapper version of `_.reverse`. + * + * **Note:** This method mutates the wrapped array. + * + * @name reverse + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2, 3]; + * + * _(array).reverse().value() + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function wrapperReverse() { + var value = this.__wrapped__; + if (value instanceof LazyWrapper) { + var wrapped = value; + if (this.__actions__.length) { + wrapped = new LazyWrapper(this); + } + wrapped = wrapped.reverse(); + wrapped.__actions__.push({ + 'func': thru, + 'args': [reverse], + 'thisArg': undefined + }); + return new LodashWrapper(wrapped, this.__chain__); + } + return this.thru(reverse); + } + + /** + * Executes the chain sequence to resolve the unwrapped value. + * + * @name value + * @memberOf _ + * @since 0.1.0 + * @alias toJSON, valueOf + * @category Seq + * @returns {*} Returns the resolved unwrapped value. + * @example + * + * _([1, 2, 3]).value(); + * // => [1, 2, 3] + */ + function wrapperValue() { + return baseWrapperValue(this.__wrapped__, this.__actions__); + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the number of times the key was returned by `iteratee`. The + * iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.countBy([6.1, 4.2, 6.3], Math.floor); + * // => { '4': 1, '6': 2 } + * + * // The `_.property` iteratee shorthand. + * _.countBy(['one', 'two', 'three'], 'length'); + * // => { '3': 2, '5': 1 } + */ + var countBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + ++result[key]; + } else { + baseAssignValue(result, key, 1); + } + }); + + /** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * Iteration is stopped once `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * **Note:** This method returns `true` for + * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because + * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of + * elements of empty collections. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.every(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.every(users, 'active'); + * // => false + */ + function every(collection, predicate, guard) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined; + } + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * **Note:** Unlike `_.remove`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.reject + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.filter(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.filter(users, { 'age': 36, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.filter(users, 'active'); + * // => objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] + */ + function filter(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.find(users, function(o) { return o.age < 40; }); + * // => object for 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.find(users, { 'age': 1, 'active': true }); + * // => object for 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.find(users, ['active', false]); + * // => object for 'fred' + * + * // The `_.property` iteratee shorthand. + * _.find(users, 'active'); + * // => object for 'barney' + */ + var find = createFind(findIndex); + + /** + * This method is like `_.find` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=collection.length-1] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * _.findLast([1, 2, 3, 4], function(n) { + * return n % 2 == 1; + * }); + * // => 3 + */ + var findLast = createFind(findLastIndex); + + /** + * Creates a flattened array of values by running each element in `collection` + * thru `iteratee` and flattening the mapped results. The iteratee is invoked + * with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [n, n]; + * } + * + * _.flatMap([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + function flatMap(collection, iteratee) { + return baseFlatten(map(collection, iteratee), 1); + } + + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + function flatMapDeep(collection, iteratee) { + return baseFlatten(map(collection, iteratee), INFINITY); + } + + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + function flatMapDepth(collection, iteratee, depth) { + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(map(collection, iteratee), depth); + } + + /** + * Iterates over elements of `collection` and invokes `iteratee` for each element. + * The iteratee is invoked with three arguments: (value, index|key, collection). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" + * property are iterated like arrays. To avoid this behavior use `_.forIn` + * or `_.forOwn` for object iteration. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias each + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEachRight + * @example + * + * _.forEach([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `1` then `2`. + * + * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ + function forEach(collection, iteratee) { + var func = isArray(collection) ? arrayEach : baseEach; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.forEach` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @alias eachRight + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEach + * @example + * + * _.forEachRight([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `2` then `1`. + */ + function forEachRight(collection, iteratee) { + var func = isArray(collection) ? arrayEachRight : baseEachRight; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The order of grouped values + * is determined by the order they occur in `collection`. The corresponding + * value of each key is an array of elements responsible for generating the + * key. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.groupBy([6.1, 4.2, 6.3], Math.floor); + * // => { '4': [4.2], '6': [6.1, 6.3] } + * + * // The `_.property` iteratee shorthand. + * _.groupBy(['one', 'two', 'three'], 'length'); + * // => { '3': ['one', 'two'], '5': ['three'] } + */ + var groupBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + result[key].push(value); + } else { + baseAssignValue(result, key, [value]); + } + }); + + /** + * Checks if `value` is in `collection`. If `collection` is a string, it's + * checked for a substring of `value`, otherwise + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * is used for equality comparisons. If `fromIndex` is negative, it's used as + * the offset from the end of `collection`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. + * @returns {boolean} Returns `true` if `value` is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'a': 1, 'b': 2 }, 1); + * // => true + * + * _.includes('abcd', 'bc'); + * // => true + */ + function includes(collection, value, fromIndex, guard) { + collection = isArrayLike(collection) ? collection : values(collection); + fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; + + var length = collection.length; + if (fromIndex < 0) { + fromIndex = nativeMax(length + fromIndex, 0); + } + return isString(collection) + ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) + : (!!length && baseIndexOf(collection, value, fromIndex) > -1); + } + + /** + * Invokes the method at `path` of each element in `collection`, returning + * an array of the results of each invoked method. Any additional arguments + * are provided to each invoked method. If `path` is a function, it's invoked + * for, and `this` bound to, each element in `collection`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array|Function|string} path The path of the method to invoke or + * the function invoked per iteration. + * @param {...*} [args] The arguments to invoke each method with. + * @returns {Array} Returns the array of results. + * @example + * + * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invokeMap([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ + var invokeMap = baseRest(function(collection, path, args) { + var index = -1, + isFunc = typeof path == 'function', + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value) { + result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); + }); + return result; + }); + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the last element responsible for generating the key. The + * iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * var array = [ + * { 'dir': 'left', 'code': 97 }, + * { 'dir': 'right', 'code': 100 } + * ]; + * + * _.keyBy(array, function(o) { + * return String.fromCharCode(o.code); + * }); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + * + * _.keyBy(array, 'dir'); + * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } + */ + var keyBy = createAggregator(function(result, value, key) { + baseAssignValue(result, key, value); + }); + + /** + * Creates an array of values by running each element in `collection` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, + * `template`, `trim`, `trimEnd`, `trimStart`, and `words` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + * @example + * + * function square(n) { + * return n * n; + * } + * + * _.map([4, 8], square); + * // => [16, 64] + * + * _.map({ 'a': 4, 'b': 8 }, square); + * // => [16, 64] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // The `_.property` iteratee shorthand. + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ + function map(collection, iteratee) { + var func = isArray(collection) ? arrayMap : baseMap; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] + * The iteratees to sort by. + * @param {string[]} [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // Sort by `user` in ascending order and by `age` in descending order. + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + */ + function orderBy(collection, iteratees, orders, guard) { + if (collection == null) { + return []; + } + if (!isArray(iteratees)) { + iteratees = iteratees == null ? [] : [iteratees]; + } + orders = guard ? undefined : orders; + if (!isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + return baseOrderBy(collection, iteratees, orders); + } + + /** + * Creates an array of elements split into two groups, the first of which + * contains elements `predicate` returns truthy for, the second of which + * contains elements `predicate` returns falsey for. The predicate is + * invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the array of grouped elements. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true }, + * { 'user': 'pebbles', 'age': 1, 'active': false } + * ]; + * + * _.partition(users, function(o) { return o.active; }); + * // => objects for [['fred'], ['barney', 'pebbles']] + * + * // The `_.matches` iteratee shorthand. + * _.partition(users, { 'age': 1, 'active': false }); + * // => objects for [['pebbles'], ['barney', 'fred']] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.partition(users, ['active', false]); + * // => objects for [['barney', 'pebbles'], ['fred']] + * + * // The `_.property` iteratee shorthand. + * _.partition(users, 'active'); + * // => objects for [['fred'], ['barney', 'pebbles']] + */ + var partition = createAggregator(function(result, value, key) { + result[key ? 0 : 1].push(value); + }, function() { return [[], []]; }); + + /** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` thru `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not given, the first element of `collection` is used as the initial + * value. The iteratee is invoked with four arguments: + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, + * and `sortBy` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduceRight + * @example + * + * _.reduce([1, 2], function(sum, n) { + * return sum + n; + * }, 0); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * return result; + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) + */ + function reduce(collection, iteratee, accumulator) { + var func = isArray(collection) ? arrayReduce : baseReduce, + initAccum = arguments.length < 3; + + return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); + } + + /** + * This method is like `_.reduce` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduce + * @example + * + * var array = [[0, 1], [2, 3], [4, 5]]; + * + * _.reduceRight(array, function(flattened, other) { + * return flattened.concat(other); + * }, []); + * // => [4, 5, 2, 3, 0, 1] + */ + function reduceRight(collection, iteratee, accumulator) { + var func = isArray(collection) ? arrayReduceRight : baseReduce, + initAccum = arguments.length < 3; + + return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); + } + + /** + * The opposite of `_.filter`; this method returns the elements of `collection` + * that `predicate` does **not** return truthy for. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.filter + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true } + * ]; + * + * _.reject(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.reject(users, { 'age': 40, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.reject(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.reject(users, 'active'); + * // => objects for ['barney'] + */ + function reject(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, negate(getIteratee(predicate, 3))); + } + + /** + * Gets a random element from `collection`. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + * @example + * + * _.sample([1, 2, 3, 4]); + * // => 2 + */ + function sample(collection) { + var func = isArray(collection) ? arraySample : baseSample; + return func(collection); + } + + /** + * Gets `n` random elements at unique keys from `collection` up to the + * size of `collection`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @param {number} [n=1] The number of elements to sample. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the random elements. + * @example + * + * _.sampleSize([1, 2, 3], 2); + * // => [3, 1] + * + * _.sampleSize([1, 2, 3], 4); + * // => [2, 3, 1] + */ + function sampleSize(collection, n, guard) { + if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { + n = 1; + } else { + n = toInteger(n); + } + var func = isArray(collection) ? arraySampleSize : baseSampleSize; + return func(collection, n); + } + + /** + * Creates an array of shuffled values, using a version of the + * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + * @example + * + * _.shuffle([1, 2, 3, 4]); + * // => [4, 1, 3, 2] + */ + function shuffle(collection) { + var func = isArray(collection) ? arrayShuffle : baseShuffle; + return func(collection); + } + + /** + * Gets the size of `collection` by returning its length for array-like + * values or the number of own enumerable string keyed properties for objects. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @returns {number} Returns the collection size. + * @example + * + * _.size([1, 2, 3]); + * // => 3 + * + * _.size({ 'a': 1, 'b': 2 }); + * // => 2 + * + * _.size('pebbles'); + * // => 7 + */ + function size(collection) { + if (collection == null) { + return 0; + } + if (isArrayLike(collection)) { + return isString(collection) ? stringSize(collection) : collection.length; + } + var tag = getTag(collection); + if (tag == mapTag || tag == setTag) { + return collection.size; + } + return baseKeys(collection).length; + } + + /** + * Checks if `predicate` returns truthy for **any** element of `collection`. + * Iteration is stopped once `predicate` returns truthy. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + * @example + * + * _.some([null, 0, 'yes', false], Boolean); + * // => true + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.some(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.some(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.some(users, 'active'); + * // => true + */ + function some(collection, predicate, guard) { + var func = isArray(collection) ? arraySome : baseSome; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined; + } + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection thru each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {...(Function|Function[])} [iteratees=[_.identity]] + * The iteratees to sort by. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 30 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, [function(o) { return o.user; }]); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] + */ + var sortBy = baseRest(function(collection, iteratees) { + if (collection == null) { + return []; + } + var length = iteratees.length; + if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { + iteratees = []; + } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { + iteratees = [iteratees[0]]; + } + return baseOrderBy(collection, baseFlatten(iteratees, 1), []); + }); + + /*------------------------------------------------------------------------*/ + + /** + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. + */ + var now = ctxNow || function() { + return root.Date.now(); + }; + + /*------------------------------------------------------------------------*/ + + /** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it's called `n` or more times. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {number} n The number of calls before `func` is invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var saves = ['profile', 'settings']; + * + * var done = _.after(saves.length, function() { + * console.log('done saving!'); + * }); + * + * _.forEach(saves, function(type) { + * asyncSave({ 'type': type, 'complete': done }); + * }); + * // => Logs 'done saving!' after the two async saves have completed. + */ + function after(n, func) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n < 1) { + return func.apply(this, arguments); + } + }; + } + + /** + * Creates a function that invokes `func`, with up to `n` arguments, + * ignoring any additional arguments. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to cap arguments for. + * @param {number} [n=func.length] The arity cap. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new capped function. + * @example + * + * _.map(['6', '8', '10'], _.ary(parseInt, 1)); + * // => [6, 8, 10] + */ + function ary(func, n, guard) { + n = guard ? undefined : n; + n = (func && n == null) ? func.length : n; + return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); + } + + /** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it's called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {number} n The number of calls at which `func` is no longer invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * jQuery(element).on('click', _.before(5, addContactToList)); + * // => Allows adding up to 4 contacts to the list. + */ + function before(n, func) { + var result; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n > 0) { + result = func.apply(this, arguments); + } + if (n <= 1) { + func = undefined; + } + return result; + }; + } + + /** + * Creates a function that invokes `func` with the `this` binding of `thisArg` + * and `partials` prepended to the arguments it receives. + * + * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for partially applied arguments. + * + * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" + * property of bound functions. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * function greet(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * + * var object = { 'user': 'fred' }; + * + * var bound = _.bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * // Bound with placeholders. + * var bound = _.bind(greet, object, _, '!'); + * bound('hi'); + * // => 'hi fred!' + */ + var bind = baseRest(function(func, thisArg, partials) { + var bitmask = WRAP_BIND_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bind)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(func, bitmask, thisArg, partials, holders); + }); + + /** + * Creates a function that invokes the method at `object[key]` with `partials` + * prepended to the arguments it receives. + * + * This method differs from `_.bind` by allowing bound functions to reference + * methods that may be redefined or don't yet exist. See + * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) + * for more details. + * + * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Function + * @param {Object} object The object to invoke the method on. + * @param {string} key The key of the method. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * var object = { + * 'user': 'fred', + * 'greet': function(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * }; + * + * var bound = _.bindKey(object, 'greet', 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * object.greet = function(greeting, punctuation) { + * return greeting + 'ya ' + this.user + punctuation; + * }; + * + * bound('!'); + * // => 'hiya fred!' + * + * // Bound with placeholders. + * var bound = _.bindKey(object, 'greet', _, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ + var bindKey = baseRest(function(object, key, partials) { + var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bindKey)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(key, bitmask, object, partials, holders); + }); + + /** + * Creates a function that accepts arguments of `func` and either invokes + * `func` returning its result, if at least `arity` number of arguments have + * been provided, or returns a function that accepts the remaining `func` + * arguments, and so on. The arity of `func` may be specified if `func.length` + * is not sufficient. + * + * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for provided arguments. + * + * **Note:** This method doesn't set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curry(abc); + * + * curried(1)(2)(3); + * // => [1, 2, 3] + * + * curried(1, 2)(3); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // Curried with placeholders. + * curried(1)(_, 3)(2); + * // => [1, 2, 3] + */ + function curry(func, arity, guard) { + arity = guard ? undefined : arity; + var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); + result.placeholder = curry.placeholder; + return result; + } + + /** + * This method is like `_.curry` except that arguments are applied to `func` + * in the manner of `_.partialRight` instead of `_.partial`. + * + * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for provided arguments. + * + * **Note:** This method doesn't set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curryRight(abc); + * + * curried(3)(2)(1); + * // => [1, 2, 3] + * + * curried(2, 3)(1); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // Curried with placeholders. + * curried(3)(1, _)(2); + * // => [1, 2, 3] + */ + function curryRight(func, arity, guard) { + arity = guard ? undefined : arity; + var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); + result.placeholder = curryRight.placeholder; + return result; + } + + /** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent + * calls to the debounced function return the result of the last `func` + * invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // Avoid costly calculations while the window size is in flux. + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // Invoke `sendMail` when clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ + function debounce(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = toNumber(wait) || 0; + if (isObject(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; + } + + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; + } + + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + timeWaiting = wait - timeSinceLastCall; + + return maxing + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); + } + + function trailingEdge(time) { + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = undefined; + return result; + } + + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; + } + + function flush() { + return timerId === undefined ? result : trailingEdge(now()); + } + + function debounced() { + var time = now(), + isInvoking = shouldInvoke(time); + + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); + } + if (maxing) { + // Handle invocations in a tight loop. + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; + } + + /** + * Defers invoking the `func` until the current call stack has cleared. Any + * additional arguments are provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to defer. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.defer(function(text) { + * console.log(text); + * }, 'deferred'); + * // => Logs 'deferred' after one millisecond. + */ + var defer = baseRest(function(func, args) { + return baseDelay(func, 1, args); + }); + + /** + * Invokes `func` after `wait` milliseconds. Any additional arguments are + * provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.delay(function(text) { + * console.log(text); + * }, 1000, 'later'); + * // => Logs 'later' after one second. + */ + var delay = baseRest(function(func, wait, args) { + return baseDelay(func, toNumber(wait) || 0, args); + }); + + /** + * Creates a function that invokes `func` with arguments reversed. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to flip arguments for. + * @returns {Function} Returns the new flipped function. + * @example + * + * var flipped = _.flip(function() { + * return _.toArray(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ + function flip(func) { + return createWrap(func, WRAP_FLIP_FLAG); + } + + /** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ + function memoize(func, resolver) { + if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; + } + + // Expose `MapCache`. + memoize.Cache = MapCache; + + /** + * Creates a function that negates the result of the predicate `func`. The + * `func` predicate is invoked with the `this` binding and arguments of the + * created function. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} predicate The predicate to negate. + * @returns {Function} Returns the new negated function. + * @example + * + * function isEven(n) { + * return n % 2 == 0; + * } + * + * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); + * // => [1, 3, 5] + */ + function negate(predicate) { + if (typeof predicate != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function() { + var args = arguments; + switch (args.length) { + case 0: return !predicate.call(this); + case 1: return !predicate.call(this, args[0]); + case 2: return !predicate.call(this, args[0], args[1]); + case 3: return !predicate.call(this, args[0], args[1], args[2]); + } + return !predicate.apply(this, args); + }; + } + + /** + * Creates a function that is restricted to invoking `func` once. Repeat calls + * to the function return the value of the first invocation. The `func` is + * invoked with the `this` binding and arguments of the created function. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var initialize = _.once(createApplication); + * initialize(); + * initialize(); + * // => `createApplication` is invoked once + */ + function once(func) { + return before(2, func); + } + + /** + * Creates a function that invokes `func` with its arguments transformed. + * + * @static + * @since 4.0.0 + * @memberOf _ + * @category Function + * @param {Function} func The function to wrap. + * @param {...(Function|Function[])} [transforms=[_.identity]] + * The argument transforms. + * @returns {Function} Returns the new function. + * @example + * + * function doubled(n) { + * return n * 2; + * } + * + * function square(n) { + * return n * n; + * } + * + * var func = _.overArgs(function(x, y) { + * return [x, y]; + * }, [square, doubled]); + * + * func(9, 3); + * // => [81, 6] + * + * func(10, 5); + * // => [100, 10] + */ + var overArgs = castRest(function(func, transforms) { + transforms = (transforms.length == 1 && isArray(transforms[0])) + ? arrayMap(transforms[0], baseUnary(getIteratee())) + : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); + + var funcsLength = transforms.length; + return baseRest(function(args) { + var index = -1, + length = nativeMin(args.length, funcsLength); + + while (++index < length) { + args[index] = transforms[index].call(this, args[index]); + } + return apply(func, this, args); + }); + }); + + /** + * Creates a function that invokes `func` with `partials` prepended to the + * arguments it receives. This method is like `_.bind` except it does **not** + * alter the `this` binding. + * + * The `_.partial.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method doesn't set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @since 0.2.0 + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * function greet(greeting, name) { + * return greeting + ' ' + name; + * } + * + * var sayHelloTo = _.partial(greet, 'hello'); + * sayHelloTo('fred'); + * // => 'hello fred' + * + * // Partially applied with placeholders. + * var greetFred = _.partial(greet, _, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + */ + var partial = baseRest(function(func, partials) { + var holders = replaceHolders(partials, getHolder(partial)); + return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); + }); + + /** + * This method is like `_.partial` except that partially applied arguments + * are appended to the arguments it receives. + * + * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method doesn't set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * function greet(greeting, name) { + * return greeting + ' ' + name; + * } + * + * var greetFred = _.partialRight(greet, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + * + * // Partially applied with placeholders. + * var sayHelloTo = _.partialRight(greet, 'hello', _); + * sayHelloTo('fred'); + * // => 'hello fred' + */ + var partialRight = baseRest(function(func, partials) { + var holders = replaceHolders(partials, getHolder(partialRight)); + return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); + }); + + /** + * Creates a function that invokes `func` with arguments arranged according + * to the specified `indexes` where the argument value at the first index is + * provided as the first argument, the argument value at the second index is + * provided as the second argument, and so on. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to rearrange arguments for. + * @param {...(number|number[])} indexes The arranged argument indexes. + * @returns {Function} Returns the new function. + * @example + * + * var rearged = _.rearg(function(a, b, c) { + * return [a, b, c]; + * }, [2, 0, 1]); + * + * rearged('b', 'c', 'a') + * // => ['a', 'b', 'c'] + */ + var rearg = flatRest(function(func, indexes) { + return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); + }); + + /** + * Creates a function that invokes `func` with the `this` binding of the + * created function and arguments from `start` and beyond provided as + * an array. + * + * **Note:** This method is based on the + * [rest parameter](https://mdn.io/rest_parameters). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.rest(function(what, names) { + * return what + ' ' + _.initial(names).join(', ') + + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); + * }); + * + * say('hello', 'fred', 'barney', 'pebbles'); + * // => 'hello fred, barney, & pebbles' + */ + function rest(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = start === undefined ? start : toInteger(start); + return baseRest(func, start); + } + + /** + * Creates a function that invokes `func` with the `this` binding of the + * create function and an array of arguments much like + * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). + * + * **Note:** This method is based on the + * [spread operator](https://mdn.io/spread_operator). + * + * @static + * @memberOf _ + * @since 3.2.0 + * @category Function + * @param {Function} func The function to spread arguments over. + * @param {number} [start=0] The start position of the spread. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.spread(function(who, what) { + * return who + ' says ' + what; + * }); + * + * say(['fred', 'hello']); + * // => 'fred says hello' + * + * var numbers = Promise.all([ + * Promise.resolve(40), + * Promise.resolve(36) + * ]); + * + * numbers.then(_.spread(function(x, y) { + * return x + y; + * })); + * // => a Promise of 76 + */ + function spread(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = start == null ? 0 : nativeMax(toInteger(start), 0); + return baseRest(function(args) { + var array = args[start], + otherArgs = castSlice(args, 0, start); + + if (array) { + arrayPush(otherArgs, array); + } + return apply(func, this, otherArgs); + }); + } + + /** + * Creates a throttled function that only invokes `func` at most once per + * every `wait` milliseconds. The throttled function comes with a `cancel` + * method to cancel delayed `func` invocations and a `flush` method to + * immediately invoke them. Provide `options` to indicate whether `func` + * should be invoked on the leading and/or trailing edge of the `wait` + * timeout. The `func` is invoked with the last arguments provided to the + * throttled function. Subsequent calls to the throttled function return the + * result of the last `func` invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the throttled function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.throttle` and `_.debounce`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to throttle. + * @param {number} [wait=0] The number of milliseconds to throttle invocations to. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=true] + * Specify invoking on the leading edge of the timeout. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new throttled function. + * @example + * + * // Avoid excessively updating the position while scrolling. + * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); + * + * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. + * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); + * jQuery(element).on('click', throttled); + * + * // Cancel the trailing throttled invocation. + * jQuery(window).on('popstate', throttled.cancel); + */ + function throttle(func, wait, options) { + var leading = true, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (isObject(options)) { + leading = 'leading' in options ? !!options.leading : leading; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + return debounce(func, wait, { + 'leading': leading, + 'maxWait': wait, + 'trailing': trailing + }); + } + + /** + * Creates a function that accepts up to one argument, ignoring any + * additional arguments. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + * @example + * + * _.map(['6', '8', '10'], _.unary(parseInt)); + * // => [6, 8, 10] + */ + function unary(func) { + return ary(func, 1); + } + + /** + * Creates a function that provides `value` to `wrapper` as its first + * argument. Any additional arguments provided to the function are appended + * to those provided to the `wrapper`. The wrapper is invoked with the `this` + * binding of the created function. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {*} value The value to wrap. + * @param {Function} [wrapper=identity] The wrapper function. + * @returns {Function} Returns the new function. + * @example + * + * var p = _.wrap(_.escape, function(func, text) { + * return '

' + func(text) + '

'; + * }); + * + * p('fred, barney, & pebbles'); + * // => '

fred, barney, & pebbles

' + */ + function wrap(value, wrapper) { + return partial(castFunction(wrapper), value); + } + + /*------------------------------------------------------------------------*/ + + /** + * Casts `value` as an array if it's not one. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Lang + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast array. + * @example + * + * _.castArray(1); + * // => [1] + * + * _.castArray({ 'a': 1 }); + * // => [{ 'a': 1 }] + * + * _.castArray('abc'); + * // => ['abc'] + * + * _.castArray(null); + * // => [null] + * + * _.castArray(undefined); + * // => [undefined] + * + * _.castArray(); + * // => [] + * + * var array = [1, 2, 3]; + * console.log(_.castArray(array) === array); + * // => true + */ + function castArray() { + if (!arguments.length) { + return []; + } + var value = arguments[0]; + return isArray(value) ? value : [value]; + } + + /** + * Creates a shallow clone of `value`. + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) + * and supports cloning arrays, array buffers, booleans, date objects, maps, + * numbers, `Object` objects, regexes, sets, strings, symbols, and typed + * arrays. The own enumerable properties of `arguments` objects are cloned + * as plain objects. An empty object is returned for uncloneable values such + * as error objects, functions, DOM nodes, and WeakMaps. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + * @see _.cloneDeep + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var shallow = _.clone(objects); + * console.log(shallow[0] === objects[0]); + * // => true + */ + function clone(value) { + return baseClone(value, CLONE_SYMBOLS_FLAG); + } + + /** + * This method is like `_.clone` except that it accepts `customizer` which + * is invoked to produce the cloned value. If `customizer` returns `undefined`, + * cloning is handled by the method instead. The `customizer` is invoked with + * up to four arguments; (value [, index|key, object, stack]). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the cloned value. + * @see _.cloneDeepWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(false); + * } + * } + * + * var el = _.cloneWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 0 + */ + function cloneWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); + } + + /** + * This method is like `_.clone` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @returns {*} Returns the deep cloned value. + * @see _.clone + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var deep = _.cloneDeep(objects); + * console.log(deep[0] === objects[0]); + * // => false + */ + function cloneDeep(value) { + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); + } + + /** + * This method is like `_.cloneWith` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the deep cloned value. + * @see _.cloneWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(true); + * } + * } + * + * var el = _.cloneDeepWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 20 + */ + function cloneDeepWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); + } + + /** + * Checks if `object` conforms to `source` by invoking the predicate + * properties of `source` with the corresponding property values of `object`. + * + * **Note:** This method is equivalent to `_.conforms` when `source` is + * partially applied. + * + * @static + * @memberOf _ + * @since 4.14.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * + * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); + * // => true + * + * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); + * // => false + */ + function conformsTo(object, source) { + return source == null || baseConformsTo(object, source, keys(source)); + } + + /** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + function eq(value, other) { + return value === other || (value !== value && other !== other); + } + + /** + * Checks if `value` is greater than `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + * @see _.lt + * @example + * + * _.gt(3, 1); + * // => true + * + * _.gt(3, 3); + * // => false + * + * _.gt(1, 3); + * // => false + */ + var gt = createRelationalOperation(baseGt); + + /** + * Checks if `value` is greater than or equal to `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than or equal to + * `other`, else `false`. + * @see _.lte + * @example + * + * _.gte(3, 1); + * // => true + * + * _.gte(3, 3); + * // => true + * + * _.gte(1, 3); + * // => false + */ + var gte = createRelationalOperation(function(value, other) { + return value >= other; + }); + + /** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ + var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); + }; + + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ + var isArray = Array.isArray; + + /** + * Checks if `value` is classified as an `ArrayBuffer` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + * @example + * + * _.isArrayBuffer(new ArrayBuffer(2)); + * // => true + * + * _.isArrayBuffer(new Array(2)); + * // => false + */ + var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; + + /** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ + function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); + } + + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ + function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); + } + + /** + * Checks if `value` is classified as a boolean primitive or object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. + * @example + * + * _.isBoolean(false); + * // => true + * + * _.isBoolean(null); + * // => false + */ + function isBoolean(value) { + return value === true || value === false || + (isObjectLike(value) && baseGetTag(value) == boolTag); + } + + /** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ + var isBuffer = nativeIsBuffer || stubFalse; + + /** + * Checks if `value` is classified as a `Date` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + * @example + * + * _.isDate(new Date); + * // => true + * + * _.isDate('Mon April 23 2012'); + * // => false + */ + var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; + + /** + * Checks if `value` is likely a DOM element. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. + * @example + * + * _.isElement(document.body); + * // => true + * + * _.isElement(''); + * // => false + */ + function isElement(value) { + return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); + } + + /** + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is empty, else `false`. + * @example + * + * _.isEmpty(null); + * // => true + * + * _.isEmpty(true); + * // => true + * + * _.isEmpty(1); + * // => true + * + * _.isEmpty([1, 2, 3]); + * // => false + * + * _.isEmpty({ 'a': 1 }); + * // => false + */ + function isEmpty(value) { + if (value == null) { + return true; + } + if (isArrayLike(value) && + (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || + isBuffer(value) || isTypedArray(value) || isArguments(value))) { + return !value.length; + } + var tag = getTag(value); + if (tag == mapTag || tag == setTag) { + return !value.size; + } + if (isPrototype(value)) { + return !baseKeys(value).length; + } + for (var key in value) { + if (hasOwnProperty.call(value, key)) { + return false; + } + } + return true; + } + + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are compared by strict equality, i.e. `===`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + function isEqual(value, other) { + return baseIsEqual(value, other); + } + + /** + * This method is like `_.isEqual` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with up to + * six arguments: (objValue, othValue [, index|key, object, other, stack]). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + function isEqualWith(value, other, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + var result = customizer ? customizer(value, other) : undefined; + return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; + } + + /** + * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, + * `SyntaxError`, `TypeError`, or `URIError` object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an error object, else `false`. + * @example + * + * _.isError(new Error); + * // => true + * + * _.isError(Error); + * // => false + */ + function isError(value) { + if (!isObjectLike(value)) { + return false; + } + var tag = baseGetTag(value); + return tag == errorTag || tag == domExcTag || + (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); + } + + /** + * Checks if `value` is a finite primitive number. + * + * **Note:** This method is based on + * [`Number.isFinite`](https://mdn.io/Number/isFinite). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. + * @example + * + * _.isFinite(3); + * // => true + * + * _.isFinite(Number.MIN_VALUE); + * // => true + * + * _.isFinite(Infinity); + * // => false + * + * _.isFinite('3'); + * // => false + */ + function isFinite(value) { + return typeof value == 'number' && nativeIsFinite(value); + } + + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + } + + /** + * Checks if `value` is an integer. + * + * **Note:** This method is based on + * [`Number.isInteger`](https://mdn.io/Number/isInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an integer, else `false`. + * @example + * + * _.isInteger(3); + * // => true + * + * _.isInteger(Number.MIN_VALUE); + * // => false + * + * _.isInteger(Infinity); + * // => false + * + * _.isInteger('3'); + * // => false + */ + function isInteger(value) { + return typeof value == 'number' && value == toInteger(value); + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ + function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ + function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); + } + + /** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + function isObjectLike(value) { + return value != null && typeof value == 'object'; + } + + /** + * Checks if `value` is classified as a `Map` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + * @example + * + * _.isMap(new Map); + * // => true + * + * _.isMap(new WeakMap); + * // => false + */ + var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; + + /** + * Performs a partial deep comparison between `object` and `source` to + * determine if `object` contains equivalent property values. + * + * **Note:** This method is equivalent to `_.matches` when `source` is + * partially applied. + * + * Partial comparisons will match empty array and empty object `source` + * values against any array or object value, respectively. See `_.isEqual` + * for a list of supported value comparisons. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * + * _.isMatch(object, { 'b': 2 }); + * // => true + * + * _.isMatch(object, { 'b': 1 }); + * // => false + */ + function isMatch(object, source) { + return object === source || baseIsMatch(object, source, getMatchData(source)); + } + + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with five + * arguments: (objValue, srcValue, index|key, object, source). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + function isMatchWith(object, source, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseIsMatch(object, source, getMatchData(source), customizer); + } + + /** + * Checks if `value` is `NaN`. + * + * **Note:** This method is based on + * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as + * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for + * `undefined` and other non-number values. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + * @example + * + * _.isNaN(NaN); + * // => true + * + * _.isNaN(new Number(NaN)); + * // => true + * + * isNaN(undefined); + * // => true + * + * _.isNaN(undefined); + * // => false + */ + function isNaN(value) { + // An `NaN` primitive is the only value that is not equal to itself. + // Perform the `toStringTag` check first to avoid errors with some + // ActiveX objects in IE. + return isNumber(value) && value != +value; + } + + /** + * Checks if `value` is a pristine native function. + * + * **Note:** This method can't reliably detect native functions in the presence + * of the core-js package because core-js circumvents this kind of detection. + * Despite multiple requests, the core-js maintainer has made it clear: any + * attempt to fix the detection will be obstructed. As a result, we're left + * with little choice but to throw an error. Unfortunately, this also affects + * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), + * which rely on core-js. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (isMaskable(value)) { + throw new Error(CORE_ERROR_TEXT); + } + return baseIsNative(value); + } + + /** + * Checks if `value` is `null`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `null`, else `false`. + * @example + * + * _.isNull(null); + * // => true + * + * _.isNull(void 0); + * // => false + */ + function isNull(value) { + return value === null; + } + + /** + * Checks if `value` is `null` or `undefined`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is nullish, else `false`. + * @example + * + * _.isNil(null); + * // => true + * + * _.isNil(void 0); + * // => true + * + * _.isNil(NaN); + * // => false + */ + function isNil(value) { + return value == null; + } + + /** + * Checks if `value` is classified as a `Number` primitive or object. + * + * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are + * classified as numbers, use the `_.isFinite` method. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a number, else `false`. + * @example + * + * _.isNumber(3); + * // => true + * + * _.isNumber(Number.MIN_VALUE); + * // => true + * + * _.isNumber(Infinity); + * // => true + * + * _.isNumber('3'); + * // => false + */ + function isNumber(value) { + return typeof value == 'number' || + (isObjectLike(value) && baseGetTag(value) == numberTag); + } + + /** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ + function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor == 'function' && Ctor instanceof Ctor && + funcToString.call(Ctor) == objectCtorString; + } + + /** + * Checks if `value` is classified as a `RegExp` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + * @example + * + * _.isRegExp(/abc/); + * // => true + * + * _.isRegExp('/abc/'); + * // => false + */ + var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; + + /** + * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 + * double precision number which isn't the result of a rounded unsafe integer. + * + * **Note:** This method is based on + * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. + * @example + * + * _.isSafeInteger(3); + * // => true + * + * _.isSafeInteger(Number.MIN_VALUE); + * // => false + * + * _.isSafeInteger(Infinity); + * // => false + * + * _.isSafeInteger('3'); + * // => false + */ + function isSafeInteger(value) { + return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is classified as a `Set` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + * @example + * + * _.isSet(new Set); + * // => true + * + * _.isSet(new WeakSet); + * // => false + */ + var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; + + /** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ + function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + } + + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); + } + + /** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ + var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + + /** + * Checks if `value` is `undefined`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. + * @example + * + * _.isUndefined(void 0); + * // => true + * + * _.isUndefined(null); + * // => false + */ + function isUndefined(value) { + return value === undefined; + } + + /** + * Checks if `value` is classified as a `WeakMap` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. + * @example + * + * _.isWeakMap(new WeakMap); + * // => true + * + * _.isWeakMap(new Map); + * // => false + */ + function isWeakMap(value) { + return isObjectLike(value) && getTag(value) == weakMapTag; + } + + /** + * Checks if `value` is classified as a `WeakSet` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. + * @example + * + * _.isWeakSet(new WeakSet); + * // => true + * + * _.isWeakSet(new Set); + * // => false + */ + function isWeakSet(value) { + return isObjectLike(value) && baseGetTag(value) == weakSetTag; + } + + /** + * Checks if `value` is less than `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. + * @see _.gt + * @example + * + * _.lt(1, 3); + * // => true + * + * _.lt(3, 3); + * // => false + * + * _.lt(3, 1); + * // => false + */ + var lt = createRelationalOperation(baseLt); + + /** + * Checks if `value` is less than or equal to `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than or equal to + * `other`, else `false`. + * @see _.gte + * @example + * + * _.lte(1, 3); + * // => true + * + * _.lte(3, 3); + * // => true + * + * _.lte(3, 1); + * // => false + */ + var lte = createRelationalOperation(function(value, other) { + return value <= other; + }); + + /** + * Converts `value` to an array. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Array} Returns the converted array. + * @example + * + * _.toArray({ 'a': 1, 'b': 2 }); + * // => [1, 2] + * + * _.toArray('abc'); + * // => ['a', 'b', 'c'] + * + * _.toArray(1); + * // => [] + * + * _.toArray(null); + * // => [] + */ + function toArray(value) { + if (!value) { + return []; + } + if (isArrayLike(value)) { + return isString(value) ? stringToArray(value) : copyArray(value); + } + if (symIterator && value[symIterator]) { + return iteratorToArray(value[symIterator]()); + } + var tag = getTag(value), + func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); + + return func(value); + } + + /** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ + function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; + } + + /** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ + function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; + } + + /** + * Converts `value` to an integer suitable for use as the length of an + * array-like object. + * + * **Note:** This method is based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toLength(3.2); + * // => 3 + * + * _.toLength(Number.MIN_VALUE); + * // => 0 + * + * _.toLength(Infinity); + * // => 4294967295 + * + * _.toLength('3.2'); + * // => 3 + */ + function toLength(value) { + return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; + } + + /** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ + function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = baseTrim(value); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); + } + + /** + * Converts `value` to a plain object flattening inherited enumerable string + * keyed properties of `value` to own properties of the plain object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {Object} Returns the converted plain object. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.assign({ 'a': 1 }, new Foo); + * // => { 'a': 1, 'b': 2 } + * + * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); + * // => { 'a': 1, 'b': 2, 'c': 3 } + */ + function toPlainObject(value) { + return copyObject(value, keysIn(value)); + } + + /** + * Converts `value` to a safe integer. A safe integer can be compared and + * represented correctly. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toSafeInteger(3.2); + * // => 3 + * + * _.toSafeInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toSafeInteger(Infinity); + * // => 9007199254740991 + * + * _.toSafeInteger('3.2'); + * // => 3 + */ + function toSafeInteger(value) { + return value + ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) + : (value === 0 ? value : 0); + } + + /** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + function toString(value) { + return value == null ? '' : baseToString(value); + } + + /*------------------------------------------------------------------------*/ + + /** + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assignIn + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assign({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3 } + */ + var assign = createAssigner(function(object, source) { + if (isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } + }); + + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assign + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assignIn({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } + */ + var assignIn = createAssigner(function(object, source) { + copyObject(source, keysIn(source), object); + }); + + /** + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keysIn(source), object, customizer); + }); + + /** + * This method is like `_.assign` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignInWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var assignWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keys(source), object, customizer); + }); + + /** + * Creates an array of values corresponding to `paths` of `object`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Array} Returns the picked values. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; + * + * _.at(object, ['a[0].b.c', 'a[1]']); + * // => [3, 4] + */ + var at = flatRest(baseAt); + + /** + * Creates an object that inherits from the `prototype` object. If a + * `properties` object is given, its own enumerable string keyed properties + * are assigned to the created object. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Object + * @param {Object} prototype The object to inherit from. + * @param {Object} [properties] The properties to assign to the object. + * @returns {Object} Returns the new object. + * @example + * + * function Shape() { + * this.x = 0; + * this.y = 0; + * } + * + * function Circle() { + * Shape.call(this); + * } + * + * Circle.prototype = _.create(Shape.prototype, { + * 'constructor': Circle + * }); + * + * var circle = new Circle; + * circle instanceof Circle; + * // => true + * + * circle instanceof Shape; + * // => true + */ + function create(prototype, properties) { + var result = baseCreate(prototype); + return properties == null ? result : baseAssign(result, properties); + } + + /** + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. + * + * **Note:** This method mutates `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaultsDeep + * @example + * + * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var defaults = baseRest(function(object, sources) { + object = Object(object); + + var index = -1; + var length = sources.length; + var guard = length > 2 ? sources[2] : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + length = 1; + } + + while (++index < length) { + var source = sources[index]; + var props = keysIn(source); + var propsIndex = -1; + var propsLength = props.length; + + while (++propsIndex < propsLength) { + var key = props[propsIndex]; + var value = object[key]; + + if (value === undefined || + (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { + object[key] = source[key]; + } + } + } + + return object; + }); + + /** + * This method is like `_.defaults` except that it recursively assigns + * default properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaults + * @example + * + * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); + * // => { 'a': { 'b': 2, 'c': 3 } } + */ + var defaultsDeep = baseRest(function(args) { + args.push(undefined, customDefaultsMerge); + return apply(mergeWith, undefined, args); + }); + + /** + * This method is like `_.find` except that it returns the key of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Object + * @param {Object} object The object to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findKey(users, function(o) { return o.age < 40; }); + * // => 'barney' (iteration order is not guaranteed) + * + * // The `_.matches` iteratee shorthand. + * _.findKey(users, { 'age': 1, 'active': true }); + * // => 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findKey(users, ['active', false]); + * // => 'fred' + * + * // The `_.property` iteratee shorthand. + * _.findKey(users, 'active'); + * // => 'barney' + */ + function findKey(object, predicate) { + return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); + } + + /** + * This method is like `_.findKey` except that it iterates over elements of + * a collection in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findLastKey(users, function(o) { return o.age < 40; }); + * // => returns 'pebbles' assuming `_.findKey` returns 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.findLastKey(users, { 'age': 36, 'active': true }); + * // => 'barney' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastKey(users, ['active', false]); + * // => 'fred' + * + * // The `_.property` iteratee shorthand. + * _.findLastKey(users, 'active'); + * // => 'pebbles' + */ + function findLastKey(object, predicate) { + return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); + } + + /** + * Iterates over own and inherited enumerable string keyed properties of an + * object and invokes `iteratee` for each property. The iteratee is invoked + * with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forInRight + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forIn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). + */ + function forIn(object, iteratee) { + return object == null + ? object + : baseFor(object, getIteratee(iteratee, 3), keysIn); + } + + /** + * This method is like `_.forIn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forIn + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forInRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. + */ + function forInRight(object, iteratee) { + return object == null + ? object + : baseForRight(object, getIteratee(iteratee, 3), keysIn); + } + + /** + * Iterates over own enumerable string keyed properties of an object and + * invokes `iteratee` for each property. The iteratee is invoked with three + * arguments: (value, key, object). Iteratee functions may exit iteration + * early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwnRight + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ + function forOwn(object, iteratee) { + return object && baseForOwn(object, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.forOwn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwn + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwnRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. + */ + function forOwnRight(object, iteratee) { + return object && baseForOwnRight(object, getIteratee(iteratee, 3)); + } + + /** + * Creates an array of function property names from own enumerable properties + * of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the function names. + * @see _.functionsIn + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functions(new Foo); + * // => ['a', 'b'] + */ + function functions(object) { + return object == null ? [] : baseFunctions(object, keys(object)); + } + + /** + * Creates an array of function property names from own and inherited + * enumerable properties of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the function names. + * @see _.functions + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functionsIn(new Foo); + * // => ['a', 'b', 'c'] + */ + function functionsIn(object) { + return object == null ? [] : baseFunctions(object, keysIn(object)); + } + + /** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; + } + + /** + * Checks if `path` is a direct property of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': 2 } }; + * var other = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b'); + * // => true + * + * _.has(object, ['a', 'b']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + function has(object, path) { + return object != null && hasPath(object, path, baseHas); + } + + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + function hasIn(object, path) { + return object != null && hasPath(object, path, baseHasIn); + } + + /** + * Creates an object composed of the inverted keys and values of `object`. + * If `object` contains duplicate values, subsequent values overwrite + * property assignments of previous values. + * + * @static + * @memberOf _ + * @since 0.7.0 + * @category Object + * @param {Object} object The object to invert. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invert(object); + * // => { '1': 'c', '2': 'b' } + */ + var invert = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + + result[value] = key; + }, constant(identity)); + + /** + * This method is like `_.invert` except that the inverted object is generated + * from the results of running each element of `object` thru `iteratee`. The + * corresponding inverted value of each inverted key is an array of keys + * responsible for generating the inverted value. The iteratee is invoked + * with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.1.0 + * @category Object + * @param {Object} object The object to invert. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invertBy(object); + * // => { '1': ['a', 'c'], '2': ['b'] } + * + * _.invertBy(object, function(value) { + * return 'group' + value; + * }); + * // => { 'group1': ['a', 'c'], 'group2': ['b'] } + */ + var invertBy = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + + if (hasOwnProperty.call(result, value)) { + result[value].push(key); + } else { + result[value] = [key]; + } + }, getIteratee); + + /** + * Invokes the method at `path` of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + * @example + * + * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; + * + * _.invoke(object, 'a[0].b.c.slice', 1, 3); + * // => [2, 3] + */ + var invoke = baseRest(baseInvoke); + + /** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ + function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); + } + + /** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ + function keysIn(object) { + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); + } + + /** + * The opposite of `_.mapValues`; this method creates an object with the + * same values as `object` and keys generated by running each own enumerable + * string keyed property of `object` thru `iteratee`. The iteratee is invoked + * with three arguments: (value, key, object). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns the new mapped object. + * @see _.mapValues + * @example + * + * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + * return key + value; + * }); + * // => { 'a1': 1, 'b2': 2 } + */ + function mapKeys(object, iteratee) { + var result = {}; + iteratee = getIteratee(iteratee, 3); + + baseForOwn(object, function(value, key, object) { + baseAssignValue(result, iteratee(value, key, object), value); + }); + return result; + } + + /** + * Creates an object with the same keys as `object` and values generated + * by running each own enumerable string keyed property of `object` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, key, object). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns the new mapped object. + * @see _.mapKeys + * @example + * + * var users = { + * 'fred': { 'user': 'fred', 'age': 40 }, + * 'pebbles': { 'user': 'pebbles', 'age': 1 } + * }; + * + * _.mapValues(users, function(o) { return o.age; }); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + * + * // The `_.property` iteratee shorthand. + * _.mapValues(users, 'age'); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + */ + function mapValues(object, iteratee) { + var result = {}; + iteratee = getIteratee(iteratee, 3); + + baseForOwn(object, function(value, key, object) { + baseAssignValue(result, key, iteratee(value, key, object)); + }); + return result; + } + + /** + * This method is like `_.assign` except that it recursively merges own and + * inherited enumerable string keyed properties of source objects into the + * destination object. Source properties that resolve to `undefined` are + * skipped if a destination value exists. Array and plain object properties + * are merged recursively. Other objects and value types are overridden by + * assignment. Source objects are applied from left to right. Subsequent + * sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * var object = { + * 'a': [{ 'b': 2 }, { 'd': 4 }] + * }; + * + * var other = { + * 'a': [{ 'c': 3 }, { 'e': 5 }] + * }; + * + * _.merge(object, other); + * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } + */ + var merge = createAssigner(function(object, source, srcIndex) { + baseMerge(object, source, srcIndex); + }); + + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined`, merging is handled by the + * method instead. The `customizer` is invoked with six arguments: + * (objValue, srcValue, key, object, source, stack). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { 'a': [1], 'b': [2] }; + * var other = { 'a': [3], 'b': [4] }; + * + * _.mergeWith(object, other, customizer); + * // => { 'a': [1, 3], 'b': [2, 4] } + */ + var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { + baseMerge(object, source, srcIndex, customizer); + }); + + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable property paths of `object` that are not omitted. + * + * **Note:** This method is considerably slower than `_.pick`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to omit. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + var omit = flatRest(function(object, paths) { + var result = {}; + if (object == null) { + return result; + } + var isDeep = false; + paths = arrayMap(paths, function(path) { + path = castPath(path, object); + isDeep || (isDeep = path.length > 1); + return path; + }); + copyObject(object, getAllKeysIn(object), result); + if (isDeep) { + result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); + } + var length = paths.length; + while (length--) { + baseUnset(result, paths[length]); + } + return result; + }); + + /** + * The opposite of `_.pickBy`; this method creates an object composed of + * the own and inherited enumerable string keyed properties of `object` that + * `predicate` doesn't return truthy for. The predicate is invoked with two + * arguments: (value, key). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The source object. + * @param {Function} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + function omitBy(object, predicate) { + return pickBy(object, negate(getIteratee(predicate))); + } + + /** + * Creates an object composed of the picked `object` properties. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + var pick = flatRest(function(object, paths) { + return object == null ? {} : basePick(object, paths); + }); + + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The source object. + * @param {Function} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + function pickBy(object, predicate) { + if (object == null) { + return {}; + } + var props = arrayMap(getAllKeysIn(object), function(prop) { + return [prop]; + }); + predicate = getIteratee(predicate); + return basePickBy(object, props, function(value, path) { + return predicate(value, path[0]); + }); + } + + /** + * This method is like `_.get` except that if the resolved value is a + * function it's invoked with the `this` binding of its parent object and + * its result is returned. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to resolve. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; + * + * _.result(object, 'a[0].b.c1'); + * // => 3 + * + * _.result(object, 'a[0].b.c2'); + * // => 4 + * + * _.result(object, 'a[0].b.c3', 'default'); + * // => 'default' + * + * _.result(object, 'a[0].b.c3', _.constant('default')); + * // => 'default' + */ + function result(object, path, defaultValue) { + path = castPath(path, object); + + var index = -1, + length = path.length; + + // Ensure the loop is entered when path is empty. + if (!length) { + length = 1; + object = undefined; + } + while (++index < length) { + var value = object == null ? undefined : object[toKey(path[index])]; + if (value === undefined) { + index = length; + value = defaultValue; + } + object = isFunction(value) ? value.call(object) : value; + } + return object; + } + + /** + * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, + * it's created. Arrays are created for missing index properties while objects + * are created for all other missing properties. Use `_.setWith` to customize + * `path` creation. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.set(object, 'a[0].b.c', 4); + * console.log(object.a[0].b.c); + * // => 4 + * + * _.set(object, ['x', '0', 'y', 'z'], 5); + * console.log(object.x[0].y.z); + * // => 5 + */ + function set(object, path, value) { + return object == null ? object : baseSet(object, path, value); + } + + /** + * This method is like `_.set` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * var object = {}; + * + * _.setWith(object, '[0][1]', 'a', Object); + * // => { '0': { '1': 'a' } } + */ + function setWith(object, path, value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return object == null ? object : baseSet(object, path, value, customizer); + } + + /** + * Creates an array of own enumerable string keyed-value pairs for `object` + * which can be consumed by `_.fromPairs`. If `object` is a map or set, its + * entries are returned. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias entries + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the key-value pairs. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.toPairs(new Foo); + * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) + */ + var toPairs = createToPairs(keys); + + /** + * Creates an array of own and inherited enumerable string keyed-value pairs + * for `object` which can be consumed by `_.fromPairs`. If `object` is a map + * or set, its entries are returned. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias entriesIn + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the key-value pairs. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.toPairsIn(new Foo); + * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) + */ + var toPairsIn = createToPairs(keysIn); + + /** + * An alternative to `_.reduce`; this method transforms `object` to a new + * `accumulator` object which is the result of running each of its own + * enumerable string keyed properties thru `iteratee`, with each invocation + * potentially mutating the `accumulator` object. If `accumulator` is not + * provided, a new object with the same `[[Prototype]]` will be used. The + * iteratee is invoked with four arguments: (accumulator, value, key, object). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The custom accumulator value. + * @returns {*} Returns the accumulated value. + * @example + * + * _.transform([2, 3, 4], function(result, n) { + * result.push(n *= n); + * return n % 2 == 0; + * }, []); + * // => [4, 9] + * + * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } + */ + function transform(object, iteratee, accumulator) { + var isArr = isArray(object), + isArrLike = isArr || isBuffer(object) || isTypedArray(object); + + iteratee = getIteratee(iteratee, 4); + if (accumulator == null) { + var Ctor = object && object.constructor; + if (isArrLike) { + accumulator = isArr ? new Ctor : []; + } + else if (isObject(object)) { + accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; + } + else { + accumulator = {}; + } + } + (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { + return iteratee(accumulator, value, index, object); + }); + return accumulator; + } + + /** + * Removes the property at `path` of `object`. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 7 } }] }; + * _.unset(object, 'a[0].b.c'); + * // => true + * + * console.log(object); + * // => { 'a': [{ 'b': {} }] }; + * + * _.unset(object, ['a', '0', 'b', 'c']); + * // => true + * + * console.log(object); + * // => { 'a': [{ 'b': {} }] }; + */ + function unset(object, path) { + return object == null ? true : baseUnset(object, path); + } + + /** + * This method is like `_.set` except that accepts `updater` to produce the + * value to set. Use `_.updateWith` to customize `path` creation. The `updater` + * is invoked with one argument: (value). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.update(object, 'a[0].b.c', function(n) { return n * n; }); + * console.log(object.a[0].b.c); + * // => 9 + * + * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); + * console.log(object.x[0].y.z); + * // => 0 + */ + function update(object, path, updater) { + return object == null ? object : baseUpdate(object, path, castFunction(updater)); + } + + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + function updateWith(object, path, updater, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); + } + + /** + * Creates an array of the own enumerable string keyed property values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.values(new Foo); + * // => [1, 2] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] + */ + function values(object) { + return object == null ? [] : baseValues(object, keys(object)); + } + + /** + * Creates an array of the own and inherited enumerable string keyed property + * values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.valuesIn(new Foo); + * // => [1, 2, 3] (iteration order is not guaranteed) + */ + function valuesIn(object) { + return object == null ? [] : baseValues(object, keysIn(object)); + } + + /*------------------------------------------------------------------------*/ + + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Number + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + function clamp(number, lower, upper) { + if (upper === undefined) { + upper = lower; + lower = undefined; + } + if (upper !== undefined) { + upper = toNumber(upper); + upper = upper === upper ? upper : 0; + } + if (lower !== undefined) { + lower = toNumber(lower); + lower = lower === lower ? lower : 0; + } + return baseClamp(toNumber(number), lower, upper); + } + + /** + * Checks if `n` is between `start` and up to, but not including, `end`. If + * `end` is not specified, it's set to `start` with `start` then set to `0`. + * If `start` is greater than `end` the params are swapped to support + * negative ranges. + * + * @static + * @memberOf _ + * @since 3.3.0 + * @category Number + * @param {number} number The number to check. + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + * @see _.range, _.rangeRight + * @example + * + * _.inRange(3, 2, 4); + * // => true + * + * _.inRange(4, 8); + * // => true + * + * _.inRange(4, 2); + * // => false + * + * _.inRange(2, 2); + * // => false + * + * _.inRange(1.2, 2); + * // => true + * + * _.inRange(5.2, 4); + * // => false + * + * _.inRange(-3, -2, -6); + * // => true + */ + function inRange(number, start, end) { + start = toFinite(start); + if (end === undefined) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + number = toNumber(number); + return baseInRange(number, start, end); + } + + /** + * Produces a random number between the inclusive `lower` and `upper` bounds. + * If only one argument is provided a number between `0` and the given number + * is returned. If `floating` is `true`, or either `lower` or `upper` are + * floats, a floating-point number is returned instead of an integer. + * + * **Note:** JavaScript follows the IEEE-754 standard for resolving + * floating-point values which can produce unexpected results. + * + * @static + * @memberOf _ + * @since 0.7.0 + * @category Number + * @param {number} [lower=0] The lower bound. + * @param {number} [upper=1] The upper bound. + * @param {boolean} [floating] Specify returning a floating-point number. + * @returns {number} Returns the random number. + * @example + * + * _.random(0, 5); + * // => an integer between 0 and 5 + * + * _.random(5); + * // => also an integer between 0 and 5 + * + * _.random(5, true); + * // => a floating-point number between 0 and 5 + * + * _.random(1.2, 5.2); + * // => a floating-point number between 1.2 and 5.2 + */ + function random(lower, upper, floating) { + if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { + upper = floating = undefined; + } + if (floating === undefined) { + if (typeof upper == 'boolean') { + floating = upper; + upper = undefined; + } + else if (typeof lower == 'boolean') { + floating = lower; + lower = undefined; + } + } + if (lower === undefined && upper === undefined) { + lower = 0; + upper = 1; + } + else { + lower = toFinite(lower); + if (upper === undefined) { + upper = lower; + lower = 0; + } else { + upper = toFinite(upper); + } + } + if (lower > upper) { + var temp = lower; + lower = upper; + upper = temp; + } + if (floating || lower % 1 || upper % 1) { + var rand = nativeRandom(); + return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); + } + return baseRandom(lower, upper); + } + + /*------------------------------------------------------------------------*/ + + /** + * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the camel cased string. + * @example + * + * _.camelCase('Foo Bar'); + * // => 'fooBar' + * + * _.camelCase('--foo-bar--'); + * // => 'fooBar' + * + * _.camelCase('__FOO_BAR__'); + * // => 'fooBar' + */ + var camelCase = createCompounder(function(result, word, index) { + word = word.toLowerCase(); + return result + (index ? capitalize(word) : word); + }); + + /** + * Converts the first character of `string` to upper case and the remaining + * to lower case. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to capitalize. + * @returns {string} Returns the capitalized string. + * @example + * + * _.capitalize('FRED'); + * // => 'Fred' + */ + function capitalize(string) { + return upperFirst(toString(string).toLowerCase()); + } + + /** + * Deburrs `string` by converting + * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) + * letters to basic Latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to deburr. + * @returns {string} Returns the deburred string. + * @example + * + * _.deburr('déjà vu'); + * // => 'deja vu' + */ + function deburr(string) { + string = toString(string); + return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); + } + + /** + * Checks if `string` ends with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {string} [target] The string to search for. + * @param {number} [position=string.length] The position to search up to. + * @returns {boolean} Returns `true` if `string` ends with `target`, + * else `false`. + * @example + * + * _.endsWith('abc', 'c'); + * // => true + * + * _.endsWith('abc', 'b'); + * // => false + * + * _.endsWith('abc', 'b', 2); + * // => true + */ + function endsWith(string, target, position) { + string = toString(string); + target = baseToString(target); + + var length = string.length; + position = position === undefined + ? length + : baseClamp(toInteger(position), 0, length); + + var end = position; + position -= target.length; + return position >= 0 && string.slice(position, end) == target; + } + + /** + * Converts the characters "&", "<", ">", '"', and "'" in `string` to their + * corresponding HTML entities. + * + * **Note:** No other characters are escaped. To escape additional + * characters use a third-party library like [_he_](https://mths.be/he). + * + * Though the ">" character is escaped for symmetry, characters like + * ">" and "/" don't need escaping in HTML and have no special meaning + * unless they're part of a tag or unquoted attribute value. See + * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) + * (under "semi-related fun fact") for more details. + * + * When working with HTML you should always + * [quote attribute values](http://wonko.com/post/html-escaping) to reduce + * XSS vectors. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escape('fred, barney, & pebbles'); + * // => 'fred, barney, & pebbles' + */ + function escape(string) { + string = toString(string); + return (string && reHasUnescapedHtml.test(string)) + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; + } + + /** + * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", + * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escapeRegExp('[lodash](https://lodash.com/)'); + * // => '\[lodash\]\(https://lodash\.com/\)' + */ + function escapeRegExp(string) { + string = toString(string); + return (string && reHasRegExpChar.test(string)) + ? string.replace(reRegExpChar, '\\$&') + : string; + } + + /** + * Converts `string` to + * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the kebab cased string. + * @example + * + * _.kebabCase('Foo Bar'); + * // => 'foo-bar' + * + * _.kebabCase('fooBar'); + * // => 'foo-bar' + * + * _.kebabCase('__FOO_BAR__'); + * // => 'foo-bar' + */ + var kebabCase = createCompounder(function(result, word, index) { + return result + (index ? '-' : '') + word.toLowerCase(); + }); + + /** + * Converts `string`, as space separated words, to lower case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the lower cased string. + * @example + * + * _.lowerCase('--Foo-Bar--'); + * // => 'foo bar' + * + * _.lowerCase('fooBar'); + * // => 'foo bar' + * + * _.lowerCase('__FOO_BAR__'); + * // => 'foo bar' + */ + var lowerCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + word.toLowerCase(); + }); + + /** + * Converts the first character of `string` to lower case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.lowerFirst('Fred'); + * // => 'fred' + * + * _.lowerFirst('FRED'); + * // => 'fRED' + */ + var lowerFirst = createCaseFirst('toLowerCase'); + + /** + * Pads `string` on the left and right sides if it's shorter than `length`. + * Padding characters are truncated if they can't be evenly divided by `length`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.pad('abc', 8); + * // => ' abc ' + * + * _.pad('abc', 8, '_-'); + * // => '_-abc_-_' + * + * _.pad('abc', 3); + * // => 'abc' + */ + function pad(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + if (!length || strLength >= length) { + return string; + } + var mid = (length - strLength) / 2; + return ( + createPadding(nativeFloor(mid), chars) + + string + + createPadding(nativeCeil(mid), chars) + ); + } + + /** + * Pads `string` on the right side if it's shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padEnd('abc', 6); + * // => 'abc ' + * + * _.padEnd('abc', 6, '_-'); + * // => 'abc_-_' + * + * _.padEnd('abc', 3); + * // => 'abc' + */ + function padEnd(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (string + createPadding(length - strLength, chars)) + : string; + } + + /** + * Pads `string` on the left side if it's shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padStart('abc', 6); + * // => ' abc' + * + * _.padStart('abc', 6, '_-'); + * // => '_-_abc' + * + * _.padStart('abc', 3); + * // => 'abc' + */ + function padStart(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (createPadding(length - strLength, chars) + string) + : string; + } + + /** + * Converts `string` to an integer of the specified radix. If `radix` is + * `undefined` or `0`, a `radix` of `10` is used unless `value` is a + * hexadecimal, in which case a `radix` of `16` is used. + * + * **Note:** This method aligns with the + * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category String + * @param {string} string The string to convert. + * @param {number} [radix=10] The radix to interpret `value` by. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {number} Returns the converted integer. + * @example + * + * _.parseInt('08'); + * // => 8 + * + * _.map(['6', '08', '10'], _.parseInt); + * // => [6, 8, 10] + */ + function parseInt(string, radix, guard) { + if (guard || radix == null) { + radix = 0; + } else if (radix) { + radix = +radix; + } + return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); + } + + /** + * Repeats the given string `n` times. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to repeat. + * @param {number} [n=1] The number of times to repeat the string. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {string} Returns the repeated string. + * @example + * + * _.repeat('*', 3); + * // => '***' + * + * _.repeat('abc', 2); + * // => 'abcabc' + * + * _.repeat('abc', 0); + * // => '' + */ + function repeat(string, n, guard) { + if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { + n = 1; + } else { + n = toInteger(n); + } + return baseRepeat(toString(string), n); + } + + /** + * Replaces matches for `pattern` in `string` with `replacement`. + * + * **Note:** This method is based on + * [`String#replace`](https://mdn.io/String/replace). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to modify. + * @param {RegExp|string} pattern The pattern to replace. + * @param {Function|string} replacement The match replacement. + * @returns {string} Returns the modified string. + * @example + * + * _.replace('Hi Fred', 'Fred', 'Barney'); + * // => 'Hi Barney' + */ + function replace() { + var args = arguments, + string = toString(args[0]); + + return args.length < 3 ? string : string.replace(args[1], args[2]); + } + + /** + * Converts `string` to + * [snake case](https://en.wikipedia.org/wiki/Snake_case). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the snake cased string. + * @example + * + * _.snakeCase('Foo Bar'); + * // => 'foo_bar' + * + * _.snakeCase('fooBar'); + * // => 'foo_bar' + * + * _.snakeCase('--FOO-BAR--'); + * // => 'foo_bar' + */ + var snakeCase = createCompounder(function(result, word, index) { + return result + (index ? '_' : '') + word.toLowerCase(); + }); + + /** + * Splits `string` by `separator`. + * + * **Note:** This method is based on + * [`String#split`](https://mdn.io/String/split). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to split. + * @param {RegExp|string} separator The separator pattern to split by. + * @param {number} [limit] The length to truncate results to. + * @returns {Array} Returns the string segments. + * @example + * + * _.split('a-b-c', '-', 2); + * // => ['a', 'b'] + */ + function split(string, separator, limit) { + if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { + separator = limit = undefined; + } + limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; + if (!limit) { + return []; + } + string = toString(string); + if (string && ( + typeof separator == 'string' || + (separator != null && !isRegExp(separator)) + )) { + separator = baseToString(separator); + if (!separator && hasUnicode(string)) { + return castSlice(stringToArray(string), 0, limit); + } + } + return string.split(separator, limit); + } + + /** + * Converts `string` to + * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). + * + * @static + * @memberOf _ + * @since 3.1.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the start cased string. + * @example + * + * _.startCase('--foo-bar--'); + * // => 'Foo Bar' + * + * _.startCase('fooBar'); + * // => 'Foo Bar' + * + * _.startCase('__FOO_BAR__'); + * // => 'FOO BAR' + */ + var startCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + upperFirst(word); + }); + + /** + * Checks if `string` starts with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {string} [target] The string to search for. + * @param {number} [position=0] The position to search from. + * @returns {boolean} Returns `true` if `string` starts with `target`, + * else `false`. + * @example + * + * _.startsWith('abc', 'a'); + * // => true + * + * _.startsWith('abc', 'b'); + * // => false + * + * _.startsWith('abc', 'b', 1); + * // => true + */ + function startsWith(string, target, position) { + string = toString(string); + position = position == null + ? 0 + : baseClamp(toInteger(position), 0, string.length); + + target = baseToString(target); + return string.slice(position, position + target.length) == target; + } + + /** + * Creates a compiled template function that can interpolate data properties + * in "interpolate" delimiters, HTML-escape interpolated data properties in + * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data + * properties may be accessed as free variables in the template. If a setting + * object is given, it takes precedence over `_.templateSettings` values. + * + * **Note:** In the development build `_.template` utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) + * for easier debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The template string. + * @param {Object} [options={}] The options object. + * @param {RegExp} [options.escape=_.templateSettings.escape] + * The HTML "escape" delimiter. + * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] + * The "evaluate" delimiter. + * @param {Object} [options.imports=_.templateSettings.imports] + * An object to import into the template as free variables. + * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] + * The "interpolate" delimiter. + * @param {string} [options.sourceURL='lodash.templateSources[n]'] + * The sourceURL of the compiled template. + * @param {string} [options.variable='obj'] + * The data object variable name. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the compiled template function. + * @example + * + * // Use the "interpolate" delimiter to create a compiled template. + * var compiled = _.template('hello <%= user %>!'); + * compiled({ 'user': 'fred' }); + * // => 'hello fred!' + * + * // Use the HTML "escape" delimiter to escape data property values. + * var compiled = _.template('<%- value %>'); + * compiled({ 'value': '